Hi!, I'm considering Nim for game development. In order to easily code the game engine and its tools, I think RTTI would help a lot. I'm wondering if Nim has RTTI (Runtime type information)?
Additionally what I am looking for in a new game development language is the ability to incorporate code changes into a running game without having to restart the game as iterating changes to a game is the single most time consuming part. This might require something like runtime compilation and/or dynamic code update. (See http://runtimecompiledcplusplus.blogspot.com/ for an example of what I'm talking about.) Is there any way this can be done in Nim? (Yes, a scripting language could be used instead, but I'd prefer to use a single language for the whole game.)
Thank you!
There is RTTI and the marshal.nim module makes heavy use of it. Note that there are also other ways to do relatively painfree serialization like using the fieldPairs iterators.
Additionally what I am looking for in a new game development language is the ability to incorporate code changes into a running game without having to restart the game as iterating changes to a game is the single most time consuming part.
This cannot be done easily right now, but there a couple of ways that we're trying out since we have the same problem. ;-) More on this later.
Wow, thanks for the info.
Looking forward to hearing more on runtime updating of code :)
Check out Caseys solution at HandMadeHero.org (some where around day 20 or so). He solves the issue through lever design where the game is the service (dll) to the platform layer which checks if the dll has updated once per frame and then reloads the dll. The effect is pretty awesome as it lets you live code your game and tweak almost anything you like (not struct orders etc offcourse). I have tried what he showes and it is really that sweet. Its like having all you game code in a scripting language but with the power of C in his case. The basic design is that he allocs a big chunk of mem in the platform at only hands the pointer to the game, meaning no allocs are done in the game and the memory and the state is kept over dll reloads since it belongs to the platform.
It was all new to me and just bad ass. My questions now revolve around how to use Nim effectivly while still allocing memory and using ptr for reference, or if I am just doing myself a disservice byt trying to make Nim to C while actually trying to escape C for Nim.
EDIT: He also uses the mem block to do looping of the game (like audio sampling) which also helps the iterative adjustment of code.
My questions now revolve around how to use Nim effectivly while still allocing memory and using ptr for reference, or if I am just doing myself a disservice byt trying to make Nim to C while actually trying to escape C for Nim.
Writing code that uses manual memory management is perfectly fine in Nim. While you lose memory safety this way, not all is lost; for instance you then still get a type system that is not stuck in the 70ies and can distinguish between pointer to a single character (ptr char) and pointer to an array of characters (ptr UncheckedArray[char]) and pointer to an array of characters terminated with binary 0 (cstring). ;-)