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

#26 2016-04-03 20:09:43

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

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

So, whilst looking around the debugging menu inside bgb, I spotted a suspiciously m=named function that isn't available to me within C, called sgb_transfer

Despite attempting to modify some of the compiler functions to allow me to include it as an accessible function on it's own to fail, I think I've got somewhere by doing a quick and dirty copy paste of the ASM code into differently named functions, which, handily, can be exposed to C and GBDK via ASM includes.

It seems that the function expects a memory address with a following 128 bytes worth of data, which is great, assuming it works of course. Will update later this week with any news on it.

Also, I've upped my games UI a fair bit as mentioned in my video and prepared some graphics for the ending of each race. Fingers crossed this works!

Offline

 

#27 2016-04-10 17:59:21

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

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

A few more tracks added and some sfx for button sounds, etc, etc. The SGB stuff is still stumping me though,any tips from anyone would be great. Looing to use this as a function inside GBDK called sgb_transfer_me_do  with a reference to a point in memory to be called as such: 

sgb_transfer_me_do(&startingpoint);

I'm hacking away at the ASM below whcih I've mostly lifted and renamed functions to but I'm not sure how to get the right starting point into memory. that and my ASM skills still need a LOT of work.

Any help would be greatly appreciated.

Code:

    .globl _sgb_transfer_me_do
    _sgb_transfer_me_do:            ; Added by Ryan
    LDA    HL,2(SP)        ; Top of command data ? Is this the first byte in the 
    AND    #0x03
    RET    Z
    LD    B,A        ; Number of translated packet
    LD    C,#0x00        ; Lower part of #FF00
1$:
    PUSH    BC
    XOR    A        ; Start to write
    LDH    (C),A
    LD    A,#0x30
    LDH    (C),A
    LD    B,#0x10        ; Set counter to transfer 16 byte
2$:    LD    E,#0x08        ; Set counter to transfer 8 bit
    LD    A,(HL+)
    LD    D,A

3$:
    BIT    0,D
    LD    A,#0x10        ; P14 = high, P15 = low  (output "1")
    JR    NZ,4$
    LD    A,#0x20        ; P14 = low,  P15 = high (output "0")
4$:
    LDH    (C),A
    LD    A,#0x30        ; P14 = high, P15 = high
    LDH    (C),A
    RR    D        ; Shift 1 bit to right
    DEC    E
    JR    NZ,3$

    DEC    B
    JR    NZ,2$
    LD    A,#0x20        ; 129th bit "0" output
    LDH    (C),A
    LD    A,#0x30
    LDH    (C),A

    POP    BC
    DEC    B
    RET    Z
    CALL    .waitfour        ; Software wait for about 4 frames
    JR    1$

.waitfour:
    LD    DE,#7000
.1$:
    NOP            ; 1 +
    NOP            ; 1 +
    NOP            ; 1 +
    DEC    DE        ; 2 +
    LD    A,D        ; 1 +
    OR    E        ; 1 +
    JR    NZ,.1$        ; 3 = 10 cycles
    RET

Offline

 

#28 2016-04-25 14:50:48

Ryoga
Member
From: Spain
Registered: 2014-12-21
Posts: 15

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

Hi richan. I think you should take a look at this...


Coll Stuff...

Last edited by Ryoga (2016-04-25 15:07:16)

Offline

 

#29 2016-05-09 16:21:16

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

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

Heyy, sorry, been away from the forums for a while. Yeah, that looks pretty cool, been having a chat with cabbage about it recently too.

Offline

 

#30 2016-05-22 19:07:50

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

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

Formula Racing Now has just over half it's number of courses designed now. Boost pads, wind tiles, spikes and oil slicks all there to change the players race. I'm considering adding a small random element to each track just to keep each laps slightly different to the last one.

Offline

 

#31 2016-05-25 07:03:32

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

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

Yeah, not much space left in ROM BANK #0, where the main game code is stored, down to 365bytes to add the last few things... eep!

Offline

 

#32 2016-05-31 07:30:59

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

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

So, I demo'd formula racing on friday on the super gameboy and found out that I'm using a leetle too much CPU to sustain a solid 60fps on the classic gameboy, using wait_vbl_done(). Whilst there's not too many optimisations I can make to reduce it's usage down, would it be hardware okay in this case to remove the wait_vbl_done() to increase the framerate from 30fps to closer to 60?

There are some instances where I'm down to 75-80% CPU usage but those are tracable.

Also, 270 bytes left!

Offline

 

#33 2016-06-06 07:43:09

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

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

More bugs fixed over the weekend, working on getting the pasword system working for the Grand Prix Mode this week. It's sooo close to getting there!

Offline

 

#34 2016-06-06 10:07:54

d.bop
Member
From: Duluth, MN
Registered: 2016-03-22
Posts: 14

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

I'm super excited for this. Just so you know smile


(and also. passwords, heck yeah!)

Offline

 

#35 2016-06-06 10:38:06

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

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

Yeah, not sure If I can "safely" add any form of battery backup stuff so passwords it is!

Offline

 

#36 2016-06-13 19:08:24

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

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

12 / 18 tracks completed and some more elements, including random tiles thrown in for good measure! (They'll either be a speed boost / oil or blank depending on DIV_REG)

Purchased a gameboy pocket for more testing and have got the game back down to ~60fps. It runs a lot faster than it was on the Super Gameboy, sooo, that's a good sign.

The new tiles are making the level designs a lot more interesting than the earlier ones, I'll go back through them at some point.

Also added some GUI fixes for the grand prix mode password screen.

Getting there! I'm suspecting I'll have to go for a 256kb ROM instead of my orginial 128kb target. No reason why I'd chosen 128kb, just felt like a good number big_smile But extra scenes for race over, grand prix endings need to be in there and I'm going to be tight on kb allowing for music also in any case!

Offline

 

#37 2016-06-17 05:18:07

quangdx
New member
Registered: 2013-10-01
Posts: 8

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

Really impressed with your progress on this, reminds me of when I first started GameBoy coding.
The learning process as you add more bits to your game, adding colour, memory bank switching, sound, etc.
Keep up the good work.

Offline

 

#38 2016-06-17 08:26:16

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

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

Hey, thanks Quangdx! It's been lots of fun so far, and it's getting closer to completion, just a few more circuits, race ending and game completion / credits screens and a soundtrack from Nordloef and it'll be what I would consider to be a complete gameboy / gameboy colour game.

I'll save the SGB stuff for another game later on though!

Offline

 

#39 2016-06-18 16:37:56

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

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

Soo, I was unhappy with the A.I. this morning, it was just, a bit too samey...Soo, I've mixed things up a bit and not only has this made the A.I. a lot tougher, but I've reduced the bank space being used and reduced CPU usage, yay! But...Now I finish 7th where I used to finish much better...gahhh!

Offline

 

#40 2016-06-19 18:35:02

quangdx
New member
Registered: 2013-10-01
Posts: 8

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

What are you using to create/play music in GBDK?

Offline

 

#41 2016-06-20 04:21:58

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

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

There's only sfx in there so far, but it's only setting the registers on channels 1,2 and 4 to certain values programatically. So, for an example, the engine noises frequency and loudness is based on speed of the vehicle, with the cpu car's loudness being determined on the vertical distance between the two cars.

Works really well and has the bonus of being low cost in both size and cpu work.

Offline

 

#42 2016-06-20 11:33:28

Tag365
Member
Registered: 2016-06-01
Posts: 44

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

I would like to be able to play this someday.

Offline

 

#43 2016-06-20 18:17:25

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

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

hehe, when It's ready wink

Offline

 

#44 2016-06-21 20:07:07

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

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

Big ol' post detailling more progress on my website here if anyone want's a looksy wink

https://refreshgames.co.uk/2016/06/22/n … ent-stuff/

Offline

 

#45 2016-07-15 10:59:18

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

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

Apologies for the long delay, still working on this in the background between game jams and a few other bits 'n' bos going on at home smile This project will not die!

Offline

 

#46 2016-07-16 16:45:09

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

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

and then from out of nowhere gbdk has died on me... getting creation of temp file failed on all my builds, including previous working ones.....oh god. what has gone on here....

[edit]

Aha! Found what it was, 10,000 sdccxxx files in my %TEMP% directory.

Removed them all and tried compiling... thanks flip, that worked!

Last edited by rychan (2016-07-16 17:16:18)

Offline

 

#47 2016-08-13 22:24:44

clobber
New member
Registered: 2015-08-24
Posts: 2

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

Hey there, you're using GBDK which is based around an ancient 15+ year old version of the gbz80 compiler/linker/assembler. As I can see you've already run into issues due to bugs and you may want to check out GBDK-N, an updated version of the GBDK to work with the latest SDCC compiler suite.

https://github.com/rotmoset/gbdk-n

Offline

 

#48 2016-08-15 10:23:29

Tag365
Member
Registered: 2016-06-01
Posts: 44

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

Wait what? I did not know about the "GBDK-N" version of Gameboy Development Kit.

Offline

 

#49 2016-09-23 07:59:47

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

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

Still coding and designing away. Although not on this game recently. But still, I've learnt some new bits 'n' bobs along the way, including making some handy scripts to get that 4bit DAC on sound channel 3 active and playing some sampled sound, some more code optimisation stuff and I'm currently trying to figure out how to do the whole sampled sound thing whilst gameplay is continuing.

The main thing for me is the learning about how channel 3 works, disabling the cahnnel, changing the DAC bits to certain waveforms, re-enabling it then looping. It almost sounds intelligible! Also I can now use it as a redimentary triangle / sine / another square wave channel for background music needs!

I'm going to succumb to the needs of a 9th bank however, which is kinda a shame as I was hoping to cram 18 race tracks of data into there, along with ending and game-ending screens. Sadly that doesn't look possible though, unless I remove some of the tracks, which I'm not overly keen on doing.

Still searching for a place to burn the finished cartridges onto for a reasonable price, but going over 32kb just cuts so many routes off. hmm

Offline

 

#50 2018-07-29 05:14:08

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

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

Just a quick post to say that yes, still alive. Currently tackling my first game on the NES in NESASM. Will be coming back to this game afterwards. Also have a lil tool that converts stuff from Deflemask to GBDK usable music in the pipeline. Should be good to use with Formula Racing I Reckon smile

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson