Sonic and Sega Retro Message Board: Sonic 2 Speedometer, Boost Meter, and Ring Finder - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Loading News Feed...
 

Sonic 2 Speedometer, Boost Meter, and Ring Finder A Lua script for the Gens Rerecording branch

#1 User is offline Dr. D'nar 

  Posted 02 May 2012 - 05:08 PM

  • I wouldn't trust me if I were you
  • Posts: 113
  • Joined: 06-August 05
  • Location:����
Every so often, I like to show up and post something random. Today, I bring you a speedometer for Sonic 2. I wrote it as a Lua script for the Gens Recording fork (http://code.google.c...ns-rerecording/). For fun, I also threw in a boost meter for the spin dash and a ring finder. Most of the additional HUD elements this video shows are normally hidden unless you ask for them, but I turned that off for this demo video. You can find the Lua script at http://pastebin.com/8sDbWdxK. [New version for S2 and S3&K] The full documentation for the script is the source code's header. And the script is well-labeled and commented, so you should find it easy to find and delete the relevant parts of the code for any features you don't like, or move them around, or adjust them, &c.

Here's a video of the script in action:

This post has been edited by Dr. D'nar: 06 May 2012 - 04:03 AM

#2 User is offline ICEknight 

Posted 02 May 2012 - 05:16 PM

  • Posts: 8211
  • Joined: 11-January 03
  • Gender:Male
  • Location:Spain
  • Wiki edits:18
...That's some amazing shit in there. :O


I would have never ever expected anybody to put a ring radar in Sonic 2. Great work!

#3 User is offline redhotsonic 

Posted 02 May 2012 - 05:29 PM

  • Also known as RHS
  • Posts: 1004
  • Joined: 31-January 05
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic 2 Recreation
  • Wiki edits:24
Wow, that's very neat. The speedometre is the coolest there. Although, that ring finder is very handy for anyone looking for a perfect bonus. Good work!

#4 User is offline steveswede 

Posted 02 May 2012 - 05:37 PM

  • Posts: 2443
  • Joined: 13-April 09
  • Gender:Male
  • Location:Birthplace of Lara Croft
  • Project:Bowel reconstruction
  • Wiki edits:6
This is a very cool feature indeed.

#5 User is offline LocalH 

Posted 02 May 2012 - 05:44 PM

  • roxoring your soxors
  • Posts: 3043
  • Joined: 11-January 03
  • Gender:Male
  • Location:wouldn't you like to know
  • Project:MDEM - Genesis programming stufz
  • Wiki edits:3
Now figure out a way to do it without Lua *shot*

Seriously, this is pretty cool. Lua is very powerful when it comes to integration with emulators, I've seen some equally impressive stuff for the NES (such as Xkeeper's drag-and-drop SMB1, among others).

#6 User is offline Dr. D'nar 

Posted 02 May 2012 - 06:13 PM

  • I wouldn't trust me if I were you
  • Posts: 113
  • Joined: 06-August 05
  • Location:����

View PostLocalH, on 02 May 2012 - 05:44 PM, said:

Now figure out a way to do it without Lua *shot*
Indeed. . . . I don't feel very motivated to implement this as an actual ROM hack, since I don't have a flash cart. I don't image it would be particularly difficult. If you include pre-rendered sprites for all the possible needle angles, you could entirely avoid doing the necessary trig in assembly. You would just do some division to find the right index into your table and copy the sprite to VRAM.

New version with the code cleaned up a little, fixed typos, &c.

On a tangentially-related note, I can't post this to the Wiki since my Wiki account is broken because my username has an apostrophe in it. It'd be nice if an admin could fix that.

Notice that the ring-radar and speedometer are animated. While this may be useful to TASers, it's also supposed to be pretty. If only I had a better algorithm for drawing the meters. (They look really ugly if you try to use transparency.)

#7 User is offline flamewing 

Posted 02 May 2012 - 06:47 PM

  • Posts: 564
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
The speedmeter and ring finder are look very nice. However, at least for TASing, I must say that my lua HUD is still unbeatable. You may want to look into it for other interesting timers to track; I know I will be copying your ideas about collision plane tracking and perfect bonus counter :v:.

#8 User is offline Knucklez 

Posted 02 May 2012 - 08:17 PM

  • Posts: 351
  • Joined: 10-May 11
  • Gender:Male
  • Location:Florida
  • Project:College
The boost meter and ring finder aren't really necessary and if anything, they're eyesores IMO. The speedometer is a pretty neat feature though. It really adds to the whole speed thing about Sonic, so I'd love messing around with it to see the fastest I can make myself go.

#9 User is offline Ravenfreak 

Posted 03 May 2012 - 12:26 AM

  • RavenxArgent <3
  • Posts: 2017
  • Joined: 24-November 08
  • Gender:Female
  • Location:O'Fallon Mo
  • Project:The Final Zone, various hacking projects, Rockman World
  • Wiki edits:112
Wow this is pretty sweet. :) Do you have any plans on making this available for Sonic 1 and 3K? That'd be even cooler if you did. ^_^ And it'd be even more epic in a hack too. xP (But this is nice nonetheless of course.)

#10 User is offline Dr. D'nar 

Posted 03 May 2012 - 03:41 AM

  • I wouldn't trust me if I were you
  • Posts: 113
  • Joined: 06-August 05
  • Location:����

View Postflamewing, on 02 May 2012 - 06:47 PM, said:

The speedmeter and ring finder are look very nice. However, at least for TASing, I must say that my lua HUD is still unbeatable. You may want to look into it for other interesting timers to track; I know I will be copying your ideas about collision plane tracking and perfect bonus counter :v:.
You, sir, have me truly outdone. At least, you do graphically. From what I've seen so far playing with, you don't show any S2 information I didn't have my script showing at one point. For example, I decided that the Tails AI timers and position indicator weren't particularly useful to me, since I don't actually make TAS videos. But I love the feature for disabling the original HUD.

Since your script looks so much nicer, I'd love to see you absorb my features (just give me credit) as options in your script. Especially if you can make a better arc-drawing algorithm. (The best idea I've had is to render the graphic to a sort of back buffer so that pixels that are visited more than once don't actually result in multiple draws to that location.)

View PostKnucklez, on 02 May 2012 - 08:17 PM, said:

The boost meter and ring finder aren't really necessary and if anything, they're eyesores IMO. The speedometer is a pretty neat feature though. It really adds to the whole speed thing about Sonic, so I'd love messing around with it to see the fastest I can make myself go.
That's why both automatically hide themselves. The video doesn't show the ring finder hiding in order to show off the tracking; in my script, you do Up+B to make it appear for two seconds.

View PostRavenfreak, on 03 May 2012 - 12:26 AM, said:

Wow this is pretty sweet. :) Do you have any plans on making this available for Sonic 1 and 3K? That'd be even cooler if you did. ^_^ And it'd be even more epic in a hack too. xP (But this is nice nonetheless of course.)
The script that flamewing posted below already does most everything I do, although without the analog meters. The ring finder cannot be ported as easily as the other features, since other Sonic games implement rings differently than Sonic 2 does. Nevertheless, I may give it a go in the next few weeks. It will require finding the current level's sprite table, parsing it, and cross-referencing the rings with the object respawn array.

#11 User is offline flamewing 

Posted 04 May 2012 - 09:23 AM

  • Posts: 564
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12

View PostDr. D, on 03 May 2012 - 03:41 AM, said:

You, sir, have me truly outdone. At least, you do graphically. From what I've seen so far playing with, you don't show any S2 information I didn't have my script showing at one point. For example, I decided that the Tails AI timers and position indicator weren't particularly useful to me, since I don't actually make TAS videos. But I love the feature for disabling the original HUD.

Most of the difference shows up on S3&K, now that I think about it.

View PostDr. D, on 03 May 2012 - 03:41 AM, said:

The ring finder cannot be ported as easily as the other features, since other Sonic games implement rings differently than Sonic 2 does.

S1 rings are in-level objects; it is likely that doing a ring-finder for it will be quite annoying, at least for rings not yet loaded. S3&K rings are stored uncompressed in ROM, sorted from left to right, then top to bottom; there is a ring consumption table in RAM which marks rings as being taken.

#12 User is offline Hitaxas 

Posted 04 May 2012 - 02:34 PM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1355
  • Joined: 30-September 07
  • Gender:Male
  • Location:Litchfield, CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
Both lua scripts are awesome. Flamewings does not work with my hack, but I tried it out on stock s2, and it works well. D'nar, yours does work on my hack and even though the ring detector hides itself, it works despite the fact that I am using the s3k ring manager. :-)

#13 User is offline flamewing 

Posted 04 May 2012 - 02:52 PM

  • Posts: 564
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12

View PostHitaxas, on 04 May 2012 - 02:34 PM, said:

Both lua scripts are awesome. Flamewings does not work with my hack,

My script uses a whitelist-based approach to what hacks it supports because some elements are highly dependent on the game/hack in question: the specific RAM addresses and SST offsets depend on base game for example (and thankfully, most hacks keep RAM layout relatively unchanged from their base game), and the boss HUD and original HUD hiding portions hook ROM code execution at some points to do their thing. If the boss HUD/HUD hiding code is relatively unchanged in your hack, I can quickly add support for it on my script.

I suppose I could add a limited functionality mode that asks for the base game type and disables the more involved functions.

#14 User is offline Hitaxas 

Posted 04 May 2012 - 03:48 PM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1355
  • Joined: 30-September 07
  • Gender:Male
  • Location:Litchfield, CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
For the most part, the ram and sst are the same, with the exception of 2 player mode and tails AI, which I removed in favor for some new features such as unlockable game play modes (different move sets based on different sonic games), the addition of extra characters, etc. The HUD code is untouched.

I'll get you the games checksum when I can check it, don't remember it if the top if my head, and I am miles from my PC.

#15 User is offline flamewing 

Posted 04 May 2012 - 06:13 PM

  • Posts: 564
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12

View PostHitaxas, on 04 May 2012 - 03:48 PM, said:

I'll get you the games checksum when I can check it, don't remember it if the top if my head, and I am miles from my PC.

More useful is a link to the hack: my script dumps the checksum to the console window so it is easier to add support for ROMs :v:

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users