[Homebrew] My first game... yet another Snake!

Discussion of programming and development for the original Game Boy and Game Boy Color.
User avatar
Yvar de Goffau
Posts: 11
Joined: Mon Dec 04, 2017 3:57 am
Location: Saint-Beat, Haute Garonne, France

[Homebrew] My first game... yet another Snake!

Post by Yvar de Goffau »

Hello folks,

After some time programming on the Atari VCS I decided to give it a go at programming for the device I spend my whole childhood on... the gameboy.

I looked around and I couldn't find any decent implementation of Snake (by decent I mean fast, nice grafix, with multiple levels, and fun).
For my own madness, I decided the snake had to be fully 60hz animated too.

Image

After what was roughly 1 week of hacking around + 1 week of fixing things, here is then my implementation of the classic Snake (or more close to a more recent Snake, say Snake 2 or something)

Also included in the package are the 2 python programs I used to parse grafix... ugly but useful!

In afterthought, I think I should have done some things otherwise... but the result is fun anyway.
Everything is done by myself, this includes the grafix and the little background music.

I hope you like it, and I would welcome suggestions and improvements (although I won't have a lot of time this week)
Attachments
snake.gb
The game itself (latest version)
(32 KiB) Downloaded 1020 times
snake.zip
The source code, program data, and programmes used to generate it (latest version)
(76.29 KiB) Downloaded 637 times
Last edited by Yvar de Goffau on Tue Dec 19, 2017 10:05 am, edited 8 times in total.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: [Homebrew] My first game... yet another Snake!

Post by FrankenGraphics »

Congratulations! Well done, i love the fluid animation. :beer:


Some thoughts on possible changes:

-Maybe add a unique "egg in belly" tile for when it was swallowed right in a 90 degree turn?
-The music is a good start, but gets grating after a short while since the loop is so short.
-When the snake has gotten very long, if you die, it takes quite a while for the retry message to appear
-Maybe a countdown on eggs until next level rather than amount of eggs swallowed would be more informative + slightly nerve wracking. Especially with that delay between swallowing and being extended.
-Maybe introduce the "cherry" to vary gameplay. The exact mechanics are up to you, but it could disappear after some timer runs out or if you take the egg first. Normally, a cherry would grant points, but there are no points except a record on how long you got the snake. It could count towards that score/goal without elongating the snake? Sounds like a suitable reward for risking your life for a time-limited bonus.
-Maybe one of the action buttons could speed up the snake a bit? (use at own risk).
Alyosha_TAS
Posts: 173
Joined: Wed Jun 15, 2016 11:49 am

Re: [Homebrew] My first game... yet another Snake!

Post by Alyosha_TAS »

The nintendo logo scrolling off the bottom of the screen was a clever touch :)

When the snake goes off the top of the screen the last tail section glitches out. It looks like it's getting flipped before scrolling off. I also agree that the music is a bit harsh sounding.

Impressive for only a couple weeks of work!
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: [Homebrew] My first game... yet another Snake!

Post by tepples »

Alyosha_TAS wrote:The nintendo logo scrolling off the bottom of the screen was a clever touch :)
I first saw this in Wordtris.

Another approach, especially for a larger project intended for a cartridge, is to fade a couple lines of text onto the logo for a couple seconds while your game is setting various things up.
tmss_exploit.png
tmss_exploit.png (475 Bytes) Viewed 17450 times
I've done something similar with Genesis TMSS (source: Tweet).
md_tmss_exploit.jpg
In each case, the BIOS notice displays for a couple seconds, and then your notice displays for a couple seconds after that.
User avatar
Yvar de Goffau
Posts: 11
Joined: Mon Dec 04, 2017 3:57 am
Location: Saint-Beat, Haute Garonne, France

Re: [Homebrew] My first game... yet another Snake!

Post by Yvar de Goffau »

Thank you all for your feedback!


In no particular order:
The nintendo logo scrolling off the bottom of the screen was a clever touch
--- Haha :D ... that was what I thought too. I did spend my whole childhood watching that far too slow logo fade away, so it was totally worth it! :twisted:

When the snake goes off the top of the screen the last tail section glitches out. It looks like it's getting flipped before scrolling off.
--- Oups... I completly forgot to fix that one! Yes, I had noticed it earlier, and I know what's wrong, so I will have a look at it as soon as possible.

Maybe add a unique "egg in belly" tile for when it was swallowed right in a 90 degree turn?
--- The lack of that is also a source of another little bug, in that the tail sprite glitches when digesting that kind of corner-eggs. I already had a look, but my collision code is messy and I need to rewrite it first

The music gets grating after a short while since the loop is so short.
--- So true... I wish I was better with sounds but I'm not a real chiptune artist. But I will work on it. Only disabling/enabling one of the channels already does magic!

Maybe a countdown on eggs until next level rather than amount of eggs swallowed would be more informative + slightly nerve wracking. Especially with that delay between swallowing and being extended.
--- The HUD might not be clear enough. Left is the number of eggs swallowed (actually the number of eggs digested, but that will change very soon). In the middle is the timer, not used yet, and in the right is the highscore for the current level (in eggs swallowed). By the way, have you tried pressing A/B/Select/Start on retry to switch levels? :roll:

Maybe one of the action buttons could speed up the snake a bit?
--- I even thought about speeding up the game after some time, to put more stress on the player to get their eggs early. For those to work, I have to craft an variable timer, which is easy enough (just take the high nibble instead of the low nibble as a time index) but I didn't yet find time to implement it

Maybe introduce the "cherry" to vary gameplay.
--- I love that idea! But pfft... first some more bugs/features to fix!

When the snake has gotten very long, if you die, it takes quite a while for the retry message to appear
--- You have been playing too long... get a pause! :D Well, I will speed it up a bit as soon as I have the function for...
User avatar
Yvar de Goffau
Posts: 11
Joined: Mon Dec 04, 2017 3:57 am
Location: Saint-Beat, Haute Garonne, France

Re: [Homebrew] My first game... yet another Snake!

Post by Yvar de Goffau »

Version 0.2A!

Fantastic how adding a little countdown quickening-up the game can work on peoples nerves! :twisted:
Now find the time to add 90 degrees egg in belly, better music, and maybe some cherries and we're good to go! :D
Attachments
snake.zip
Version 0.2A of the source
(84.95 KiB) Downloaded 538 times
snake.gb
Version 0.2A of the game
(32 KiB) Downloaded 546 times
User avatar
Yvar de Goffau
Posts: 11
Joined: Mon Dec 04, 2017 3:57 am
Location: Saint-Beat, Haute Garonne, France

Re: [Homebrew] My first game... yet another Snake!

Post by Yvar de Goffau »

Didn't have much time this week, but here is a version 0.2B...

What have changed:
- Fixed the tail cornering bug
- Added 90 degrees egg-in-belly grafix
- Improved a little the music :?

:D Please keep on sending feedback :D
:beer: ... and if you like it, why not share it? :beer:
Attachments
snake.gb
The game
(32 KiB) Downloaded 540 times
snake.zip
The source
(71.94 KiB) Downloaded 534 times
Alyosha_TAS
Posts: 173
Joined: Wed Jun 15, 2016 11:49 am

Re: [Homebrew] My first game... yet another Snake!

Post by Alyosha_TAS »

much more fun to play now with the softer toned music.

I think it could us some more animations though, like one for eating the egg, or the snakes belly segments expeanding as he swallows it.
User avatar
Yvar de Goffau
Posts: 11
Joined: Mon Dec 04, 2017 3:57 am
Location: Saint-Beat, Haute Garonne, France

Re: [Homebrew] My first game... yet another Snake!

Post by Yvar de Goffau »

I gonna have a look... but it is not easy. The head and tails are (for technical reasons) movable shapes, and I'm a bit short of OAM shapes!

Image

However, running my shape deduplicator on it, with detection of mirror and flip, shows that 36 of the 256 shapes are (indirectly) duplicates...

Image

So as soon as I have those deduplicated, I can start to add more animation...
To be more specific, I can add 1 animation sequence for 4 directions (32 shapes i.e. 8 steps * 4 directions), and then I keep 4 movable shapes for things like cherries, baskets, ect...

So what do you prefer? An sequence where the snake's head opens its mouth to eat an egg? Or maybe something else?
User avatar
Yvar de Goffau
Posts: 11
Joined: Mon Dec 04, 2017 3:57 am
Location: Saint-Beat, Haute Garonne, France

Re: [Homebrew] My first game... yet another Snake!

Post by Yvar de Goffau »

Small update! (version 0.2C, I think)

I added an bonus called The Basket. It appears somewhere between difficulty level 4 and 7, and if you tumble it, it will make eggs scatter the screen. :mrgreen: Of course, only one is the real egg, but the others are delicious too! :P

I worked on the extra animations, I even found space to squeeze in both head eating and segment expanding frames, but they are not finished yet. That will be for a next update!
Attachments
snake.gb
For the gamers ;-)
(32 KiB) Downloaded 546 times
snake.zip
For the hackers >:-}
(75.43 KiB) Downloaded 529 times
User avatar
Yvar de Goffau
Posts: 11
Joined: Mon Dec 04, 2017 3:57 am
Location: Saint-Beat, Haute Garonne, France

Re: [Homebrew] My first game... yet another Snake!

Post by Yvar de Goffau »

New version...

Not much did change, but I added a cherry, which gives 5 points.
Also, I did put in the animations. As it turned out, the game goes too fast for them to be any good :shock:
(specially on my ultra-blurry gbpocket :lol: ), but the one with the eating head also appears when you eat yourself, and is just too much fun to not use :D .

I won't have a lot of time after this week to code, so please send in your last suggestions before it is too late. :beer:
I have an idea for a next gameboy game, but that will be for after the holidays...

By the way, what website do you recommend to publish this game on? I don't know anything about that kind of jobs... :(
Attachments
snake.gb
The game itself
(32 KiB) Downloaded 554 times
snake.zip
The source and stuff (as usual)
(76.29 KiB) Downloaded 531 times
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: [Homebrew] My first game... yet another Snake!

Post by calima »

itch.io is good for building a portfolio.
Alyosha_TAS
Posts: 173
Joined: Wed Jun 15, 2016 11:49 am

Re: [Homebrew] My first game... yet another Snake!

Post by Alyosha_TAS »

Yvar de Goffau wrote:New version...

Not much did change, but I added a cherry, which gives 5 points.
Also, I did put in the animations. As it turned out, the game goes too fast for them to be any good :shock:
(specially on my ultra-blurry gbpocket :lol: ), but the one with the eating head also appears when you eat yourself, and is just too much fun to not use :D .

I won't have a lot of time after this week to code, so please send in your last suggestions before it is too late. :beer:
I have an idea for a next gameboy game, but that will be for after the holidays...

By the way, what website do you recommend to publish this game on? I don't know anything about that kind of jobs... :(
I noticed a glitch in my emulator's audio code due to this game, so thanks for that!

my only point of criticism is that the eggs appearing over the snake after they are eaten looks a bit sloppy. Other then that pretty cool. :D
User avatar
DevEd
Posts: 48
Joined: Thu Dec 12, 2013 4:00 pm

Re: [Homebrew] My first game... yet another Snake!

Post by DevEd »

Pretty cool, although the sound could use a bit of work. It sounds really basic to me.

On that note, here's a test to see if I could get DevSound (my own Game Boy music system) to work in your game. I mostly succeeded, although there are a few issues. First of all, DevSound expects to have full control over the sound chip, so it ends up corrupting the sound effects. Secondly, the music no longer increases in speed when the game does. Deliberately slowing down the call rate for music playback (which is what your sound code did) is not sufficient as DevSound needs to be called on every frame in order for the music to sound correct. Finally, the music constantly pauses. I tried to fix the latter issue, but I wasn't able to due to not wanting to spend too much time.

By the way, I noticed that you're following your halts with nops. This isn't necessary; the assembler will automatically insert a nop after each halt opcode.
Attachments
snake+devsound.zip
(128.63 KiB) Downloaded 529 times
snake.gb
(64 KiB) Downloaded 537 times
Last edited by DevEd on Fri Jan 05, 2018 4:16 pm, edited 1 time in total.
You know, the DevSound guy.

There are two kinds of people in this world: those who are convinced there are two kinds of people in this world, and those who aren't. - Unknown
User avatar
Yvar de Goffau
Posts: 11
Joined: Mon Dec 04, 2017 3:57 am
Location: Saint-Beat, Haute Garonne, France

Re: [Homebrew] My first game... yet another Snake!

Post by Yvar de Goffau »

Nice tune!
I first thought a simple game wouldn't be very demanding on the matter of sound, but indeed that is pretty cool :beer: .

To make the sound effects work, one simple solution would be to simply disable channel 4 in the music engine since all sound effects are made to work with channel 4. The sound effects are very plain ones, with no real code behind, but I don't know how the SFX works in your music engine. I will try to set up 1 unified sound effect trigger routine once I get home, that would make things a bit easier.

For the speedup, [v_speed] contains the current speed of the game; if I would know where the current song speed is stored I would be able to just modify that... or how does DevSound store the rythm speed of the tune? Can you invoque for example [$89 - SetSpeed] from within the game code?

By the way, is it an idea to make 8 different tunes for the 8 maps :D ? I have no real talent for music so I didn't get past 1 boring old loop... :roll:


(edit) By the way, why did you remove the halt in the waitKey routine? Did that cause problems with the music engine? If it is the emulator that hangs (which happened to one of my emulators) than you can use the waitKeyOld routine...
Post Reply