Hacker News new | past | comments | ask | show | jobs | submit login

"GOAL never had a source-line debugger, as far as I know, although there's no reason it couldn't given some effort to write one."

Actually, it did. IIRC, the debug state required for converting run-time addresses to source lines was persisted in the compiler (which was a REPL, not a one-shot process like C), rather than exported in the form of symbols. The interface was pretty sketchy, but I'd say it was about as usable as GDB. You could set breakpoints, inspect registers, etc...

A lot of debugging was "live" though - since all the code was hot-loadable, you could just insert a debug print in the middle of a function on the fly. It was a really nice, iterative way to work.

Since the entire thing was hot-loadable, how was the game linked, did every function call go through a indirection, or did you potentially re-link the entire program if the new function couldn't fit at the address of the old one?

> did every function call go through a indirection


I wonder if that would still be an acceptable trade-off with high-performance games on modern memory architectures.

My suspicion is "yes" -- the PS2 wasn't great at memory access, and modern CPU tend to have better caching/branch prediction anyway.

No need to wonder. That is exactly how C++ vtables work.

For virtual functions. Not all calls get an indirection. At least with any respectable compiler..

Right, and how many game developers are recommending to "never use virtual functions because they are slow" in 2017? I remember seeing statements like that in Usenet posts and articles from the 1990s.

Also, "never use virtual functions" is very different than "don't use virtual functions everywhere" Common wisdom is that virtual function usage in hot loops can become problematic.

https://shaneenishry.com/blog/2014/12/27/misconceptions-of-c... is from 2014. I tend to think it might actually make a difference in this case given it's a vtable indirection for every entity every frame (or for every subsystem * every subsystem tick).

Yeah, and in C++ one also avoids vtables when possible.

Oh cool, I wondered if ND ever went to the trouble to write one or not. Thanks :)

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact