Over the years, I have noticed, two trending methods of game structure. Both methods are almost identical but the 'way' they are carried out are different... I will try to explain...
These are 'my' lables... 1. Sequential and 2. Modularised.
Sequential: Initialise and load assets; main loop consisting of; update stuff and draw stuff; screen refesh; end main loop. Followed by any exit reporting or play agian.
Modularised: Almost the same as sequential except that the update and draw stuff are divided into 'external functions' and are referenced within the main loop...
Given that processing speed has greatly improved of the decades, choosing either method may not be in issue when it comes to speed, I am curious as to everyone's opinion on the pros and cons of each system. (or if you use another system, please share)
This is all based on observation and curiosity and 'not' designed to be a 'can of worms'... lol
Honestly, from my experience, I don't really pay too much attention to code structure. I'm not a professional developer, just a hobbyist. I've been curious about how games are made since I was a kid typing out BASIC code from magazines and books.
There's 'sequential' and 'modularized' code, but there's 'unstructured' code like in vintage BASIC and also there's also OOP approach.
In Naalaa, I usually organize my games into :
- initialization (constants, variables, loading assets)
- the main loop
- functions
I also tried LOVE2D Lua a few years ago, which uses love.load(), love.update() and love.draw() structure.
I'm not sure if the different approaches actually change performance or speed...lol. But the real struggle is when I try to convert vintage BASIC to Naalaa. It's so hard to decode because of all that 'GOTO spaghetti'....lol
Personally, I usually try to keep the game loop as short as possible, mainly using it to call functions. I separate the functions into small individual tasks. I do it this way because I find it easier to check for errors if I have each task separated from the others. No idea if I lose efficiency this way, but I suspect that if I do, the impact is minimal.
(03-30-2026, 04:03 AM)1micha.elok Wrote: I also tried LOVE2D Lua a few years ago, which uses love.load(), love.update() and love.draw() structure.
I'm not sure if the different approaches actually change performance or speed...lol. But the real struggle is when I try to convert vintage BASIC to Naalaa. It's so hard to decode because of all that 'GOTO spaghetti'....lol
I kind of like the way Love2d/Lua sets up its code. That system seems to work well for small to medium games. But, once it gets a little larger or a little complex, code management can be a little tedious... Well, it is for me... lol
I have been using Basic for many, many years. I am more than familiar with the countless hours of trying to transfer magazine/book game programs to the many machines I have owned to either tape or floppy disk.
My game coding languages of choice, at the moment, are Naalaa and RCBasic, and I always try to convert one to the other. Primarily to see if I can and to compare performance. But, I agree with you about those horrible GOTO's... grrr!!! GOSUB's are not a problem. But those GOTO's are a "deal breaker". It it's not a simple GOTO, like goto end of game, then I just turn the page and "next"....
Many years ago I had and Amstrad CPC464 and started collecting the magazines.... Unfortunately it only ran for a few years before dying... Now I use emulators... Downloaded all the magazines and all the games... I had almost forgotten how slow a 4mhz machine was... Oh so slow... But still fun!