Sub-bg?

Discussion in 'Discussion and Q&A Archive' started by FireRat, Feb 2, 2011.

Thread Status:
Not open for further replies.
  1. FireRat

    FireRat Do Not Interact With This User, Anywhere!!! Exiled

    Joined:
    Oct 31, 2009
    Messages:
    535
    Hi. Now I have a big question (I think)


    Looking the Sonic 3 Backgrounds, I notices that here's a sub-bg:


    [​IMG]


    (back to the pillars)


    I know, this is a special effect, because the bg just scroll the complete image, at different speeds, but this bg does more things...


    Looking how are the original chunks, I can't found the sub-bg, just numbers:


    [​IMG]


    Obviusly, the game replace these numbers by an animation. This works with a animation script


    My question is: How I can create a animation script like this?


    (Come on. Markey, you know...)<
     
    Last edited by a moderator: Feb 2, 2011
  2. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    I didn't take the time to really look into this yet, but it happens in a lot of levels in s3 (+htz in s2, I don't think there's any other there). The HTz version looks a bit cryptic to me (everything from s2 looks cryptic to me xD ), but the one from ICz looks to be simple enough.


    For ICz, it's in AnimateTiles_ICZ, the other dynamically reloaded pattern files are named "artunc_dynrel*blabla*.bin" in Hayate's split disassembly, with their name you can find the pointer, and with the pointer, the routine.


    It really looks simple, I guess the most difficult is to find what the addresses in those routines are meant to be.


    I could be missing something though...
     
  3. OrdosAlpha

    OrdosAlpha RIGHT! Naebody move! Root Admin

    Joined:
    Aug 5, 2007
    Messages:
    1,793
    Location:
    Glasgow, Scotland
    If you haven't got an idea of how it's done, then it's obviously beyond your ability and no one is going to spoon feed you the solution. Time to sink or swim.
     
  4. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    Trox, this is called parallax scrolling. The background tiles are ever the same, but the zone's background deformation is wich gives to the level a third (and fourth) layer aspect in the background of Carnival Night, Launch Base, Hydro City, Mushroom Hill and lots of other levels in Sonic 3 & Knuckles and also in some of the levels in Sonic 2. After playing some other Genesis games I noticed that this same kind of effect is used in hundreds of other games in Sega Genesis. So you'll need to do the import of these deformation stuff or you'll need to code it by yourself.
     
  5. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    If you have knowledge on how to modify VRAM, this shouldn't be a big problem for you. While I've never tried, I can imagine that this is technically "simple". All you do is to replace certain tiles in VRAM releated to your camera position.


    Example: You have a tile of stars and you create 8 different versions of it, each one having one vertical line moved to the left. Now all you do is to change the specific tile(s) in the VRAM releated to your camera position and there you go.


    Though, if you only want to make entire lines scrolling, you can use something called "horizontal scroll buffer" which start at the RAM address $FFFFCC00. This is also used by the BG's for GHZ, as am example.
     
  6. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    I'm glad these sort of questions are asked sometimes. It is not deformation (a.k.a scrolling), and it is not a third plane, the megadrive does not have a third plane to work on.


    This is the illusion of "animated tiles", as an example, the flowers in GHZ and the lava in MZ in Sonic 1, they animate based on a time/counter, while the HCZ back ground pillars, horizontal water effect, and many other examples animate based on the X and/or Y positions insted of a counter.


    I have reproduced this effect on Sonic 1 and 2 for many hacks now, unfortunately those examples must stay private as they're technically not my hack/project to go showing examples of, I can however show you these:


    http://www.youtube.com/watch?v=FJhGr5KZx50 (The stars in the BG)



    (Hard to see but the bricks behind that bridge and the water ripple reflecting the lamp slightly above)

    It's a very simple and logical idea, though can be lagful if not very careful. If done correctly you "can" make it appear as 4, 5, 6, 7 or even 8 planes are being scrolled.
     
  7. FireRat

    FireRat Do Not Interact With This User, Anywhere!!! Exiled

    Joined:
    Oct 31, 2009
    Messages:
    535
    Yes, I know...


    but how I can program the script? I have no idea how is the format
     
  8. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    There's no fixed script format, that depends on how you write it, and it depends on what tiles, how many tiles, and how many in an animation set, this cannot be defined easily, look up the tile (8x8) format, and learn some more assembly mnemonic instructions, that's always a good thing.
     
  9. Sonic master

    Sonic master Well-Known Member Member

    Joined:
    Mar 27, 2010
    Messages:
    303
    You need to modify (somehow) the tiles in software for example if your tiles looks like (see below "*" =pixel "-" = no pixel)


    *------*


    *------*


    *------*


    *------*


    *------*


    *------*


    *------*


    *------*


    Then you would need to find a way to make the tile look like.... if you move to the left by one camera movement for the plane


    tile1: tile2:


    -*------ *-------


    -*------ *-------


    -*------ *-------


    -*------ *------


    -*------ *------


    -*------ *------


    -*------ *------


    -*------ *------


    I hope someone figures out how to do this because I am personally interested in software scrolling (and not just for sonic)
     
    Last edited by a moderator: Mar 6, 2011
  10. FireRat

    FireRat Do Not Interact With This User, Anywhere!!! Exiled

    Joined:
    Oct 31, 2009
    Messages:
    535
    Last edited by a moderator: Mar 7, 2011
  11. Sonic master

    Sonic master Well-Known Member Member

    Joined:
    Mar 27, 2010
    Messages:
    303
    I was looking for a way to modify the tiles in real time instead of just storing alot of different copys of the tiles.
     
  12. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Writing an algorithm to alter the tiles in real time is not considered a smart thing to do on a slow processor, you're likely to end up with extreme lag.
     
  13. FireRat

    FireRat Do Not Interact With This User, Anywhere!!! Exiled

    Joined:
    Oct 31, 2009
    Messages:
    535
    Hmm, I'm not completely sure. Some days ago, I saw a 128kb ROM, with a very nice effect like this on the entire screen, and working very quickly. I have not the ROM for now, but I sent the ROM to GF64, if he still have the ROM you can view it
     
  14. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    Of course it can be ok when all you do is just generating tiles, I don't think that ROM processed objects and game physics. Well, I once tried to do a similar thing, but much crazier than this =P I was generating some tiles pixel by pixel having rather complicated, but highly optimized algorithm, including lots of cycles though. Processor could generate just about 8-10 tiles before lagging. Certainly, that was done in a separate screen.


    During a level loop in Sonic games, the processor is to run objects' code, build sprites, scroll level layout with deformation, animate level art, update music etc. Obviously, it's better to optimize everything to avoid lags when many objects or another code is being processed. So I agree with MarkeyJester, writing algorithm for this isn't worth it.


    EDIT: Grammar
     
    Last edited by a moderator: Mar 8, 2011
Thread Status:
Not open for further replies.