smugdev
1.3K posts

smugdev
@smug_dev
Professional #gamedev by day, Aspiring #indiedev by night. Programmer for @UnWarGame Interested in just about everything development related and games










@anicic_filip @BOENSAW My game code has evolved toward "iterate over all entities of type X, do Y on them, at the place in the code where this needs to happen". The entity does not own the function, the game engine owns the function.

Once I saw a project where everything was entities with a .tick(), plus a gigantic priority table intended to orchestrate the mess. Because reasoning the flow was still too hard, developers had added yield() for_rand_number_of_frames everywhere, "to give other entities some time to run their tick()s". Naturally all actions took multiple frames to execute, and they still had flow/synch bugs everywhere anyways. I advised them to burn thing down and move on to just an app loop with { do_thing_A(); do_thing_B(); ... do_thing_Z(); }. But they didn't. The project failed a year after under the weight of its own spaghetti design. You could say the problem was that particular team of coders, not the design per-se. But, I mean, I've seen this story repeat with different teams repeat 3 or 4 times by now...



















