Banned User
Joined: 12/14/2009
Posts: 386
Location: Santiago, Chile
wooooow! this is incredible, I did not know that with LUA's is all that I could do and even more. Now that I know all this, maybe can finally i can get the material I needed so much. If someone is kind enough to create a script code graphically show me (if possible) the position of Tails when away from the screen. I would appreciate very much, because I do not know programming in this language. Please!
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
Here: Sonic 1 Sonic 2 Sonic 3/Sonic & Knuckles Sonic CD [edit: Links removed. Check the first post of the thread for updated versions.] These are emulators compiled with Upthorn's and Nitsuja's camera hack, solidity display and hitbox display. It is only safe to use them for the corresponding games (and some limited hacks of each). With 'num lock' on, the base address of objects is shown, as well as the angle on the ground. With 'scroll lock' on, camera hack is disabled; otherwise, you can scroll through objects with 'page up'/'page down' or return to Sonic with 'home'. If the selected object is offscreen, the emulator will display centered on the selected object. While rings and sprites show, only rings on the same vertical slice as Sonic (give or take) can be taken, and Tails (or Sonic) will generally not interact with sprites that are offscreen. Solidity is displayed as color overlays: green overlay means only the top is solid (ground); red overlay means all but top solid (wall/ceiling); blue overlay means all solid (ground/wall/ceiling); no overlay means not solid. Sonic and Tails have two hitboxes: the inner one is for interaction with things that can hurt Sonic, the outer one is for sprites and terrain. Sprites with red hitboxes always hurt; sprites with green hitboxes have special collision, with no main pattern; purple hitboxes are badniks; and so on.
Marzo Junior
Banned User
Joined: 12/14/2009
Posts: 386
Location: Santiago, Chile
I think they did not understand my idea. Here I leave a picture of what I mean (not real, only an imitation of what I mean) Maybe I ask much, but this is achievable with some LUA. As shown in the image, a camera follows Tails while he is outside of the game screen.
WST
She/Her
Active player (442)
Joined: 10/6/2011
Posts: 1690
Location: RU · ID · AM
Is Amy in Sonic the Hedgehog 2 really supported? I get this error
ROM with checksum '0xa709' is unsupported.
I beleive the script actually works (since the game engine is the same), but it just does not have such checksum listed as supported one. However, I don’t wanna touch the code. I used ROM from Sonic Retro, version 1.5. And yes, what mr Felipe requests could be very useful thing too. Especially if it’s possible to display it in a separate window. (upd) Found rom-check.lua, gonna try simply to replace the listed checksum value
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
I updated the script to support Amy in Sonic 2 version 1.5. As is my practice, I deprecated support for the older version (which was still 1.3, since I hadn't updated to 1.4 yet). edit: And regarding what you ask: the emulators can show Tails while he is offscreen, and you can use multi-track recording to record Sonic and Tails separately.
Marzo Junior
WST
She/Her
Active player (442)
Joined: 10/6/2011
Posts: 1690
Location: RU · ID · AM
marzojr wrote:
I updated the script to support Amy in Sonic 2 version 1.5. As is my practice, I deprecated support for the older version (which was still 1.3, since I hadn't updated to 1.4 yet).
Ok, one more question: do you have a repository (svn, git, etc) for this project? It will be much easier to me and others to keep the code up to date.
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
WST wrote:
Ok, one more question: do you have a repository (svn, git, etc) for this project? It will be much easier to me and others to keep the code up to date.
No, but I can see about setting one up.
Marzo Junior
WST
She/Her
Active player (442)
Joined: 10/6/2011
Posts: 1690
Location: RU · ID · AM
marzojr wrote:
WST wrote:
Ok, one more question: do you have a repository (svn, git, etc) for this project? It will be much easier to me and others to keep the code up to date.
No, but I can see about setting one up.
Ok, and if you’ll need a subversion repo, you can ask me to provide it (or use any public service like Google Code).
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
WST
She/Her
Active player (442)
Joined: 10/6/2011
Posts: 1690
Location: RU · ID · AM
Can you please implement support for this game?
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
WST wrote:
Can you please implement support for this game?
I will when I finish making said game; before that, it will be a waste of time. Trust me on that.
Marzo Junior
Player (36)
Joined: 9/9/2006
Posts: 388
marzojr wrote:
I updated the script to support Amy in Sonic 2 version 1.5. As is my practice, I deprecated support for the older version (which was still 1.3, since I hadn't updated to 1.4 yet). edit: And regarding what you ask: the emulators can show Tails while he is offscreen, and you can use multi-track recording to record Sonic and Tails separately.
Any chance of having that code sometime soon then? Or have you not developed it?
A whisper in the wind~~
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
You mean showing Tails offscreen and multi-track recording? It is already there -- the versions of Gens I offer precompiled can do that already. The code is not mine, it is Upthorn's and Nitsujas.
Marzo Junior
Player (36)
Joined: 9/9/2006
Posts: 388
Showing Tails offscreen should be possible with pure Lua. If you look in the Rewind Lua script (and other fun scripts) topic (specifically the post linked) we've been trying to do this. Any chance you can shed some insight?
A whisper in the wind~~
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
In theory it should be possible; in practice, it is nowhere nearly as simple as you think it would be. Here is how Gens does it:
  1. If CamHack is not needed (object in question is offscreen), then just update the screen and do nothing else;
  2. otherwise: it the camera is currently more than 640 pixels away horizontally, force it to be this value;
  3. likewise, if the camera is currently more than 448 pixels away vertically, force it to be this value. The camera is also forced to be above the target;
  4. compute how many frames it will take the camera to scroll to the selected object from the position computed above;
  5. save the entire object RAM;
  6. emulate (without redrawing) the number of frames obtained in (4) above, setting some RAM flags to prevent the game from updating as much as possible and copying the object RAM over the emulation results;
  7. emulate one last frame to redraw.
Doing all of this is needed because the camera has a speed limit on how fast it can scroll (and the image will be all wrong), as well as to prevent objects from loading due to the new camera position.
Marzo Junior
Banned User
Joined: 12/14/2009
Posts: 386
Location: Santiago, Chile
marzojr, i want the sonic_hud.lua be updated. I made ​​some changes, such as displaying in time format some data and i have changed the color of the HUD's to solid red. I want to place a input display well decorated, using images for each button. I think that may be displayed on the main HUD's base. if someone can answer this suggestion, I would appreciate.
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
Show me what you got so I can take a look.
Marzo Junior
Banned User
Joined: 12/14/2009
Posts: 386
Location: Santiago, Chile
I add a function to convert these data to format time [sec]:[frame] into the game-info.lua
function clockframe(frame) return string.format("%d:%02d",frame/60,math.fmod(frame,60)) end
Also i have changed the color of the HUDs to solid red because I like that color and I think that stands out more. But on the penultimate image, i not found how to change the blue of the titles of the boxes. Finally, I explain in the last image an idea to add a input display, I think the second option is better. The changes made were in game-info.lua, char-info.lua and boss-hud.lua
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
The color was blue so as to not stand out too much; changing it to red becomes too distracting and draws too much attention to the HUD as opposed to the game. For the timers: I can see adding an option to show it in seconds:frames, but I can't see it becoming the standard: when you are playing frame-by-frame, it is more useful to know that the invincibility will last (say) 200 frames than 3 seconds 20 frames. Adding the display for perfect rings is a nice touch, I can see that being useful. The problem of the input display area is that it may conflict with S3&K's multiple bosses.
Marzo Junior
Player (36)
Joined: 9/9/2006
Posts: 388
To save myself reposting. I already sat and figured the max ring count myself a good while ago and left a post for you about it.
DDRKhat wrote:
marzojr, any chance you could implement a max ring count in your SonicHud script? I managed it quite easily with this snippet (but im sure you could do better); game-info.lua
function game:get_rings()
	if rom:is_sonic2() then return string.format("%3d/%d", self:get_raw_rings(),(self:get_raw_rings()+memory.readwordsigned(0xffff40)))
	else return string.format("%3d", self:get_raw_rings()) end
end
Also, given the knowledge from earlier, would it be possible to make a indicator on Tails (For 2,3,3k) that notifies you if he can obtain rings or not?
A whisper in the wind~~
Banned User
Joined: 12/14/2009
Posts: 386
Location: Santiago, Chile
Mmmm I see. But adding input display is a good option, right? The problem is to find a good place. Do not worry about the color then I like to have it so, but isn't obligation. As for the new option, would be more useful show those data in sec:frames when you are playing normally. But when you are playing frames per frames, show it in frames. He also had another idea, there is a memory address to identify the pause mode. FFF63B (0 = Game running, 1 = Game paused) Could make when the game is paused, showing a box showing "Game Paused" and when play resumes disappears?
Banned User
Joined: 12/14/2009
Posts: 386
Location: Santiago, Chile
In fact, that is for his idea, DDRKhat! I have it for I use your code. And Thank you.
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
DDRKhat: your code has a few problems: collecting ring boxes increase the number after the slash, and losing rings changes it back down. I think a simple counter is better in this case -- I have just put it as "%03d (%d)", with the number in parenthesis being the number of rings left to collect for a perfect. As for the clocks when playing -- I don't think that there is a function that detects whether Gens in on frame advance mode or not. Anyway, will look into making an option to turn on clock mode for timers. Hm. And I still have to think where I will put Knuckles' HUD when I modify the HUD to accept my hack...
Marzo Junior
Banned User
Joined: 12/14/2009
Posts: 386
Location: Santiago, Chile
Look it marzojr. I found a memory address that identifies whether the game is paused. Detected simply pause and show the box that says "Game Paused".
------------------------------------------------------------------------------
-- Pause box
------------------------------------------------------------------------------
local function draw_pause_box(ptext)
		if memory.readbyte(0xfff63b) == 1 then -- Detect if game is paused
			if memory.readbyte(0xfff600) == 16 then -- Detect if is into special stage
				pbox = Frame_widget.Create(256/2-((4+4*#ptext)/2),224/2-4,4 + 4 * #ptext,10,nil,{0,0,0,192})
			else
				pbox = Frame_widget.Create(320/2-((4+4*#ptext)/2),224/2-4,4 + 4 * #ptext,10,nil,{0,0,0,192})
			end
			pbox:add(Text_widget.Create(0,0,ptext,nil),2,2)
			pbox:draw()
		end
end

callbacks.gui.register:add(function()
		menu_active = menubtn:draw()
		draw_pause_box("Game paused")
	end)
Banned User
Joined: 12/14/2009
Posts: 386
Location: Santiago, Chile
marzojr, how you have created the images LUAIMG or how I can open it?
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
Please note that I am on Linux; that being said: I have a shell script that lists all files in a directory with the original PNGs and calls a tool called pngtogd to convert the images to luaimg. This script also generates the "sonic/common/hud-images.lua" file. I also have some scripts that search for the HUD and boss code for sufficiently unmodified hacks for the respective auto-generated files (they tell if they are), but those are lua scripts (but meant to be run from the command line, and not from Gens).
Marzo Junior