All the fundamental behaviours (movement, combat, resource harvesting) are implemented in C.
The engine uses Python as a scripting/config language. You can use it to hook into a lot of events pushed from the engine core (unit got selected, unit started movement, unit started harvesting, etc.) and customize or change the unit behaviours.
My initial idea was that I wanted a more "sexy" language for scripting. Python is a lot more popular and (arguably) more enjoyable to use than Lua. There's a lot of cool stuff like list comprehensions. Plus I had a selfish reason of just wanting to learn more Python and fool around with the CPython code.
Over the duration of the project, I really did learn to appreciate why Lua is embedded into games and Python isn't. Lua is really small and you have full control over everything. And you're eventually going to need that control when you implement features like reflection, pausing the game, etc. CPython is this big shared library that does its' own thing and you have a lot less control over. The parts where it just doesn't expose enough through its' API do do what you want is a real huge pain. I ended up writing a bunch of code to serialize all the internal data structures and this was a massive chore. Also you have a lot less control over CPython's performance and memory allocations. I didn't really appreciate these things when I started the project so hence I went with Python. But since I ended up doing it, I guess you can still enjoy the benefits of it.
After leaving some pretty negative comments on many 'code submissions' my expectations were fairly low and I was expecting another novice-level project of subpar engineering.
Well. Looks like I'll have to adjust my expectations. This is above and far beyond what I would dare criticize or probably could produce myself. Teaches me to not bunch "Show HN: my npm package you should totally use in production" with "Show HN: my C passion project of 3 years".
If you made me put a number on it 1 and 4 show HN posts that hit the front page are pretty impressive. The other 3 get there from a mix of "hot" tech, a good title, and a slow news day.
+1 for this. A lot of people lack scope when they submit their programs, which is mostly fine since HN ranks posts by upvotes. This is really one of those "bigger fish" moments for sure, though.
Suppose I could but chose not to? It's not like I also listed each of them.
I also don't have a problem with people submitting bad code. I however will speak up when people submit horrible code wrapped in a npm package and there's a real risk of someone unsuspecting accidentally using it.
Comments (262) 55 threads
Earlier commentsThe engine uses Python as a scripting/config language. You can use it to hook into a lot of events pushed from the engine core (unit got selected, unit started movement, unit started harvesting, etc.) and customize or change the unit behaviours.
Over the duration of the project, I really did learn to appreciate why Lua is embedded into games and Python isn't. Lua is really small and you have full control over everything. And you're eventually going to need that control when you implement features like reflection, pausing the game, etc. CPython is this big shared library that does its' own thing and you have a lot less control over. The parts where it just doesn't expose enough through its' API do do what you want is a real huge pain. I ended up writing a bunch of code to serialize all the internal data structures and this was a massive chore. Also you have a lot less control over CPython's performance and memory allocations.
I didn't really appreciate these things when I started the project so hence I went with Python. But since I ended up doing it, I guess you can still enjoy the benefits of it.
Well. Looks like I'll have to adjust my expectations. This is above and far beyond what I would dare criticize or probably could produce myself.
Teaches me to not bunch "Show HN: my npm package you should totally use in production" with "Show HN: my C passion project of 3 years".
I also don't have a problem with people submitting bad code.
I however will speak up when people submit horrible code wrapped in a npm package and there's a real risk of someone unsuspecting accidentally using it.
All comments shown.
Couldn't load more comments. Check your connection and try again.