developing a SBASIC sort-of-game on QPC2 for fun
Posted: Sun Apr 16, 2023 9:48 pm
Greetings all,
as my QL continues to sit in a cupboard and I find more fun to play with QPC2 and SMSQ/E, I developed an alpha version of a "missile command"-type of game under QPC2.
It should adapt to various resolutions. It only uses COLOUR_QL so it can run in virtually any resolution and screen depth. For some reason 1920x1080 triggers a QPC bug that crashes the system (with FILL 1, shapes that go over the bottom of the screen probably spill into system memory and crash QPC).
The "game" isn't optimized at all, it just relies on the speed of the machine running QPC. The fun in programming it is in the game system that uses an array to animate up to 400 objects. The logic is quite common for a game loop: animate (update coordinates, check lifetime of objects, create/kill objects based on animations e.g. particles), show (just update the visuals with OVER -1), check collisions (kill objects / trigger explosions). In the absence of Classes/Structures, object parameters are stored in a integer array. Had I not coded it a bit at a time with no planning, it could have been much more optimized, e.g. the allocatio of new object is done quickly by keeping a stack-type list of unallocated object entires, but I didn't use a similar list of allocated object, hence the game loop goes through all 400 array entries at each loop, skipping the unallocated ones, and such... so please forget the style and good efficient game programming, the idea was just to have fun in creating some animations with simple 2d shapes and QL colours and stipples.
I don't even know if I'll ever finish it... last addition today was the APUS MEGABEAM (accented 'u' on the Italian keyboard, or KEYROW(1)=32)... explanations in REMark statements, for those interested.
Enjoy!
as my QL continues to sit in a cupboard and I find more fun to play with QPC2 and SMSQ/E, I developed an alpha version of a "missile command"-type of game under QPC2.
It should adapt to various resolutions. It only uses COLOUR_QL so it can run in virtually any resolution and screen depth. For some reason 1920x1080 triggers a QPC bug that crashes the system (with FILL 1, shapes that go over the bottom of the screen probably spill into system memory and crash QPC).
The "game" isn't optimized at all, it just relies on the speed of the machine running QPC. The fun in programming it is in the game system that uses an array to animate up to 400 objects. The logic is quite common for a game loop: animate (update coordinates, check lifetime of objects, create/kill objects based on animations e.g. particles), show (just update the visuals with OVER -1), check collisions (kill objects / trigger explosions). In the absence of Classes/Structures, object parameters are stored in a integer array. Had I not coded it a bit at a time with no planning, it could have been much more optimized, e.g. the allocatio of new object is done quickly by keeping a stack-type list of unallocated object entires, but I didn't use a similar list of allocated object, hence the game loop goes through all 400 array entries at each loop, skipping the unallocated ones, and such... so please forget the style and good efficient game programming, the idea was just to have fun in creating some animations with simple 2d shapes and QL colours and stipples.
I don't even know if I'll ever finish it... last addition today was the APUS MEGABEAM (accented 'u' on the Italian keyboard, or KEYROW(1)=32)... explanations in REMark statements, for those interested.
Enjoy!