don't click here

I come forth asking a question

Discussion in 'Engineering & Reverse Engineering' started by Tribeam, Jan 12, 2012.

  1. Tribeam

    Tribeam

    I code Lua and Lua accessories Member
    80
    0
    6
    Hey Retro, long time no see, hell last time I posted here was when I released that palette editor thing...

    The Story:
    Been a while since I got into this stuff, then recently I came back to mess around some more. Now I'm working on a new tool(still using Lua). this tool will have a remade palette editor, real time level editing/saving/loading tool, real time changing of generic stuff like lives, rings, zone, act, etc. I guess you can say the new tool is like a crazy new debug hooked right into the game. But Tribeam...why?, I don't know.. why not? heh. Anyway while working on this tool, during a boring session, I decided to play around with some ASM and unfortunately I don't have time to be learning a new language. However I did learn the bare basics of how it works and I decided to try something new. Try to get Lua and ASM to communicate between each other. First I started off small, getting Lua to play any sound I want with a simple "Gamesound(id)" function. Then I moved on to changing the music speed whenever I wanted. Then I decided to try something else(though this didn't require any ASM editing) while playing LBZ and curious as to how LBZ changes its chunks instantly, I attempted to make a copy/paste like function in Lua, simply copychunks(x2, y2, x2, y2, x3, y3). It worked fairly well(though still unsure about how to get the screen to refresh). This is when an idea hit me. If someone(me) was to hook Lua in to possibly everything I can imagine would work, this could probably make for an interesting hack by breaking a few limits, spawn items at will, animate chunk changes(I guess like MGZ does?), move objects at will(maybe a floating platform like seen in Mario3 that follows a line path), draw images outside the genesis palette(32bit), mouse interactions, make new objects that Lua specifically uses to make new crazy enemies and bosses, the list goes on.


    The Question
    Before I decide to dive into this further, I got 1 part of me that says "this could work", then there's another part that says "this is stupid and the community will never go for it blah blah".

    So I come here asking what does Retro think?
    Should I dump this idea in the trash or continue on and see what can come of it?


    Some Notes
    I'm not suggesting this as a new way for the community to hack, basically just a way for me heh.

    Also if I do go forward with this, I'd need an ASM person(or some) to help me


    Some Code:
    ASM
    Code (Text):
    1. AIZ1_ScreenEvent:
    2.         jsr DrawTilesAsYouMove(pc)
    3.        
    4. ; start lua checks
    5.  
    6. ; Play sound functionality for Lua
    7. Lua_CheckSound:
    8.         cmpi.b  #$1, ($FFFFEF00).w          ; check if activator value is 1
    9.         bne.s   Lua_End                             ; if not skip
    10.  
    11. Lua_PlaySound:
    12.         move.w  ($FFFFEF02).w,d0            ; else set sound id value to d0
    13.         jsr (Play_Sound).l                          ; play that sound
    14.         move.w  #$0, ($FFFFEF00).w      ; change activator value to 0(so it doesn't repeat)
    15.  
    16. Lua_End:
    17.  
    18. ; end lua checks
    19. ...

    Lua
    Code (Text):
    1. function Game_PlaySound(id)
    2.     memory.writeword(0xFFEF02, id)
    3.     memory.writebyte(0xFFEF00, 0x01)
    4. end
     
  2. FeliciaVal

    FeliciaVal

    Member
    693
    11
    18
    Spain
    for some reason I think this would help a lot of people and if it's something that you'd like to do, so I say go for it!
    I find it really interesting and now im curious as what you come up with it
     
  3. GT Koopa

    GT Koopa

    Member
    2,021
    18
    18
    Elgin, IL
    Flicky Turncoat DX, T.L.W.S. Vs M.G.W.
    I tend to scatter a lot of my work with the swapping out chunks trick, as seen here.

    Basically I took the Labyrinth Zone act 3 code and used it elsewhere, and activate it via various means.

    Sonic 2 has a switch chunk code as well. However, it is even better as you can switch it on screen, something I want to figure out for sonic 1. Here I use it to make the CNZ boss fight more interesting for the pinch. (1:00 in for those who don't wait)


    Now Sonic 3&K, why are there templates of the swapped in and out chunks off to the side out of the level? Does the game(s) use a special kind of code that says replace this selected area with this preplanned array of chunks? If so, does it save time and is it efficient?
     
  4. Cinossu

    Cinossu

    Administrator
    2,832
    44
    28
    London, UK
    Sonic the Hedgehog Extended Edition
    If I remember correctly, what's actually happening there is silent player positioning, as in the player is actually warping to those areas rather than the chunks changing in the level. But I could be wrong.
     
  5. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    Playing in Gens rerecording with a memory watch in Sonic's position shows that this is not the case. It is more likely that the game routines copy from a preprogrammed location. This is more flexible than the S2 method, and avoids having to hard-code the replacement chunk IDs, so it makes sense.