Jump to content
  • Advertisement
Sign in to follow this  
brightknight

Should video game mechanics be scripted?

This topic is 772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was just wondering, whether the Core game mechanics of a game should be scripted(e.g with lua, or other scripting languages) Or whether they should be Hardcoded (e.g with c++).

By Core game mechanics i mean the things that make the game THE GAME.

e.g Shooting, parkour, melee e.t.c.

 

 

 

Share this post


Link to post
Share on other sites
Advertisement

If you look at any of the larger engines, they are designed in such a way that the core (rendering, sound system etc) are written in a lower level language such as C++ and everything you need is exposed via scripting.

 

Take Unity for example where the core engine is C++ but any part you might want to use (and add gameplay logic to) is C#.

 

Again, look at Unreal Engine 4, where although you can extend the engine with C++ and full source is given, the encouragement and common sense way to write your game is to write C++ base logic and classes then extend them using the built in blueprint visual scripting language.

 

In both cases there is a lot of interop going on beneat the hood, which as a lone developer or small indie team it's hard to invest the time to do this or to even see a return on that investment of time, as by the time you've implemented it you could have the simple game out months sooner. If on the other hand youre on a larger team, different people have different skill sets, and because of this they aren't all programmers so each will be presented with a part of the engine which is friendly to them, e.g. the sound designer's part of the engine will be familiar to audio people, and maybe will look like audacity or such. The animator's section will appear like an animation package and the programming parts... well.. obviously will be like an IDE with a debugger, profiler etc.

 

It is my opinion that where an engine offers scripting to write game logic, use it unless using it impacts performance too greatly to do so, in which case write that part natively, e.g. tight loops and complex matrix operations.

 

Hope this helps explain somewhat... :)

Share this post


Link to post
Share on other sites

If you look at any of the larger engines, they are designed in such a way that the core (rendering, sound system etc) are written in a lower level language such as C++ and everything you need is exposed via scripting.
 
Take Unity for example where the core engine is C++ but any part you might want to use (and add gameplay logic to) is C#.
 
Again, look at Unreal Engine 4, where although you can extend the engine with C++ and full source is given, the encouragement and common sense way to write your game is to write C++ base logic and classes then extend them using the built in blueprint visual scripting language.
 
In both cases there is a lot of interop going on beneat the hood, which as a lone developer or small indie team it's hard to invest the time to do this or to even see a return on that investment of time, as by the time you've implemented it you could have the simple game out months sooner. If on the other hand youre on a larger team, different people have different skill sets, and because of this they aren't all programmers so each will be presented with a part of the engine which is friendly to them, e.g. the sound designer's part of the engine will be familiar to audio people, and maybe will look like audacity or such. The animator's section will appear like an animation package and the programming parts... well.. obviously will be like an IDE with a debugger, profiler etc.
 
It is my opinion that where an engine offers scripting to write game logic, use it unless using it impacts performance too greatly to do so, in which case write that part natively, e.g. tight loops and complex matrix operations.
 
Hope this helps explain somewhat... :)


Thanks alot for the reply, so basically you're saying script mechanics if using an engine that encourages/allows it, eg unity or unreal, unless it impacts performance greatly.

The main reason for asking is due to the fact that I know personally that I won't ever be able to make a game that requires top notch performance optimizations to run well, so basically I dont want to write any more c++ than I have to(*note I love c++ as a language but sometimes its a bit overkill, *) I saw a comparison between c++ and python and python could do in like 5 lines what took c++ 100 lines. And I just thought at that point why use c++ over python for such a task.

Share this post


Link to post
Share on other sites
Exactly. If performance isn't an issue or a requirement then don't waste time writing 100 lines when you can write 5. That's my opinion too.

To do otherwise is to try and build your car from iron filings because it will be faster once you're finished :)

Share this post


Link to post
Share on other sites

 


I saw a comparison between c++ and python and python could do in like 5 lines what took c++ 100 lines

 

What kind of task was achieved here to take the comparsion on? I dont beleive that doing anything quiete low level takes in cpp that much more code than it does in python even when both have access to a similar written API (such as opening a file or such things). When python uses a library and cpp does anything from scratch then I agree that python will take less code compared to cpp but that are unrealistic comparsion basics (like comparing a bicycle against Ferrari)

 

It is true that game designers are more and more involved into the game developing process on coding side and the next step are node based scripts as I've seen on upcomming engine previews but at certain point, scripting languages gain inefficient and on most platforms other than Desktop ones performance is way more important than it is comfortable to use a scripting language with less restrictions as compiled code. This depends on the runtime as well as on the interface between code and script. Unity and Unreal got named here where I have worked with both since years know and both dosent fit in scripting at certain point when the project grows too much.

 

On unity it is less a technical decisiona s more a business decision to not offer there source code to everyone so you are forced to use there "scripting" system (where in my opinion naming C# a scripting language is heresy) where it is a help for designers in unreal but taking the call stack as simple example is a mess when doing UI stuff for example.

I agree that small indies dont have the time and money to adapt any source to there games but I would always prefer doing the hard core of any gameplay in the engine, someone might reuse that for another game and do such things like story, dialogs, quests s.o. in soft coding a scripting language

Share this post


Link to post
Share on other sites

I saw a comparison between c++ and python and python could do in like 5 lines what took c++ 100 lines

 
What kind of task was achieved here to take the comparsion on? I dont beleive that doing anything quiete low level takes in cpp that much more code than it does in python even when both have access to a similar written API (such as opening a file or such things). When python uses a library and cpp does anything from scratch then I agree that python will take less code compared to cpp but that are unrealistic comparsion basics (like comparing a bicycle against Ferrari)

 
It is true that game designers are more and more involved into the game developing process on coding side and the next step are node based scripts as I've seen on upcomming engine previews but at certain point, scripting languages gain inefficient and on most platforms other than Desktop ones performance is way more important than it is comfortable to use a scripting language with less restrictions as compiled code. This depends on the runtime as well as on the interface between code and script. Unity and Unreal got named here where I have worked with both since years know and both dosent fit in scripting at certain point when the project grows too much.
 
On unity it is less a technical decisiona s more a business decision to not offer there source code to everyone so you are forced to use there "scripting" system (where in my opinion naming C# a scripting language is heresy) where it is a help for designers in unreal but taking the call stack as simple example is a mess when doing UI stuff for example.
I agree that small indies dont have the time and money to adapt any source to there games but I would always prefer doing the hard core of any gameplay in the engine, someone might reuse that for another game and do such things like story, dialogs, quests s.o. in soft coding a scripting language

Is there a reason why scripts wouldn't be reusable?? Also I can't seem to find the comparison between python and c++, also note I said "like" 5 lines in python and "like" 100 lines in c++ as I didn't count the lines of code.

But still is there a reason why scripts can't be reused?

Share this post


Link to post
Share on other sites

Real programmers use FORTRAN, and If you can't do it in FORTRAN, do it in assembly.  If you can't
do it in assembly, it isn't worth doing

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!