🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

What is the light weight alternative to Unity ?

Started by
30 comments, last by Gnollrunner 5 years, 11 months ago
7 hours ago, SillyCow said:

It's not about "no heap allocation whatsoever". But rather trying not to do any real time heap allocations. Try not to call "new/malloc" when your game is running. If you are using C++ try not to call "delete/free" when your game is running. Just preallocate as much as you can at the beginning and recycle it as much as you can. For ex: I wrote a rather complex pathfinding algorithm for an RTS. The performance more than doubled if I "recycled" my memory structures when I was done with them. So subsequent calls would just reinitialise the memory structures from the previous calls.

Again, using the system new/delete is not the same is overloading them.  Please lookup "placement new". You can pass new as many parameters as you want and customize it any way you want.  Typically some form of slab allocation is used and you really aren't doing much when you "new" or "delete" memory. It's usually as simple as taking the first thing off a list or moving a pointer. For delete you just add your memory to the top of a list. It's a couple pointer changes. If you put new and delete in the class header, the compiler will inline them so you don't even end up calling a function.  You don't need to explicitly "recycle" memory because slab allocators do exactly that without you needing to put the logic for it into your application. Perhaps with C# you may have to worry about allocation at run time because you can't control how it works. With C++ however, it's not a problem.

This topic is closed to new replies.

Advertisement