ukVac.com Homepage
Forum Home Forum Home > Technical > Tech, Maintenance & Repairs
  New Posts New Posts RSS Feed - Frogger - bugs, descriptions and fixes
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Skin:


Frogger - bugs, descriptions and fixes

 Post Reply Post Reply
Author
Message
 Rating: Topic Rating: 2 Votes, Average 5.00  Topic Search Topic Search  Topic Options Topic Options
philmurr View Drop Down
Senior Members
Senior Members


Joined: 13 Aug 2003
Location: Hampshire
Status: Offline
Points: 3440

Feedback: 5
Post Options Post Options   Thanks (3) Thanks(3)   Quote philmurr Quote  Post ReplyReply Direct Link To This Post Topic: Frogger - bugs, descriptions and fixes
    Posted: 23 Dec 2020 at 3:27pm
Frogger is a cute game that was very successful back in the golden age. For such a successful game it has a number of well-known bugs that (for me at least) can spoil it.

I’d already done some work on Frogger code when adding it to the multigame, so knew a fair bit about it. Over the last few weeks I’ve spent time disassembling a lot of it to try to find out what the programmers did wrong, and to put some fixes in place. A brief description of the bugs (and how to fix them) is below. There isn’t much spare space in the Frogger ROMs so I was always conscious any fixes would have to be as simple as possible, but fortunately they all fit.

There isn’t a TL : DR version, I presume if you’re interested in this then you’ll want to know all the details! I guess the programmers must have been up against time pressures or just didn’t test it well enough. The programming isn’t brilliant with a lot of odd routines but I think it’s still a great game.

I haven’t described nor fixed the music bug, that’s already been well-documented. Neither have I fixed the “jump into the alligator” bug because that’s moot as to whether you should die there or not.


I will release the modified code if anyone is interested. It’s based on the Konami code, no high score save or freeplay routines, just how it should have been originally.


The worst bugs –

Collision detection isn’t great, more so when you’re on the back of logs and turtles

It can be quite unfair, especially when you’re jumping off and onto objects in the water, often dying for no reason


Other no so bad ones –

You can take control of the frog in attract mode when it’s on the top row of logs

If you’re on the bank (centre row) and jump up onto a turtle then back down, you can jump off the edge of the screen.

Jumping on the top row of logs sometimes goes very slowly

The lady frog can sometimes be invisible, then appear out of nothing but a strange colour


1 – collision detection. It’s just about acceptable when on the road so I haven’t done anything to try to improve that. It’s not pixel-perfect, but as you can be jumping in the x-axis whilst vehicles are moving in the y-axis, it does an ok job of it. But on the river you can make perfectly good jumps to the end of the turtles or logs and still die.

The game sets up a table for each row of moving objects (logs, turtles), and stores the x-position of the right-hand edge of the object. The actual position stored is 2 pixels right of the edge of the turtles and 4 pixels right of the edge of the logs. It then tries to work out if you are on any of the objects by using the width of each object and seeing if your frog is in that right-to-left window. If it is then all is good, if not you’re in the water and you die. So it gets the far right location slightly wrong, the width of the object is too small, and it bases the compare point for your frog at the right-hand edge of it which causes all sorts of errors.

Rather than rewrite the collision-detection routines completely, I extended the width of the objects so they are correct and changed the frog compare point to its centre point which makes it much more accurate, fair and playable.


2 – Dying for no reason on valid jumps. It’s been suggested there are “invisible snakes” or other enemies on the logs that kill you. I don’t believe that’s true. There are 2 almost identical collision-detection routines that run dependent on which stage you are at in a vertical jump. It sometimes gets the calculation wrong as to which row of objects it should be checking against, so if for example you’re on the very right hand edge of the top turtle row then jump up onto the log above, it calculates you’re still on the turtle row, the turtle has gone from beneath you and assumes you’re in the water and you die. To get around this, for the water stage you don’t really need both collision-detection routines so I’ve bypassed the one that causes the issues (but still run it if you’re on the road stage).


3 – taking control of the frog in attract mode. When you’re on the top row of logs, the game is always checking to see if you’re jumping into one of the homes. Unfortunately the programmers didn’t first check to see if a game was in play and just check the player inputs anyway. Oddly there is some code immediately before where it jumps to that does this check, so a quick code diversion and I get it to check first if a game is in play, if not then it doesn’t test for player inputs and you can no longer control the frog in attract mode.


4 - If you’re on the bank (centre row) and jump up onto a turtle then back down, you can jump off the right edge of the screen (and can’t go the full distance on the left edge). The x-position of your frog is $10 ($=hex) when on the left hand edge of the screen and $E0 when on the right hand edge. When you jump, you move in multiples of $10 pixels so your position will always be $n0. But when you’re jumping around in the water and land on a turtle or log, you move by 2 pixels at a time. So your x position may not be $n0, but instead $n2, $n4, etc. The game only checks to see if you are greater than $20 if jumping left and less than $E0 if jumping right, so e.g. if your x position is $DE you can now jump right to $EE which is off the right of the screen. Likewise left, if your x position is $1E you’re not at the far left of the screen but it doesn’t allow you to jump any further left. To get round this, I did some code that checks how many pixels you can still jump (in multiples of 2, not $10) to get to the left ($10) or right ($E0) and allow you to jump that far, so you now stay on the screen.


5 - Jumping on the top row of logs sometimes goes very slowly. It has nothing to do with previously eating a fly. The game reads the player inputs, then directly afterwards is the routine to perform the frog movement. The bug where you move slowly happens if you try to jump when you are below one of the homes and it has already been filled. The game checks to see if the home is already filled and prevents you from jumping into that home again, but it brute forces it by simply not checking the player inputs (so also stops the movement from progressing). So trying to jump left or right just before when you’re directly below an occupied home will start the movement, then it will stop it whilst you are below the home, then start again when you are clear of it causing the odd stuttered movement. This was a bit trickier to fix, so I went for the solution of only preventing the up player input from being processed (if you allow it, then it lets you fill the home multiple times...). So allowing left, right and down to still be processed continued with the normal movement of the frog.


6 - the lady frog can sometimes be invisible, then appear out of nothing but a strange colour. I haven’t fixed this, and I’m having difficulty reproducing it and can’t tell at this stage exactly what causes it. It has something to do with the lady frog x & y coordinates being populated by the player coordinates when the player lands on where it should be, and the sprite being set to colour 0 (which gives the odd red colour). If someone can reproduce this and send me a mame .inp file of it happening, I’ll work out what’s happening and document it.
Back to Top
cNp View Drop Down
User
User
Avatar

Joined: 10 Jul 2012
Location: Reading
Status: Offline
Points: 1407

Feedback: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote cNp Quote  Post ReplyReply Direct Link To This Post Posted: 23 Dec 2020 at 3:57pm
Great work Phil, love reading these investigations into old code and how it works
Wanted: Asteroids cabaret, Vartek Kadet JAMMA cab, Mappy Dedicated
Back to Top
biglouie View Drop Down
User
User
Avatar

First Year of Supporting ukvac.com!

First Year of Supporting ukvac.com!



Joined: 19 Nov 2015
Location: Kent
Status: Offline
Points: 1656

Feedback: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote biglouie Quote  Post ReplyReply Direct Link To This Post Posted: 23 Dec 2020 at 4:22pm
Very very cool. 

6 - the lady frog can sometimes be invisible, then appear out of nothing but a strange colour

I think we can all relate to that!!!!
Back to Top
Hurray Banana View Drop Down
Moderator Group
Moderator Group
Avatar

5 Years of Supporting ukvac.com!

5 Years of Supporting ukvac.com!



Joined: 11 Feb 2013
Location: Essex
Status: Offline
Points: 70385

Feedback: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hurray Banana Quote  Post ReplyReply Direct Link To This Post Posted: 23 Dec 2020 at 5:04pm
Brilliant hunting Phil, great fixing
Back to Top
iamjimmi View Drop Down
User
User
Avatar

Joined: 23 Dec 2013
Location: Leeds
Status: Offline
Points: 4496

Feedback: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote iamjimmi Quote  Post ReplyReply Direct Link To This Post Posted: 23 Dec 2020 at 7:02pm
Incredible work Phil...
Back to Top
blazerfrazer View Drop Down
User
User
Avatar

Joined: 05 Apr 2017
Location: Dorset UK
Status: Offline
Points: 296

Feedback: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazerfrazer Quote  Post ReplyReply Direct Link To This Post Posted: 23 Dec 2020 at 7:07pm
Skills Geek, hat off
Wanted Zenitone Deal Em
Electrocoin Diamond derby
Electrocoin Random replay
Back to Top
tronads View Drop Down
User
User


Joined: 30 Mar 2013
Location: NW Lancashire
Status: Offline
Points: 1595

Feedback: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote tronads Quote  Post ReplyReply Direct Link To This Post Posted: 23 Dec 2020 at 7:37pm
Brilliant work, love it.
You don't know anything about Carnival do you? CharlueFar is struggling to figure out why sometimes level 5 is easy and sometimes it's impossible to complete.
Back to Top
Flinnster View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 Sep 2016
Location: Surrey, UK
Status: Offline
Points: 8764

Feedback: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Flinnster Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 2020 at 1:57am
Awesome Phil! Worth revisiting it now! :)


WTD: Outrun DLX (REALLY!), Rolling Thunder PCB
Parts WTD: Any Dino King / LnB / MushiKing Spare Parts!
Back to Top
acidburn View Drop Down
User
User
Avatar

Joined: 08 Sep 2010
Location: Leicestershire
Status: Offline
Points: 1024

Feedback: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote acidburn Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 2020 at 6:56am
Awesome stuff Phil.

Edited by acidburn - 24 Dec 2020 at 7:02am
*****************************
Instagram: scotts_home_arcade
*****************************
Back to Top
DonkeyKongler View Drop Down
User
User
Avatar

Joined: 13 Aug 2017
Location: Germany
Status: Offline
Points: 147

Feedback: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote DonkeyKongler Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 2020 at 8:09am
Originally posted by philmurr philmurr wrote:

I will release the modified code if anyone is interested.


good job,
i'm interested.........
Back to Top
philmurr View Drop Down
Senior Members
Senior Members


Joined: 13 Aug 2003
Location: Hampshire
Status: Offline
Points: 3440

Feedback: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote philmurr Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 2020 at 4:00pm
So I've played this a bit more and it's definitely more playable and (dare I say it), fun?

I won't attach the full updated ROMs on here but I have attached a link to the changes that need to be made to the original ROMs. You could always message me if you want the files emailing to you...

Back to Top
jstav View Drop Down
Newbie
Newbie


Joined: 31 Dec 2020
Status: Offline
Points: 6

Feedback: 0
Post Options Post Options   Thanks (1) Thanks(1)   Quote jstav Quote  Post ReplyReply Direct Link To This Post Posted: 31 Dec 2020 at 10:15pm
Hi,

Thanks very much for the patch. I was just playing Frogger on a MiSTer and having all kind of these issues.  So I made an upgraded .mra file that applies your patch to the Konami romset on load, and I agree it is MUCH improved. The stock MiSTer Frogger is based on the froggers2 (Sega Set 2) version.

For any interested parties, the new "Frogger (Konami Bugfixed).mra" can be found here:

Frogger is one of my wife's favourites.

 Thanks,
 Jay
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.281 seconds.