Page 3 of 3

Re: Invaders Progress

Posted: Sat Jun 03, 2023 5:53 am
by DJ Sures
I agree with twenex that it’s super great! It plays really well!! I’m ultimately impressed at what you’ve achieved. Knowing the tms99, I can understand the effort it has taken you.

Interestingly, I watched a YouTube video recently on old games and an interview or something with the creator of invaders. From what I recall, the pace actually increased when the enemies are killed because there’s less sprites to draw. So the less enemies meant less cpu and therefore faster speed.

Re: Invaders Progress

Posted: Sat Jun 03, 2023 6:17 am
by twenex
DJ Sures wrote: Sat Jun 03, 2023 5:53 am From what I recall, the pace actually increased when the enemies are killed because there’s less sprites to draw. So the less enemies meant less cpu and therefore faster speed.
This sounds like a happy side effect, so why doesn't dave's invader code behave in the same manner? Is it may locking itself into fixed timing some how?
It doesn't need to speed up, it just needs less work to do and speed up because of that. :lol:

Full disclosure .. I really like space invaders. :twisted:
IMG_9545 Large.jpeg
IMG_9544 Large.jpeg

Re: Invaders Progress

Posted: Sat Jun 03, 2023 9:35 am
by productiondave
Thankyou both for your feedback.

My responses to your comments:

"the marching theme is four descending notes, yours is two and surprisingly musical"

I didn't know about this. I knew that I couldn't have a background music like I do on Tetris due to how the game constantly needs to change how the PSG is configured for noise or notes. Noise and notes over each other sounded terrible so I ended up playing either a note (marching and shooting) or noise (alien death or player death) exclusively.

The two note theme I landed on works like this:
A base note, "alien_note" is calculated like this. alien_note = 24-((max_invaders / 8) * 4);

As the game progresses and more aliens are killed, the base_note is increased so the game feels more intense. The value of the note is used in DJ's `playNoteDelay` function in NABU-LIB. He has an array of notes that define the tone frequencies to be sent to the PSG.

Do you know the marching notes and how they are "supposed" to sound? I am completely tone deaf so I just used basic maths to figure out the increasing scale. I too am happily surprised that you find it musical.

"last invader continues the march rather than run."

As DJ mentioned, I believe this was a side effect of how the original game was coded. I believe that the original developers landed on their timings and that was that. The game naturally sped up as the aliens were deleted from memory. A couple of things to note here that are different in my game.

- I don't delete the dead aliens from memory. I just change their pattern from the pattern of an alive alien to the pattern of a blank 16x8 rectangle of pixels. (2 tiles). The routine that draws the aliens draws these blanks in the right places, which overwrite the previous positions of aliens in that location. I insert a blank tile at the beginning of each row and append another to the end of each row.

This way, I don't have to blank the whole frame before drawing the aliens each time they move.

- I am timing the game on the TMS9918a Vertical Blanking signal. That's 60 FPS. I don't, obviously, draw the aliens every one of those frames, but it is the counter. The player, bombs and bullets are calculated and positioned every frame. They are the only items that are sprites. The aliens are tiles.

- I draw the tiles into a framebuffer in memory and copy the 768 tiles from memory into the video memory during the vertical blank period when it's time to move the aliens. Game speed is set to move them every 8 frames on the first level. This is decreased by 2 framed every subsequent level until min 0. I don't believe the game is playable with aliens moving every frame.

This is why the last aliens don't speed up. For me to speed them up, I will have to artificially do so. In otherwords, I would have to add MORE code to the game to simulate the original experience, not less. I don't think I want to do this.

nice that you have auto fire when holding the button!

This is just how I write games. I read the user input and if user input reports pressed at the time I read it, I act on it. With keyboard controls this can be a bit tricky depending on the keyboard and how it handles repeat keys and that sort of thing. There is a difference between how this works on Mame vs real NABU hardware for example. On a joystick it's much much simpler.

after the first stage and screen was not cleared before going back to the attract screen.

I know. This is intentional. Generally when a game goes from death back to attract screen, we have a couple of choices as game designers to make.
- We can prompt the player to exit so they have a chance to see how things went wrong. They can ponder the foolish choice they made before trying again.
- OR we can just clear the screen and draw the attract screen. The player will never be able to brag about their achievements or anylise the final frame of the game for whatever might have gone wrong for them.

These are not designed to be in an arcade, so I kind of like the idea that the player has a chance to see the event that led to their demise. In games like SNAKE for example, if you make it far enough, you want to be able to take a photo of the screen if you made it to level 8 and had a nice long tail. By not clearing the screen, I create these opportunities.

For invaders, it might not make that much sense, but it's a theme that I have carried across from Snake to Tetris and now Invaders.

mystery / ufo

This is in my list of things still to do. Same with 3 player lives.

Other comments and thoughts
CLOUD CPM D Drive is a pretty cool feature. For me developing these games in Windows Subsystem For Linux and then running them on MAME to test, I have, built into my Makefiles the commands to copy the .COM file over to the Internet Adapter\Store folder where Cloud CP/M just picks them up. But yeah - however you get the game on your 'boo is fine by me.


So what's next. Well - I need to get some UFO goodness and some lives in there. I am still wondering about the score text across the top. That font is the one that Leo shared on his github and I really like it. It renders well on the NTSC composite - although I kind of forgot what that looks like now that I am rocking the Tang Nano 9k doo-hicky.

I would also like to revisit the breaking stages of the shields. This was hacked together using a tool that DJ put on the quiver. I want there to be different tiles for when bombs hit the shields and for when player bullets hit them. I want the damage to look more like little craters being formed in the shields. I did try in an initial go-round to do this programmatically, but the Nabu is a bit too slow for that. We really cant have mini-breaks during the game so the Nabu can figure out which pixels to mask out on a shield. It's much quicker to just update the framebuffer with a different pre-generated tile pattern at that location where the projectile hit.

You will notice the "charming" collision detection on the green aliens. It's definitely quite lenient. At least if you hit you always hit. Its just that if you miss, you sometimes hit too... :-)

DJ, I'm cool with you chucking this up for a wider audience if you think it's good enough. I can always release the UFO later, I still have fun playing it even though I made it and have played it to death while coding it...

Now I don't know that I explicitly have to say this, but I do this for fun. It was never my intention to port and replicate an existing game over to the nabu. THe MSX ports do a much better job of that sort of thing than I do. I just want to write code, and I like writing game code because then other people play those games and say nice things about them. I do this for the endorphin hits. I bet, DJ, it feels good to know that I am using NABU LIB to do this work, and that your library is standing up well.

I have seen a couple of other project on here start to take advantage of NABU-LIB and I think that's great. I hope more people do stuff with it. What you have done is make the Nabu really accessible to developers. This is how a software community is created. Well done and keep supporting your library. I for one appreciate it.

To shamelessly plagiarize a line from DJ, Play like its 1984!!!

D

Re: Invaders Progress

Posted: Sat Jun 03, 2023 1:35 pm
by DJ Sures
Thanks for the kind words, Dave! I may have created the canvas but you made the art. :)

I think it is ready for wide spread if you are - I’ll put it on the
A: this evening for ya. And I’ll throw a news update out as well.

I still haven’t forgotten to add the digitized code to nabulib for you. As well as a change Brijohn did for analog paddles in Mame. If there’s time this weekend I’ll try and do those too.

Re: Invaders Progress

Posted: Sat Jun 03, 2023 7:21 pm
by twenex
I just confirmed the four notes are: Bb, Ab, G, F. They're short thumps, but they're essentially part of the Bb major scale repeating and not changing.
But here is where it gets weird: When the game is first started, the first note is Ab then G, F then back up to Bb repeating from there.

:lol:

Re: Invaders Progress

Posted: Sat Jun 03, 2023 7:24 pm
by productiondave
twenex wrote: Sat Jun 03, 2023 7:21 pm I just confirmed the four notes are: Bb, Ab, G, F. They're short thumps, but they're essentially part of the Bb major scale repeating and not changing.
Okay, I'll give it a go and see about it in a future release.

Thank you for digging this up for me.

Re: Invaders Progress

Posted: Sun Jun 04, 2023 2:48 am
by productiondave
I have updated invaders with the new notes and increased game speed as aliens get destroyed. I found a good way to do it. (I think.)

game feels pretty good now. Harder for sure.

Same links as before ( https://drive.google.com/file/d/1rCSw5n ... drive_link )

Or get the code from github.

Next I need a new way to increase difficulty as you level up. The original game started the aliens a bit closer to the ground each level. I'll work on that next.

Re: Invaders Progress

Posted: Sun Jun 04, 2023 5:12 am
by twenex
Great job! I played it through a few stages and had fun. I noticed the tank can go all the way to each end side of the screen. In the original you can just get past the left and right bases. Maybe that was to just make the game harder?

kudos to cpmdrive again for making it a breeze to appear on the NABU so quickly.

Re: Invaders Progress

Posted: Sun Jun 04, 2023 6:22 am
by productiondave
Thanks again for testing.

I might have to create some space below the tank to show lives left. Or can make the whole play area narrower and use the left and right side somehow. The original was in portrait mode which meant more space vertically than I have on the nabu.

Re: Invaders Progress

Posted: Sun Jun 18, 2023 6:39 am
by productiondave
I have completed the work on invaders now. I will issue a new post announcing the release.

To close off the stand-up the final features completed are:

- 3 player lives with player lives indicated on the top right of the screen. When starting after death, the ship will flash briefly before carrying on from where you left off.
- You get 1 extra life when you pass 1500 points. No more after that.
- Level up will start a new level where the aliens are a bit closer to the ground each new level.
- UFO spawns for the first time after 22 bullets have been fired and then every 16 bullets thereafter. Scoring is based on which bullet out 16 hits the UFO. This isn't aligned exactly with the original game, but it's close enough.

Thanks!