Invaders Progress
Re: Invaders Progress
Do you have any cost savings by using a pointer instead of the array reference? In some cases I find z88 is much happier with a pointer. I did the LST between builds for comparison. Although just seeing the file size decrease is a good telltale
- productiondave
- Posts: 117
- Joined: Tue Mar 28, 2023 10:01 pm
Re: Invaders Progress
I don't know for sure. For now I am keeping the code as simple as I can. the idea is to get it working and then look at performance after.
I have an array of structs that let me track each invader's location in the tile space as well as the location in pixel space. The pixel space is so that I can know which tiles to display at any given point along the x axis and the tile space is for a quick lookup if I need it. I know I can infer the tile from the pixel, but I would rather do that once and then look it up the multiple times I need it. I think this is faster than doing the math each time.
The compiler appears to use pointers to manage this access and it's quite liberal with it's use of the IX register. This was one of the reasons I was moving away from C to begin with. However, I don't think it's making much material difference. I might not be getting 60 FPS, but I don't need to.
TO answer my own question about the compiler using AND to do a MOD...
This little program is the simplest I could come up with to see how it handles the modulus.
and here is the relevant part of the listing.
I have an array of structs that let me track each invader's location in the tile space as well as the location in pixel space. The pixel space is so that I can know which tiles to display at any given point along the x axis and the tile space is for a quick lookup if I need it. I know I can infer the tile from the pixel, but I would rather do that once and then look it up the multiple times I need it. I think this is faster than doing the math each time.
The compiler appears to use pointers to manage this access and it's quite liberal with it's use of the IX register. This was one of the reasons I was moving away from C to begin with. However, I don't think it's making much material difference. I might not be getting 60 FPS, but I don't need to.
TO answer my own question about the compiler using AND to do a MOD...
This little program is the simplest I could come up with to see how it handles the modulus.
Code: Select all
#include <stdio.h>
int main(void) {
for (uint8_t i = 0; i < 20; i ++) {
uint8_t ox = i % 8;
printf("%d\n", ox);
}
return 0;
}
Code: Select all
384 _main:
385 0000 0e00 ld c,0x00
386 l_main_00103:
387 0002 79 ld a,c
388 0003 fe14 cp a,0x14
389 0005 3014 jr NC,l_main_00101
390 0007 e607 and a,0x07
391 0009 1600 ld d,0x00
392 000b c5 push bc
393 000c 5f ld e, a
394 000d d5 push de
395 000e 210000 ld hl,___str_0
396 0011 e5 push hl
397 0012 cd0000 call _printf
398 0015 f1 pop af
399 0016 f1 pop af
400 0017 c1 pop bc
401 0018 0c inc c
402 0019 18e7 jr l_main_00103
403 l_main_00101:
404 001b 210000 ld hl,0x0000
405 001e c9 ret
Rock On!
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
Re: Invaders Progress
Do you notice printf with z88 sometimes has strange output? I find that happens but I haven’t raised an issue with their forum yet. I haven’t done enough tests to understand why it’s happening.
- productiondave
- Posts: 117
- Joined: Tue Mar 28, 2023 10:01 pm
Re: Invaders Progress
I haven't noticed. I don't use it too much. Typically I'm writing text to the framebuffer these days. Score and lives etc
Rock On!
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
- productiondave
- Posts: 117
- Joined: Tue Mar 28, 2023 10:01 pm
Re: Invaders Progress
Daily stand-up
Forcing myself to take a couple nights off. Development will resume in a few days.
DONE:
Forcing myself to take a couple nights off. Development will resume in a few days.
DONE:
- animate aliens back and forth across the screen until at least one alien hits the edge of the screen before changing direction and dropping down 1 tile row.. (This took me a long time to figure out.)
- draw shields on the screen
- controllable player cannon
- bullets (player shooting) - shoot event, bullet animation, clear bullet logic when bullet hits an invader or flies off the top of the screen.
- detect bullets colliding with aliens - Tile level collision only.
- implement game-over detection (player has defeated all the aliens)
- implement shield damage from player bullets
- implement shield defense and damage from alien bombs
- let aliens drop bombs - all code as per bullets but going down and with a different sprite pattern and colour.
- alien death animation / explosion
- detect collision between bomb sprites and player sprite (player dies)
- implement 3 lives system
- implement scoring system and score display text
- implement ufo
- sound effects
- game music
- implement start menu - including ability to play again etc.
- implement high score system.
- implement game levels. Options include increased number of alien bombs at once, faster aliens etc.
Rock On!
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
- productiondave
- Posts: 117
- Joined: Tue Mar 28, 2023 10:01 pm
Re: Invaders Progress
Daily stand-up
I am ready for people to start having a go. I don't seem to be able to upload COM files here. So here is a link to a compiled com file that will work on Cloud CPM.
I have also committed the latest code to the invaders branch on the nabu-games github. https://github.com/linuxplayground/nabu ... e/invaders
And my progress is below. Audio is a bit of a challenge with only the one PSG. So no game music yet.
DONE:
I am ready for people to start having a go. I don't seem to be able to upload COM files here. So here is a link to a compiled com file that will work on Cloud CPM.
I have also committed the latest code to the invaders branch on the nabu-games github. https://github.com/linuxplayground/nabu ... e/invaders
And my progress is below. Audio is a bit of a challenge with only the one PSG. So no game music yet.
DONE:
- animate aliens back and forth across the screen until at least one alien hits the edge of the screen before changing direction and dropping down 1 tile row.. (This took me a long time to figure out.)
- draw shields on the screen
- controllable player cannon
- bullets (player shooting) - shoot event, bullet animation, clear bullet logic when bullet hits an invader or flies off the top of the screen.
- detect bullets colliding with aliens - Tile level collision only.
- implement game-over detection (player has defeated all the aliens)
- implement shield damage from player bullets
- implement shield defense and damage from alien bombs
- let aliens drop bombs - all code as per bullets but going down and with a different sprite pattern and colour.
- alien death animation / explosion
- detect collision between bomb sprites and player sprite (player dies)
- implement scoring system and score display text
- sound effects
- implement start menu - including ability to play again etc.
- implement high score system.
- implement game levels. (invaders move a bit faster each time you clear them all out.)
- implement 3 lives system
- implement ufo
- game music
Rock On!
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
- productiondave
- Posts: 117
- Joined: Tue Mar 28, 2023 10:01 pm
Re: Invaders Progress
Did anyone try it yet?
Rock On!
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
Re: Invaders Progress
I’ll give it a go tonight stay tuned!
- productiondave
- Posts: 117
- Joined: Tue Mar 28, 2023 10:01 pm
Re: Invaders Progress
Cool - I updated it in my google share : https://drive.google.com/file/d/1rCSw5 ... drive_link The code is up to date on the dev branch on my github.
Changes since the last upload is the shooting sound is no longer a pew and more like a beep. I found the audio was tricky to get right with different envelopes competing for resources on the single PSG. If only we had 2 AYs. Or even 4!
Changes since the last upload is the shooting sound is no longer a pew and more like a beep. I found the audio was tricky to get right with different envelopes competing for resources on the single PSG. If only we had 2 AYs. Or even 4!
Rock On!
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
Re: Invaders Progress
Wow, great beta test. Space Invaders is one of my favs. Some comments but you probably
already know.
* the marching theme is four descending notes, yours is two and surprisingly musical
* last invader continues the march rather than run.
* nice that you have auto fire when holding the button!
* after the first stage and screen was not cleared before going back to the attract screen.
* mystery / ufo
I used DJ's CloudCPM D drive (amazing!) top make it available to my NABU.
I'm astonished at how awesome CloudCPM is. NABU wants more users.
already know.
* the marching theme is four descending notes, yours is two and surprisingly musical
* last invader continues the march rather than run.
* nice that you have auto fire when holding the button!
* after the first stage and screen was not cleared before going back to the attract screen.
* mystery / ufo
I used DJ's CloudCPM D drive (amazing!) top make it available to my NABU.
I'm astonished at how awesome CloudCPM is. NABU wants more users.