Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - [Coding competition 2015] Gaudream by DanySnowman, Davidian, Kusfo

Reply to topic Goto page 1, 2  Next

Rate this entry!

1 (Poor) 4% 4%
2 0% 0%
3 4% 4%
4 4% 4%
5 23% 23%
6 19% 19%
7 28% 28%
8 14% 14%
9 (Excellent) 0% 0%
This poll has expired.
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
[Coding competition 2015] Gaudream by DanySnowman, Davidian, Kusfo
Post Posted: Fri Mar 27, 2015 5:54 am
Last edited by Maxim on Fri Mar 27, 2015 11:03 pm; edited 1 time in total
http://www.smspower.org/Homebrew/Gaudream-SMS

Quote
Here there's a very preliminar version of a Flappy Bird Clone, called Gaudream. Some bugs have prevented to put the main obstacles on the rom (but we'll release new rom as soon as the bugs are solved).

Gaudream has been developed by DanySnowman (Graphics), Davidian (Sound) and me, Kusfo (Code), using the wonderful devkitSMS by sverx.

After some cleaning, I also plan to release the source code.

Enjoy!
  View user's profile Send private message Visit poster's website
  • Joined: 31 Oct 2007
  • Posts: 853
  • Location: Estonia, Rapla city
Reply with quote
Post Posted: Fri Mar 27, 2015 10:47 pm
I really like the music here ~
  View user's profile Send private message Visit poster's website
  • Joined: 08 Oct 2012
  • Posts: 108
  • Location: Colmar PA, United States
Reply with quote
Post Posted: Sat Mar 28, 2015 12:22 am
Does anyone else hear a note get stuck after you die?
  View user's profile Send private message
  • Joined: 31 Oct 2007
  • Posts: 853
  • Location: Estonia, Rapla city
Reply with quote
Post Posted: Sat Mar 28, 2015 12:28 am
I noticed that too.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sat Mar 28, 2015 11:27 am
Working to solve some problems, as we get over the 48k (when we inserted the obstacles), i've been using banking, but the rom gets stucked. Trying to get it solved today.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sat Mar 28, 2015 11:56 am
I could suggest you to move all the assets for the intro in a separate bank, since you're going to load them just at game start.
Also, if you need to load compressed tiles, I can try wrapping the PSGaiden asm code in a SMSlib C function.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sat Mar 28, 2015 12:08 pm
i'm using 5 banks now, because the main screen takes almost 23kb, and also the gameover screen.

However now the game is doing starnge thinks, i suppose that's because the code goes past the first 32k.... :-S
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sat Mar 28, 2015 12:28 pm
*code* should be under 32KB, as the additional banks will be paged in (in slot 2) by the
SMS_mapROMBank(n)
macro.
Check if -by mistake- some assets are still allocated into 'code' space.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sat Mar 28, 2015 12:35 pm
I think it "should" be in the first 32kb , cause its only 1.000 lines of code (with plenty of spaces )
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sat Mar 28, 2015 12:40 pm
check the generated .map file for the code area:

Area                                    Addr        Size        Decimal Bytes (Attributes)
--------------------------------        ----        ----        ------- ----- ------------
_CODE                               00000200    000075E8 =       30184. bytes (REL,CON)


under that it's the list of globals in the area, you should see there only SMSlib and your own functions.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sat Mar 28, 2015 12:57 pm
It looks ok:
Area Addr Size Decimal Bytes (Attributes)
-------------------------------- ---- ---- ------- ----- ------------
_CODE 00000200 000031DD = 12765. bytes (REL,CON)

So, maybe the problem relays in that i'm looking for some data that's it's not mapped now ¿?
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Sat Mar 28, 2015 1:01 pm
Title graphics and music are really good. There's not much of a game yet tho? Bring on the obstacles:) I wish the jump would react on pressing the button instead of releasing them, I often miss a jump because of that. At some point I get used to holding the button earlier in order to release just in case but it adds an extra bit of management and I still miss it sometimes.

We visited Park Güell in Barcelona last year, and couldn't find the Gaudi lizard in time and that kept haunting us. It's back haunting us now!
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sat Mar 28, 2015 1:04 pm
That's possible, even if I would expect a different outcome. I mean, if you load some KBs worth of tile data into VRAM and you have not mapped the correct bank I wouldn't expect the program to crash, simply you would find meaningless data in your VRAM...

I would check anyway if you've got a call of
SMS_mapROMBank(n)

before each 'group' of load tiles/tilemaps/palettes from additional banks...

Also keep in mind that SDCC still has some bugs :|
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sat Mar 28, 2015 1:05 pm
Bock wrote
We visited Park Güell in Barcelona last year, and couldn't find the Gaudi lizard in time and that kept haunting us. It's back haunting us now!


Didn't you enter from the door? ;)
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sat Mar 28, 2015 1:06 pm
Bock wrote
Title graphics and music are really good. There's not much of a game yet tho? Bring on the obstacles:) I wish the jump would react on pressing the button instead of releasing them, I often miss a jump because of that. At some point I get used to holding the button earlier in order to release just in case but it adds an extra bit of management and I still miss it sometimes.

We visited Park Güell in Barcelona last year, and couldn't find the Gaudi lizard in time and that kept haunting us. It's back haunting us now!


I have the obstacles programed and ready...but now the rom is crashing when the game begins...

I'm still trying to see the problem.
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Sat Mar 28, 2015 1:20 pm
Cool. Let's see that we can update entries this week! But some people may vote early and/or forget to change their vote or hold a grudge on you for late update ;)

(We must have missed the lizard.. what door, maybe there's several of them? We were a bit in a rush and it was boiling outside)
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sat Mar 28, 2015 1:27 pm
Bock wrote
what door, maybe there's several of them?

Yes, there are few ways to get in. I was kidding. Anyway usually people enter from the 'entrance', where the two small houses are. From there, you can't miss the lizard.
  View user's profile Send private message Visit poster's website
  • Joined: 08 Nov 2014
  • Posts: 92
Reply with quote
Post Posted: Sat Mar 28, 2015 2:41 pm
Nice graphics, music and effects you can see the benefit of a team effort here.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sun Mar 29, 2015 6:14 pm
kusfo wrote
I have the obstacles programed and ready...but now the rom is crashing when the game begins.


Seems a linkage problem. Try compiling each C file separately and linking .rel files together with a last sdcc call. Remember to place the additional banks at the end

sdcc -mz80 --std-sdcc99 --data-loc 0xC000 -Wl-b_BANK2=0x8000 -Wl-b_BANK3=0x8000 -Wl-b_BANK4=0x8000 main.rel someother.rel SMSlib.rel bank2.rel bank3.rel bank4.rel


edit: also check ihx2sms output, if it says the expected size (32KB+16KB per additional bank)
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sun Mar 29, 2015 9:33 pm
I've been playing with that for two days...and now all is full of chaotic bugs...

First of all, this is my build.bat (no mistery here)
@echo off
echo Build bank2.c from bank2 folder
folder2c bank2 bank2
sdcc -c -mz80 --std-sdcc99  --peep-file peep-rules.txt --constseg BANK2 bank2.c
echo Build bank3.c from bank3 folder
folder2c bank3 bank3
sdcc -c -mz80 --std-sdcc99  --peep-file peep-rules.txt --constseg BANK3 bank3.c
echo Build bank4.c from bank4 folder
folder2c bank4 bank4
sdcc -c -mz80 --std-sdcc99  --peep-file peep-rules.txt --constseg BANK4 bank4.c
echo Build bank5.c from bank5 folder
folder2c bank5 bank5
sdcc -c -mz80 --std-sdcc99  --peep-file peep-rules.txt --constseg BANK5 bank5.c
echo Build bank6.c from bank6 folder
folder2c bank6 bank6
sdcc -c -mz80 --std-sdcc99  --peep-file peep-rules.txt --constseg BANK6 bank6.c
echo Build data.c from data folder
folder2c data data
sdcc -c -mz80 --std-sdcc99  --peep-file peep-rules.txt data.c
echo Build Main
sdcc -mz80 --std-sdcc99   --peep-file peep-rules.txt --data-loc 0xC000 -Wl-b_BANK2=0x8000 -Wl-b_BANK3=0x8000 -Wl-b_BANK4=0x8000 -Wl-b_BANK5=0x8000 -Wl-b_BANK6=0x8000  main.c .\SMSlib.rel .\PSGlib.rel .\data.rel .\bank2.rel .\bank3.rel .\bank4.rel .\bank5.rel .\bank6.rel
ihx2sms main.ihx gaudream.sms


The total size of the rom is 112 k (5 banks x 16kb + 32kb). All ok here.


So, what's happening now? In a lot of places, the game crashes and makes a reset. At the begining i thought that the gameover flag was set in a wrong place, but commenting all the main loop doesn't solve the problem.

So, i started commenting pieces of code.And i found something strange:
// that line works flawlesly
if(currentFrame % 16 == 0)
      playerinfo.verticalVelocity = playerinfo.verticalVelocity + 1;
//that line makes the rom crash
if(currentFrame % 20 == 0)
      playerinfo.verticalVelocity = playerinfo.verticalVelocity + 1;


Why? when the compiler translates a %16 operation, it becomes a logic AND with the value 15. But modulus 20 gets translated to
call   __moduint_rrx_s


Then, i found that other places that made the game crash where code get translated to calls to the SDCC libraries.

Maybe SDCC internal libraries are stored past the first 32kb?

I'm attaching my working directory, that's a bit of a mess now :-S
Gaudream.zip (711.22 KB)

  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Sun Mar 29, 2015 9:45 pm
16 is a power of two so % 16 can be expressed with and mask but not 20. So what the compiler does is correct.
An actual divide/remainder operation is likely to be really really expensive. You can't do this sort of thing on a Z80 (well, you can but it's not like you can afford wasting lots of cycles :). Instead of doing % 20 you are better off incrementing a counter, testing when it's == 20 and then resetting the counter.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sun Mar 29, 2015 9:50 pm
Yeah, i know, but it's not really important because i use that only one time every 16 frames

Now i've translated all the modulus by logic ANDS, but i still have lots of problems (every time a SDCC call is performed). And that didn't happened before using bank switching.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sun Mar 29, 2015 9:54 pm
It all makes sense: the linker is putting SDCC library functions AFTER the banks. So try compiling main.c the same way you do with data.c, so to generate a main.rel.
Then link main.rel with all the other .rel files on the next sdcc call.
I hope this would make things work correctly.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sun Mar 29, 2015 10:35 pm
that's it!

Now i need to repair some thing's i've been doing, but it looks promisizing!
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Mar 30, 2015 7:23 am
Wonderful! :)
(this bug haunted my dreams this night. I woke up at 5:05 thinking that I might have a bug in ihx2sms... I'm so happy you fixed that!)
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Mon Mar 30, 2015 7:38 am
Well, maybe i talked too soon. Changing the build.bat solved some problems (music returned, the random generator, etc), but it looks like something is still not right (i get some crashes again when pressing butons)

I've put these line at the end of the build, intending only to do the linkage step:
echo Build Main
sdcc -c -mz80 --std-sdcc99  --peep-file peep-rules.txt main.c
echo Link Everything
sdcc -mz80 --std-sdcc99   --peep-file peep-rules.txt --data-loc 0xC000 -Wl-b_BANK2=0x8000 -Wl-b_BANK3=0x8000 -Wl-b_BANK4=0x8000 -Wl-b_BANK5=0x8000 -Wl-b_BANK6=0x8000  .\main.rel .\SMSlib.rel .\PSGlib.rel .\data.rel .\bank2.rel .\bank3.rel .\bank4.rel .\bank5.rel .\bank6.rel
ihx2sms main.ihx gaudream.sms


Maybe it's not enough to define the data-loc, and including the main.rel? I was looking if there's some command only for the linkage step, but it looks like that line should be enough...
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Mar 30, 2015 7:55 am
Wanna know? The bug in ihx2sms I dreamt this night was really there!!!
Please download the updated ihx2sms tool I uploaded one minute ago...
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Mon Mar 30, 2015 8:13 am
oh!

I'll try this afternoon!
  View user's profile Send private message
  • Joined: 01 Feb 2014
  • Posts: 844
Reply with quote
Post Posted: Mon Mar 30, 2015 8:50 am
Really nice music and good gfx, too. The game itself is a little hard for me. I'm really no good at Flappy Bird style games.
  View user's profile Send private message
  • Joined: 23 Mar 2013
  • Posts: 611
  • Location: Copenhagen, Denmark
Reply with quote
Post Posted: Mon Mar 30, 2015 11:50 am
I really like the sound and graphics here. Nice Flappy Bird twist with the underwater setting, even though I'm pretty sure I'm missing out on some of the context (is this game about a 'real' fish?, what is going on with the zoo discussed above?...). Edit: The Gaudi Lizard??

I second the suggestion about switching from button release to button press when you need to splash upwards.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Mar 30, 2015 5:32 pm
News?
I feel a little disappointed for the bugs I left in the devkit code/tools... I probably should have stated that it's very "bleeding edge", I am unsure myself if it'll be ever safe enough to use it :|
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Mon Mar 30, 2015 6:15 pm
Still, same problems.

I'll try to found if something is not ok. I'm attaching the map file, just in case...

And i'm very happy to use the devKit, it's a wonderful step forward in homebrew development for Master System!.
main.map.zip (4.11 KB)

  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Mar 30, 2015 6:34 pm
This map file seems correct, I can't see anything wrong there.
Also, if I take the main.ihx from the zip you posted earlier and I pass it into the *FIXED* ihx2sms I obtain a ROM I can start...
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Mon Mar 30, 2015 6:39 pm
try with that rom to touch the ceiling or the floor. If there's the dead animation, it's working, otherwise, it crashes and reboots.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Mar 30, 2015 6:43 pm
There's the death animation, the gameover screen appears (even if wrong) but no crash (in Meka). Try the same you too.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Mon Mar 30, 2015 6:59 pm
I'm not able to have it working, it's specially awful now...

i'm attaching the main.ihx, the ihx2sms and my output rom...Maybe your ihx2sms it's diferent from the one in github?
Gaudream-test.zip (89.02 KB)

  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Mar 30, 2015 7:06 pm
where/when do you get that ihx2sms? it's not the one I updated this morning on github... please update that ASAP!
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Mon Mar 30, 2015 7:22 pm
Just updated the repository this afternoon.....and as i suspected that something was not ok, i downloaded the zip file...

And now it's working!!! :-D (well, i have to restore everything...)

Stay tuned.

PD: I suspect that my cloned repositories is not ok, it asked me to perform a cleanup..
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Mar 31, 2015 9:17 am
Good! :)

Also, I noticed that there's a lot of free space left in your banks: if you check the map file for sizes you'll see that you can cram your data in less banks quite easily :)
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Tue Mar 31, 2015 12:12 pm
yeah, it's enough with 3 banks for all data, but as i was trying to solve the strange bugs, i put all data apart in separate banks
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Mar 31, 2015 12:29 pm
oh, I see... sorry!
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Tue Mar 31, 2015 1:11 pm
:-)

Once i've everything running smoothly, i'll reunite data to 3 banks !
  View user's profile Send private message
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Wed Apr 01, 2015 4:17 pm
New version! After Banking Nightmare, now we've obstacles in the game!!

Enjoy!
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Wed Apr 01, 2015 6:06 pm
Is it the one now called version 1.0 ? what's version 0.0 ?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Post Posted: Wed Apr 01, 2015 6:18 pm
0.0 is the (renamed) original release.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Wed Apr 01, 2015 6:36 pm
The header says 0.01 for the latest one.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Post Posted: Wed Apr 01, 2015 7:57 pm
Whoops. I was reading the header in a hex editor... It's renamed again.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Thu Apr 02, 2015 9:11 am
I finally tried the game on hardware yesterday. It's quite hard so I don't know if there's a second level or if it goes on forever (like the game that inspired this...). Anyway there are minor graphical glitches on transitions, expecially when going from game to gameover screen. I think you should just wait next vblank, turn off screen, load new tiles/tilemap/palette and turn on screen again (or if fast enough you might even keep the screen on)
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Thu Apr 02, 2015 9:13 am
Now it's only an infinite level, but we plan to put varios levels, moving obstacles, etc. For now, i'll center in making it more playable, because now it's hard as hell :-p

For the transitions, i'll try to use more palette fades
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Thu Apr 02, 2015 9:15 am
Wonderful! Thanks! :)
  View user's profile Send private message Visit poster's website
Reply to topic Goto page 1, 2  Next



Back to the top of this page

Back to SMS Power!