Hacker News new | ask | show | jobs
by anonzzzies 533 days ago
Long ago, I decided to embed a scheme in C++ when I was building a game (nothing AAA or fancy; just a RPG mixed with shmup I wanted to make since I was a kid); when I succeeded, I noticed I never touched the C++ again. So then wondered why I used C++ in the first place and went full for Chezscheme, which is very fast anyway and fast enough for most things. It is fun though. I found the Python case a better fit; it was (is) so slow that actually it makes sense to implement critical path code in C/++.
2 comments

I did something similar. C++ game engine with embedded Lua. I brought it to a C++ job interview. The interviewer kept asking how certain things worked. After a while I realised I was only clicking into Lua source code to show what was going on.

He said something like, "You know you can just write C++, right?"

Did not get the job :)

Hopefully the interviewer did not cut you out because of the project, because there's many valid reasons why someone would use Lua: - "no need to use C++ for non-performance critical sections of job." - "The nature of the game does not require high levels of optimizations to implement the game" - "This is just the MVP, lua lets me iterate more quickly" (totally lying, you're totally going to ship the game as is)

i.e. "why many word when few do job"

Intresting. I know of two projects from the past where people used Gambit and Chicken and couldn't recommend it, because of the garbage collection. So the games runs, bullets fly, monsters move, etc... and at some point gc kicks in and you would notice a minimal halt or lag which for games is a big NO NO. Now that you mentioned a shmup, where a lot I going on, I am wondering how you or Chez handled that?
Chez's GC is a lot more configurable, and the default is smarter, than either Gambit or Chicken. Chez has a generational garbage collector, rather than the more simple ones. It can also run in parallel mode, to prevent it being "stop the world" - it'll run in another thread instead.

Because the collections are smaller, and you can slightly offload them into another thread, it's a lot less noticeable in usage.