• Advertisement
Sign in to follow this  

A question for how game engines build their game code for game logic -_-?

This topic is 719 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

Hello, I'm just starting planning a huge structure for my game engine. 

 

I just wondered what something most codes of game engines for game logic were made by.

 

script code for script engine or compiler of engine ? just computer language with dll or includes ?

 

I saw popular engines used java , lua or own script and they even can make games of multiple genre.  :mellow:

Share this post


Link to post
Share on other sites
Advertisement

Most game engines these days are made in C++.  Some are made in other languages, but they are few in number.  Game engines and other systems-level work has more complex needs for explicit memory management and object lifetimes, for explicit control of many hardware features, for direct access to a linked library rather than going through a marshalling process from an abstract memory format to a specific one. C++ provides better control of those features than most other modern languages.  

 

Games use a wide range of languages for script code. C#, Lua, AngelScript, and C++, and more as well.  Scripting languages can (but do not need to) provide a way to modify the game without stopping to rebuild the source code, can make it easier for large teams to collaborate, can make it easier for designers and artists to make changes with less fear of breaking the game.  

 

You can choose to use whatever languages you want.  HTML and Javascript, Python, C, Java, Go, Rust, Scheme, or any other language you feel like using to write your game.

 

Know that those "popular engines" are typically built and maintained by teams of 100+ people. A hobby project with one person has different needs.

Share this post


Link to post
Share on other sites

I don't think that quite answers his question. It sounds like he's asking about how games typically structure the game logic portion of their code separate from the rendering/physics/etc.

 

Unfortunately, there's no good answer there. Some companies do everything in the same language and use scripts only lightly. Some companies push all game logic into scripts. Some companies dynamically load DLLs with native game code, some just compile it all in with the engine to one unified binary. There's pros and cons to all the approaches.

 

If you're just making a game and not trying to make a big reusable commercial engine, you're probably best off not worrying _too_ much about separating game logic from core engine logic. Try to keep the code clean, but don't worry too much about how isolated the game logic is. You can easily spend more time trying to keep the game logic cleanly separated than you do actually making the game, especially if your engine isn't already a production-grade fully-featured multi-genre engine.

Share this post


Link to post
Share on other sites

Thanks for your replies. :)

 

@ frob : I just want that my engine can be a wide use engine for every genre.

 

@ SeanMiddleditch : I saw quake3 engine used quake virtual machine and q3asm code translator(?).

vm_chain_prod.png

( href = http://fabiensanglard.net/quake3/qvm.php )

 

If I made an engine like this...

PE functions for instructions
pe_obj_make( Id , &Res , Type ) : Obj_Make Id , "ResDir" , Type
pe_obj_delete( Id ) : Obj_Delete Id
pe_obj_state( Id , StateType ) ; Obj_State:Id
...
In logic code
Obj_Make 0 , "./Res/Pizza.blend" , #3D
Obj_Make 1 , "./Res/Coke.blend" , #3D
Obj_Make 2 , "./Res/Table.blend" , #3D
Obj_Make 3 , "./Res/TV.blend" , #3D

If Obj_State:0 == False
  Console_Print( "Error" )
End
... 

I think both q3 and above code can make and change logic of a game easily but I don't know how I sketch my engine like this for own code translator.

 

 

Some companies dynamically load DLLs with native game code

 

Also I think it's better solution than biggest structure of own scripting or logic code for cutting down worries , waste of times. :mellow:

 

anyway I wonder how q3 vm codes are made of.

Share this post


Link to post
Share on other sites

 

 

@ frob : I just want that my engine can be a wide use engine for every genre.

 

 

 

How about making ONE game with your engine.  Then you can worry about "every genre" somewhere down the line.

Share this post


Link to post
Share on other sites

@ 0r0d : 

 

How about making ONE game with your engine.  Then you can worry about "every genre" somewhere down the line.

 

umm I made a game with other engine so realized what structure I have to make for a wide use of every genre.

 

this structure is my engine can support various instructions ( like Script or VM or Compiler and so on ) or can be a core library.

 

If my engine could be like this , all of game makers can make all contents , UIs , logics.

 

@ Hodgman : I can put Lua on my engine, of course and used it for some months but I want to make my own script or code system. :)

Share this post


Link to post
Share on other sites

@ 0r0d : 

 

How about making ONE game with your engine.  Then you can worry about "every genre" somewhere down the line.

 

umm I made a game with other engine so realized what structure I have to make for a wide use of every genre.

 

this structure is my engine can support various instructions ( like Script or VM or Compiler and so on ) or can be a core library.

 

If my engine could be like this , all of game makers can make all contents , UIs , logics.

 

I'm really not sure what you're asking.  It sounds like you already know enough to know what you want to put into your engine.  So just make the engine, then make a game.  If you're asking what's the best way to make an engine that will be great at every single type of game... there's no such thing.  Just decide what type of game you want to make, figure out what features the engine need, and then make that.

Share this post


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

  • Advertisement