Lady Bug

developing/porting a new game or gaming framework? post in here!
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

a strange bug

on master 128k the game now crashes and page 0100 (where my main interrupt code sits) is full of garbage

the only thing i changed recently was add a 2nd counter into the interrupt code that counts at 1/2 the frame rate

ive marked the 4 lines starting with a *

if i remove these lines the game works fine on te master. very strange

Code: Select all

.irqInterrupt

	lda viaIfr				; if interrupt flag = vsync
	and #2
	bne irqVsync				; then go do the upper vsync interrupt
	
.irqTimer					; else its a timer interrupt so do the lower interrupt

	lda #&40				; clear timer interrupt flag
	sta viaIfr

	lda #&ff				; screenHalf = lower
	sta screenHalf

	lda irqAcc				; restore A

	rti					; return to main program

.irqVsync					; upper interrupt

	sta viaIfr				; clear vsync interrupt flag

	lda #lo(rasterTimer)			; set timer 1 for lower interrupt
	sta viaT1CounterLo
	lda #hi(rasterTimer)
	sta viaT1CounterHi

	lda #&00				; screenHalf = upper
	sta screenHalf

	inc vsyncCounter			; bump vsync counter

*	lda vsyncCounter			; if vsyncCounter & 1 == 0
*	and #1
*	bne irqVsyncExit
	
*	inc vsync25Hz				; then bump vsync25Hz counter

 .irqVsyncExit

	lda irqAcc				; restore A
	
	rti					; return to main program
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

interesting

i removed a small function function from page 0100 (updateObjectTimer) and relocated it after 0d00 to leave more space for the stack which has now grown from 27 bytes to 72 bytes

now the game runs fine on the master 128K

its strange because theres no way my game is using that much stack but something is overwriting the code in page 0100

and why did it run fine on the bbc B and B+ but not the master ?

this is very odd
Attachments
ladybug.ssd
(23.75 KiB) Downloaded 2 times
Last edited by lovebug on Thu Jul 22, 2021 10:01 am, edited 1 time in total.
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

omg i found it ! i was looking at relocator.asm and found this dumb line :lol:

Code: Select all

	ldx #&ff				; initialise stack
	tsx
that should read

Code: Select all

	ldx #&ff				; initialise stack
	txs
omg that error has been there from day 1 argh ! :oops:

right I just put the function back into page 0100, the stack is showing 27 bytes and everything is working fine. phew

it was pure luck so far that the game even worked !
Attachments
ladybug.ssd
(23.75 KiB) Downloaded 10 times
Last edited by lovebug on Thu Jul 22, 2021 11:33 am, edited 1 time in total.
Image
User avatar
BigEd
Posts: 4238
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Lady Bug

Post by BigEd »

good catch - such an obscure bug!
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

BigEd wrote:
Thu Jul 22, 2021 10:17 am
good catch - such an obscure bug!
well it was something to do with the stack so i thought lets start from the beginning and work from there and luckily enough it was right there at the beginning of relocator.asm which sets up stuff, relocates the game in memory and starts the game

ive probably seen that line of code a hundred times but never noticed the mistake lol
Image
User avatar
tricky
Posts: 5681
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Lady Bug

Post by tricky »

lovebug wrote:
Thu Jul 22, 2021 1:27 am
...btw is there a build of beebem that emulates the nula ?...
I don't think so and I'm not sure how much of the NuLA functionality the others support.
User avatar
BigEd
Posts: 4238
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Lady Bug

Post by BigEd »

lovebug wrote:
Tue Jul 20, 2021 10:58 pm
gonna take a break for a bit because i really need a rest
I'm seeing great progress - but don't burn out!
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

@tricky hmmm i could have a go at writing nula functions for beebem and compiling a new build

@BigEd thanks i'll take it easy

-------

the tiniest of updates

im just drawing some art for the bonus screens. i made a flower and some grass coming very soon :lol:

i set all the letters illuminated so when the game starts it automatically will give both bonus screens with a strange side effect if ladybug being frozen during the level walk in

well i guess it makes sense, during normal game play when a full bonus panel is detected the game freezes ladybug and the enemys, waits for any pending sounds on software channel 0 (vegetable bonus music) before playing the letters bonus music and triggering a bonus screen

so that is excatly whats happening at the start of the round except its waiting for the intro music to finish instead.it just looks weird :lol:
Attachments
ladybug.ssd
(24 KiB) Downloaded 3 times
Last edited by lovebug on Thu Jul 22, 2021 10:01 pm, edited 3 times in total.
Image
User avatar
tricky
Posts: 5681
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Lady Bug

Post by tricky »

I just posted your NuLA comment to the stardot dev night zoom chat and it put a big smile on Chris' face - I think that he may be a little scared of the display code :lol:
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

if i do look intro compiling beebem i'll also fix the off by 1 error in the screen scalling where the vertical resolution is 1 less than the actual value and theres a ugly bump in the screen

i'll also take a look at why the audio get out of sync with the video when making a video capture from beebem, i suspect a similar error is involved which is throwing the timing off over a few mins
Image
User avatar
tricky
Posts: 5681
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Lady Bug

Post by tricky »

I think that the out of sync is that in non-interlaced mode it is a shorter frame.
I usually fix that in VirtualDub when compressing, but it probably only needs a change in the header although I wouldn't know what happens when it starts in MODE 7 and then a game turns interrupts off.
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

tricky wrote:
Thu Jul 22, 2021 9:31 pm
I think that the out of sync is that in non-interlaced mode it is a shorter frame.
I usually fix that in VirtualDub when compressing, but it probably only needs a change in the header although I wouldn't know what happens when it starts in MODE 7 and then a game turns interrupts off.
thats something i hadnt considered.... interesting. i need to look into video formats now as im not sure if variable frame rate is possible lol
Image
User avatar
tricky
Posts: 5681
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Lady Bug

Post by tricky »

There are some simple but sophisticated methods of varying emulator speed to hit a frame rate that also vary the audio chip simulated frequency to match the game and local frame rate.
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

i think i might put the idea of fixing the audio on the back burner for a while :P

--------------

just added a function drawFlower to draw a single flower and it works, i just gotta design the two bonus screen layouts with some text and flowers spread around with animated ladybug driving around them
 
flower x2.png
flower x2.png (196 Bytes) Viewed 402 times
 
gonna write a ladybug animation function that takes a list of directions and frame counts to send ladybug around the bonus screens and i'll also be able to use the same function for the ladybug walk in at the start of a round which currently is hard coded

this is the extra life bonus screen from the arcade so it's gonna be something like this
 
extra life screen.png
 
oh I also adjusted the hit detection range between the enemys and ladybug from 8 pixels to 6 pixels so they have to be just that little bit closer now before they touch you. helps a bit especially when turning corners
 
ladybug.ssd
(24 KiB) Downloaded 4 times
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

small update , added graphics and text to the extra life bonus screen

no animated lady bug yet
 
ladybug.ssd
(24.25 KiB) Downloaded 2 times
 
extra bonus.png
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

added the special bonus screen (mostly just copy/paste of extra bonus screen)

still no animated ladybug yet
 
special bonus.png
 
ladybug.ssd
(24.25 KiB) Not downloaded yet
Image
User avatar
leenew
Posts: 4625
Joined: Wed Jul 04, 2012 4:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: Lady Bug

Post by leenew »

lovebug wrote:
Fri Jul 23, 2021 1:14 am
small update , added graphics and text to the extra life bonus screen

no animated lady bug yet
 
ladybug.ssd
 
extra bonus.png
It should be "LADY BUGS" rather than "LADY BUG'S".
I know some Arcade games weren't noted for their perfect English grammar...
Does the original Arcade game say "BUG'S"?

Lee
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

leenew wrote:
Fri Jul 23, 2021 9:04 am
It should be "LADY BUGS" rather than "LADY BUG'S".
I know some Arcade games weren't noted for their perfect English grammar...
Does the original Arcade game say "BUG'S"?

Lee
hehe yeah i spotted that after posting, thanks

its actually my bad english, the original only says bug as it awards only 1 extra life

i fixed it and also added 2 more flowers of different color so now the bonus screens pick the flowers randomly
right now all 3 flowers are identical except color (the lazy copy/paste again lol) but eventually i'll draw two other shapes giving 3 unique looking flowers
 
ladybug.ssd
(24.5 KiB) Downloaded 4 times
 
special bonus.png
 
extra bonus.png
Image
User avatar
leenew
Posts: 4625
Joined: Wed Jul 04, 2012 4:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: Lady Bug

Post by leenew »

Excellent!
Keep up the great work :D

Lee
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

i found an issue in eraseSprite, theres a call to spriteToAddr that converts a sprite x y coordinates into a screen memory address and that function returns with carry clear or set depending if the sprite coordinates were on or off screen but i forget to check the result which could result in an invalid address being filled with zeros

the sprites will never be off screen in the final build but during this development a simple miscalculation somewhere could cause an issue and a crash if zeros get written outside the screen address range

I also rearranged the bonus screen flowers a bit and improved the text on the special bonus screen, increased the number of shields awarded to 6
fixed the weird walk on level repeating although this cannot happen in a normal game as you cannot start a round with all bonus letters illuminated, hmmmm actually it might just be possible if you were to collect the last letter of a bonus and get killed by an enemy at the same time hmmmm that i should try :D

still no ladybug animation on the bonus screens :(
 
ladybug.ssd
(24.5 KiB) Downloaded 3 times
 
bonus special.png
 
bonus extra.png
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

a while back i switched to full ascii character set (upper case only) and I meant to post the font here in case someone wants to use it in their own games but i completely forgot

the version i have in ladybug is the same except some characters [ \ ] ^ _ have been repurposed into special characters for the multipliers/heart
 
img-font-ascii.png
img-font-ascii.png (577 Bytes) Viewed 288 times
 
img-font.png
img-font.png (597 Bytes) Viewed 288 times
----------------- edit ---------------
i just noticed that / and \ looked a bit skinny so they are fatter now :D
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

i just had a thought about the enemys that I could make them turn 180 if they see a skull ahead
this would make them a lot tougher* but then we would never hear that most satisfying sound when then die on a skull :lol:

im gonna test it out and if its fun and doesnt impact the game speed then i will add it as a feature you can enable on the options screen



* how wrong i was !
Last edited by lovebug on Fri Jul 23, 2021 4:19 pm, edited 1 time in total.
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

well i quickly hacked together a test and im not sure if i like it or not

it also means that enemys can never respawn in the box so you'll only ever get 1 vegetable bonus per round

i might keep it as an option or might drop it, not sure

heres a build with skull avoid enabled
 
ladybug.ssd
(24.5 KiB) Downloaded 2 times
 
------------------ edit ----------------------
ive played it a bit longer and it really is a terrible idea

i thought it would make the game harder but then enemys just run around bouncing off skulls
that plus the fact you can only collect 1 vegetable bonus per round made the game completely boring lol

the code has been wiped so this build here is the only copy :lol:
Last edited by lovebug on Fri Jul 23, 2021 9:08 pm, edited 1 time in total.
Image
SteveF
Posts: 1008
Joined: Fri Aug 28, 2015 9:34 pm
Contact:

Re: Lady Bug

Post by SteveF »

tricky wrote:
Thu Jul 22, 2021 7:27 pm
lovebug wrote:
Thu Jul 22, 2021 1:27 am
...btw is there a build of beebem that emulates the nula ?...
I don't think so and I'm not sure how much of the NuLA functionality the others support.
b-em supports the attribute modes - it's not perfect as the some pixels are wider than others, which I don't think happens on real hardware, but it works fairly well. I used it to develop the 240x256 mode 1 display code here - you could also use that as a convenient test to see if emulator X supports these modes or not. It would be really cool to see a game using a NuLA attribute mode, but please don't burn out - I'm enjoying this thread far too much. :-)
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

thanks SteveF i'll check it out


added some test animation for the bonus screens, nothing fancy
 
ladybug.ssd
(24.5 KiB) Downloaded 6 times
 
ladybug animation test.png
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

i had a go at drawing enemy set 0, they are not perfect but will do for now
so now i have set 0 and 1 with 2 to 7 still pending, mode 2's weird aspect ratio makes it very difficult to draw rotated sprites
 
ladybug.ssd
(24.5 KiB) Downloaded 2 times
 
img-enemy0.png
img-enemy0.png (465 Bytes) Viewed 165 times
 
img-enemy1.png
img-enemy1.png (508 Bytes) Viewed 167 times

----------------- edit -----------------
i just modified them again and updated, this will happen a lot :lol:
Last edited by lovebug on Sat Jul 24, 2021 1:18 pm, edited 1 time in total.
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

while i was h-flipping and pixel shifting the horizontal sprites in photoshop i accidently flipped the animation frames sequence too
 
img-enemy0.png
img-enemy0.png (480 Bytes) Viewed 161 times
 
ladybug.ssd
(24.5 KiB) Downloaded 4 times
 
the game has 8 enemy sets 0-7
for levels 1 to 8 all 4 enemys are the same type, level 1 = set 0, level 2 = set 1 etc
in level 9 and onwards each enemy is randomly picked from sets to 0 to 7 so there are mixed types on screen together
also when an enemy dies and respawns in the center box a new random set is picked
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

i noticed that if enemys are close to the object score or vegetable score then they can cut off part of the image so ive moved drawing of these to after drawing the sprites which has solved the issue

I also added 3 skulls in the path of ladybug on the special bonus screen to help indicate what the 6 shields awarded are for, ive tested it in debug mode and it works fine with ladybug driving through the skulls unharmed but so far in a normal game ive not lasted long enough to collect all the letters to spell out SPECIAL to trigger the bonus screen :lol:
Attachments
ladybug.ssd
(24.75 KiB) Downloaded 2 times
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

i think im gonna add the name entry for highscore next as its a simple enough bit of code, need to write a full keyboard scan for this but shouldnt be an issue

----- edit -----
i changed my mind and decided to write an arcade style name entry using the up down left right and start keys
Last edited by lovebug on Sun Jul 25, 2021 4:46 pm, edited 1 time in total.
Image
User avatar
lovebug
Posts: 426
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

i kept missing getting the red p in special so i checked the code and found a mistake in my bit table as P was actually assigned to A !!!
fixed that
Attachments
ladybug.ssd
(24.75 KiB) Downloaded 2 times
Image
Post Reply

Return to “new projects in development: games”