Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2016-02-23 07:50:17

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Formula Racing - Gameboy Classic / Colour Game In Development

Figured I'd post some screenshots of my most recent gameboy game in development, it's been fun to code up and learn about Gameboy Colour forwards compatability so far

Intro Screens
https://www.refreshgames.co.uk/wp-content/uploads/2016/02/refresh-games-gb.png

https://www.refreshgames.co.uk/wp-content/uploads/2016/02/title-large.png

Scrolling Game in action + collisions (sprite vs sprite and sprite vs bkg)
https://refreshgames.co.uk/wp-content/uploads/2016/02/animateAI.gif

It's been a good challenge with getting scrolling and other things working but it's proven to be good fun and it runs nicely so far.
I'm pretty happy with where the game is and hope to have a finished version released shortly.

More details about my development progress can be found here:

http://refreshgames.co.uk/

Not sure why the images aren't coming out on here, looks to be formatted correctly though.. hmmmph, direct links below instead I guess?
https://www.refreshgames.co.uk/wp-conte … mes-gb.png
https://www.refreshgames.co.uk/wp-conte … -large.png
https://refreshgames.co.uk/wp-content/u … mateAI.gif

Last edited by rychan (2016-02-23 07:54:54)

Offline

 

#2 2016-02-24 12:10:28

a cat
Member
Registered: 2014-07-27
Posts: 98

Re: Formula Racing - Gameboy Classic / Colour Game In Development

looks great!

i will play this when it comes out

(source code would be great also!)


a cat in need of knowledge!!

Offline

 

#3 2016-02-24 18:44:35

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Thanks, will do, just trying to get my head around memcpy to reduce cpu usage a bit smile Haven't used pointers yet somehow!

Offline

 

#4 2016-02-24 19:05:42

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Aha, found the bugger in string.h aand my CPU usage has dropped by ~10% on the gameboy classic version, nice!

I wander if when I've got a bit further if I can get it to reference other track data dynamically (probably via pointers I'm guessing) to turn this around.

So far the game weighs in at 13kb so there's plenty of space available if I choose not to.  But it just makes sense to do it for simpler scene management.

Offline

 

#5 2016-02-28 07:05:53

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Managed to get a decent coding session underway last night and now the game is a lot tougher, damage reflects upon car performace, you can pseudo-explode if you take too much of it, cars can pass you back if you crash and I've got a fairly safe way to load multiple levels now. There's still a surprising amount left to do though, eep!

Offline

 

#6 2016-02-29 18:56:20

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Got some more of the title sequence in the game now and I'm thinking about how to add some sorta Border for Super Gameboy features.

No docs in GBDK (aside from SGB detection) but I guess dipping into ASM would make this possible somehow? Any ideas would be appreciated. I've only done a lil bit of ASM on the VCS 2600 so far.

https://refreshgames.co.uk/wp-content/uploads/2016/02/sgb-border2x.png

Offline

 

#7 2016-03-01 06:11:57

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Right, got myself ASM functionality inside C all sorted out and access to super gameboy features, now to figure it all out tonight (hopefully) It's been fun!

Offline

 

#8 2016-03-06 19:13:51

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Been away from the code for a while but back on to it tonight.

Linked the intro screens into the game and did a rough colour job on them for colour gameboy stuff.

Still unsure how to tackle SGB stuff though.

Offline

 

#9 2016-03-07 19:41:57

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Fixed some more lil graphical glitches tonight and planned some more screens out. The super gameboy stuff will have to wait.

Offline

 

#10 2016-03-14 20:06:14

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Orr maybe it won't have to wait after all.

I'm attempting to get my head around how to write ASM (which can be included inside GBDK, handy that) and have the following pseudocode

// sgb sound function
disable interrupts in GBDK

SET P14 and P15 to LOW?? (Looks like a value of 20 in decimal over here?)
Where are these located in the joypad register? 0xFF00 is just one address right?

nop for a moment [15us]

01000001    // FUNCTION 8-SOUND [5] - 1 PACKET [3]
00000001    // EFFECT A - NINTENDO NOISE ![8]
00000000    // EFFECT B - NONE[8]
11010000    // A PITCH[2], A VOLUME[2], B PITCH[2], B VOL[2]
00000000    // MUSIC SCORE CODE[8]
00000000    // REST IS UNUSED
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000    //OBLIGATORY BLANK BIT[8]

nop some more for 4 frames or ensure no other ops for 4 frames one way or another.

Can anyone shed some light on this or point me in the right direction? I'm confused as to where P14 and P15 would lie in memory, 0xFF00 is just a sinlge 8 bit value. Or am I missing something?

If I can figure out how to write something generic so it could be used inside gbdk by others that would be great, but have so far only done a lil bit of atari 2600 asm.

Offline

 

#11 2016-03-15 03:48:52

AntonioND
Member
Registered: 2014-06-17
Posts: 114
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

If I remember correctly there's a function in GBDK to send SGB commands, check the sgb.h file (or something). Try with that. But yes, P14 and P15 are the two writable bits of the P1 register (FF00).

Offline

 

#12 2016-03-15 08:00:53

beware
New member
Registered: 2011-12-07
Posts: 4

Re: Formula Racing - Gameboy Classic / Colour Game In Development

hi, your games as far as i checked them (space invaders, and another one), don't use halt opcodes to wait. i think they run at unlimited framerate (so 200-300 fps or so).

it's proper/recommended to, when the frame is done, wait using halt, and to then do the next frame at the vblank interrupt, and read the joypad first thing after the start of the vblank, and have the joypad values then influence the immediate next frame.

if a game does not use halt opcodes, it will use up the gameboy's batteries unnecessarily fast, and emulators will use more CPU to emulate it. you can check the "CPU usage meter" in bgb's debugger, the green/amber bar on the right. if the game uses halt opcodes, it will be partially or mostly dark. if it's solid on/bright, the game is not using halt opcodes.

Offline

 

#13 2016-03-15 18:44:10

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Thanks for the reminder beware, I'm using the vblank in this game to limit to 60fps, it's all quite the learning experience!
Will look through the sgb.h file again, thanks Antonio smile  what exactly are p14 and p15 though?

Offline

 

#14 2016-03-16 03:57:28

AntonioND
Member
Registered: 2014-06-17
Posts: 114
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

The joypad hardware is just a matrix of 4x2 connections. 2 of them (P14 and P15) are outputs, the rest are inputs. The SGB uses the 2 outputs for command information because the CPU didn't have to be modified to be used this way, the 2 outputs from the CPU were already there, as well as the 4 inputs. http://bgb.bircd.org/pandocs.htm#joypadinput

Offline

 

#15 2016-03-16 06:52:07

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Ahhh, and there's P14 and P15, that's so helpful, thanks Antonio!

Can't believe I missed this in my searches!

Offline

 

#16 2016-03-16 20:40:20

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Right, I think I'm getting somewhere now with my sgb code.

Code:

// INSIDE N ASM FILE - IS THIS 5 microseconds? Not sure how long NOP lasts for but I'm imagining not very long.
    .globl _paus
    _paus:
    NOP
    NOP
    NOP
    RET

// INSIDE A ROMBANK in GBDK
            //SEND A COMMAND TO THE SUPER GAMEBOY - START
            *(char*)0xFF00 = 0;        //BOTH DOWN
            paus();
            *(char*)0xFF00 = 48;    //BOTH HIGH
            paus();paus();paus();
            
            for (i=0; i!=255; i++){
            *(char*)0xFF00 = 16;    // BIT 0
            paus();
            *(char*)0xFF00 = 48;    //BOTH HIGH
            paus();paus();paus();
            }

Does this look closer to something that might work? I imagine I could remove part of the delay to copy the replacement register value over from an array in the future. A whole bunch of zeroes ain't gonna do anything.

Offline

 

#17 2016-03-18 18:46:19

AntonioND
Member
Registered: 2014-06-17
Posts: 114
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

I don't think that doing cycle accurate functions in C is a good idea...

Offline

 

#18 2016-03-19 09:35:02

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Why not simply use the timer interrupt?

Offline

 

#19 2016-03-21 16:55:24

AntonioND
Member
Registered: 2014-06-17
Posts: 114
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

It makes no sense to use it, the waits needed for SGB packets are too short.

Offline

 

#20 2016-03-23 05:48:02

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

It is crazily short, 5 microseconds, followed by 15 microseconds, then looped. With a long 4 frame delay between packets.

I've not done any development of late due to having to re-organize my home office into another room but hopefully should be back on it come sunday! I might put the SGB stuff on the backburner whilst I get some more of the main game ready. Might burn this onto a cartridge when it's finished though!

Offline

 

#21 2016-03-28 05:11:14

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

The game's coming along still, multiple tracks have been added, just gotta design them all 'n' test them out, very glad for the map editor! Also Started learning how to use fami tracker which I should be able to type over to a format for the gameboy.

Offline

 

#22 2016-03-29 04:16:39

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

5 tracks down, improved the A.I. last night and feeling pretty good about things again. Will post a video / image some time this week.

Offline

 

#23 2016-03-29 19:49:44

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

As promised, here's a short video of the game with my plans on what to do next.

http://youtu.be/37pQAbWg6m0

Offline

 

#24 2016-03-30 16:38:15

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Formula Racing - Gameboy Classic / Colour Game In Development

This looks good so far!

Offline

 

#25 2016-03-30 19:43:57

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Formula Racing - Gameboy Classic / Colour Game In Development

Thanks Xephyr, lots to do still on it but it's coming together slowly tongue

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson