My last attempt at creating a native game engine using Vala was disappointing - great language, slow run time. I actually considered Nim prior to trying Vala, but I was put off by the 'partial style insensitivity' - this means that 'setValue', 'set_value', and 'setvalue' all refer to the same identifier. I don't see any good reasons for that, just another way to get bugs. Between this and the original name Nimrod I was convinced that it was done to prevent wide spread acceptance and keep Nim as a hobby language.
But this isn't a rant. I can live with 'partial insensitivity', and the name was shortened. Nim has a pragmatic style. Nim doesn't have classes, so I don't end up with a complex class hierarchy - this is a good thing. I can use inheritance where it is needed, and composition is easy. With multi methods, I can define a 'class' in more than one file - this is handy if I want to extend an existing class like you can in CSharp. Compared to languages like Java which provide a 'place for everything, everything in it's place', Nim gives you a lot more freedom in organizing your code and files. And definitely requires less boilerplate. Of course, since there is not much structure, you'll need to provide your own.
After 2 weeks of coding, my proof of concept is running on both Linux and Windows7. Not only that, the performance is better than I anticipated, even exciting. I've done no performance tuning. My entity object uses an array for components, but all other arrays are just sequences, tables and queues - all plain Nim dynamic structures. When I play my test demo, ShmupWarz, I can shoot bullets continuously for minutes, blasting enemy ships, and only once did I notice my frame rate drop below 60 fps.
I'm sold. I'm continuing on with my project, using Nim
No comments:
Post a Comment