Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. RobiWanKenobi

    RobiWanKenobi Python Developer Member

    Joined:
    Sep 10, 2022
    Messages:
    15
    Location:
    United States
    You have more tiles than sonic 1 can handle, and this usually affects objects too, use fewer tiles and replace them with existing tiles if it doesn't change to look too much, also make sure all of the colors will work with the palette or change the palette to work with the art. You can unload objects you wont use in your level at all to help this, and what I said earlier, use less tiles. flipping tiles and blocks wont make new ones, plus you can recolor them by switching palettes. Plus you may need to delete some chunks for it to work.
     
  2. Saum22

    Saum22 Newcomer Member

    Joined:
    Sep 25, 2022
    Messages:
    10

    Oh? What's the cap?
     
  3. RobiWanKenobi

    RobiWanKenobi Python Developer Member

    Joined:
    Sep 10, 2022
    Messages:
    15
    Location:
    United States
    Last edited: Nov 2, 2022
  4. ⸸ devon ⸸

    ⸸ devon ⸸ There's nothing left but faith Member

    Joined:
    Aug 26, 2013
    Messages:
    1,173
    Chunk limit is actually $52 ($A400 bytes in chunk buffer / $200 bytes per chunk) ($53 if you count the hardcoded blank chunk at ID 0).
    Block limit is $300 due to RAM limitations ($1800 bytes in block buffer / 8 bytes per block), but it could theoretically go up to $400 (Really, for Sonic 1, it should be $800, and the collision functions allow for that, but the level renderer only allows up to $400. That can be fixed by going to GetBlockData and changing "andi.w #$3FF,d3" to "andi.w #$7FF,d3").
    Tile limit depends on how you set up the rest of VRAM. Take a look at where object art also gets loaded, and also be aware that stuff like plane, sprite, and horizontal scroll data, alongside other object tiles begin at $C000 in VRAM, so I'd personally hard cap the tile limit at $600.
     
    Last edited: Nov 2, 2022
  5. GenesisDoes

    GenesisDoes What Nintendont Member

    Joined:
    Jan 2, 2016
    Messages:
    154
    Location:
    Pittsburgh, PA
    If you need even moar ROM chunks than $7F in Sonic 1, then you can expand it up to a final max of $FF Chunks for affected zones, though at the expense of removing Sonic 1's hacky loop system.

    https://sonicresearch.org/community/index.php?threads/extend-rom-chunks-to-ff-in-sonic-1.5572/
     
  6. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    411
    Location:
    Town Creek, AL
    Question
    I got my level converted from Sonic 2 to the Two-Eight disassembly successfully (finally) however I copied GHZ1’s start Position bin and edited to 00DF072B and every time I start I’m “flung” out the level and die instantly. Activating Debug move shows I’ve died at FF60073D. There’s times after finding Sonic via Debug Mode and exit debug mode positioning status goes crazy. Going from FFxxxxxx to 01xxxxxx constantly until death, Sonic nowhere. I’m almost finished, but there’s this error to get by
     
  7. RobiWanKenobi

    RobiWanKenobi Python Developer Member

    Joined:
    Sep 10, 2022
    Messages:
    15
    Location:
    United States
    Would it be possible to write a sonic 2 title card code generator in python? I want to be able to change title card text without using windows since 99% of the time I use Ubuntu.
     
  8. fuzzy

    fuzzy Inconsistent Member

    Joined:
    Oct 30, 2022
    Messages:
    3
    I recently posted a Sonic 1 title card generator I wrote in Lua(u) on Sonic Retro for use with the Yuu Yuu Hakusho font. While I'm not very familiar with Sonic 2, I am willing to bet it's very similar. With that being said, here's the source code, crossposted from Retro:
    Code:
    --PRIVATE VARIABLES--
    local TitleText = "HELLO SSRG"
    local Offset = {
        X = 0xB8,
        Y = 0xF8
    }
    
    local FirstLetterPosition = 0x2D
    local TileIncrement = 0x4
    local TileSpacing = 0xF
    
    local FirstASCIILetter = 97
    local GlobalSpacing = 0
    
    
    
    --PRIVATE FUNCTIONS--
    local function DecimalToHex(Number)
        local HexString = string.format("%x", Number)
        HexString = string.upper(HexString)
    
        return HexString
    end
    
    local function ConvertLetter(Letter, Index)
        local Shape = 5
        local AdditionalSpacing = 0
        local TrueLetter = ((Letter - FirstASCIILetter) * TileIncrement) + FirstLetterPosition
    
        if Letter == 105 then
            AdditionalSpacing = 0x4
        elseif Letter == 32 then
            return "\n"
        end
    
        return "        dc.b    " .. string.upper(string.format(
            "$%x, %d, 0, $%x, $%x\n",
            Offset.Y,
            Shape,
            TrueLetter,
            (Offset.X + (TileSpacing * (Index - 1)) + AdditionalSpacing) % 0xFF
        ))
    end
    
    local function ConvertString(Text)
        local Output = ""
    
        for i = 1, #Text do
            local CurrentLetter = string.sub(Text, i, i)
            local ASCIILetter = string.byte(string.lower(CurrentLetter))
            Output = Output .. ConvertLetter(ASCIILetter, i)
        end
    
        return Output
    end
    
    
    
    --INIT--
    print(ConvertString(TitleText))

    And some basic Rust code using a Lua interpreter library to run it:
    Code:
    use std::env;
    use std::path::Path;
    use mlua::prelude::*;
    
    fn main() -> LuaResult<()> {
        let lua = Lua::new();
        let args: Vec<String> = env::args().collect();
        let source_file = Path::new(&args[1]);
    
        lua.load(source_file).exec()?;
        Ok(())
    }
    Dependencies:
    Code:
    [package]
    name = "LuauTest"
    version = "0.1.0"
    edition = "2021"
    
    [dependencies]
    mlua = { version = "0.8", features = ["luau", "vendored", "macros"] }
    

    If you know how Lua or sprite mappings work, hopefully this should be enough to get you in the right direction!
     
    EpsilionDubwool, Inferno and Rivet like this.
  9. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    411
    Location:
    Town Creek, AL
    https://youtu.be/A4S2sqVhK0k

    I'm referring to this, and i have coordinates set right.
    Yes I'm porting over the proto levels
     
  10. ⸸ devon ⸸

    ⸸ devon ⸸ There's nothing left but faith Member

    Joined:
    Aug 26, 2013
    Messages:
    1,173
    The Sonic 2 title card works by having a bank of uncompressed letters and picking which letters to load into VRAM (see LoadTitleCard and Off_TitleCardLetters). The sprite mappings (Obj34_MapUnc_147BA) are then based on the letters loaded. Sonic 1 uses a global bank of letters instead.

    That's pretty far down in a stage. Do you have your stage boundaries set properly? Particularly in the dynamic level events/resize routine as well?
     
    fuzzy likes this.
  11. NayTheGamer

    NayTheGamer Active Member Member

    Joined:
    Sep 30, 2022
    Messages:
    29
    Is there an utility for auto mapping the collision for sonic 1 if you’re making art rather than having to map the collision yourself (it’s a bit lazy but I’m not bothered to have really bad slope collision in my levels)
     
    Last edited: Nov 19, 2022
  12. RobiWanKenobi

    RobiWanKenobi Python Developer Member

    Joined:
    Sep 10, 2022
    Messages:
    15
    Location:
    United States
    I don't know of one, and I promise you, you want good slope collision. If there is one, let me know since I don't know of one, since I also wish there was one.
     
  13. RobiWanKenobi

    RobiWanKenobi Python Developer Member

    Joined:
    Sep 10, 2022
    Messages:
    15
    Location:
    United States
    I finally did it
    https://github.com/RobiTheGit/Sonic2TitleCardCodeGeneratorPython
    Bugs:
    Positioning may need manual edits
    2 player vs title cards not supported yet
     
    Last edited: Nov 21, 2022
  14. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    411
    Location:
    Town Creek, AL
    I reset it to 00B703A8 I see it’s all accurate since I use debug and move to the left and quickly find Sonic’s a ring, however exiting debug and he vanishes, like he shifts from said location to FF1403BE. Everything else that I know of is fine. Tiles, blocks, chunks, layout is fine (as seen in the video) after I get past this roadblock I can test collision to see if the compression was right
     
  15. NayTheGamer

    NayTheGamer Active Member Member

    Joined:
    Sep 30, 2022
    Messages:
    29
    I've got a bit of an issue:
    sometimes when I make backgrounds it would look fine in sonLVL but not in game (Bizarre)
    here's Two screenshots
    Desktop Screenshot 2022.11.27 - 21.11.12.56.png
    v
    blastem_20221127_204732.png
     
    Nik Pi likes this.
  16. Dark Shamil Khan

    Dark Shamil Khan TASer lol Member

    Joined:
    Nov 7, 2021
    Messages:
    49
    Location:
    Pakistan
    That maybe because of the palette. You could set the palette manually I guess?
     
  17. NayTheGamer

    NayTheGamer Active Member Member

    Joined:
    Sep 30, 2022
    Messages:
    29
    I Don't think so because I've tried other backgrounds before, and the same problem persists. Even if I followed the steps in the ProjectFM SonLVL Guide.
     
  18. Nik Pi

    Nik Pi Well-Known Member Member

    Joined:
    Feb 14, 2022
    Messages:
    54
    Location:
    Kazakhstan
    I think, here is problems with palette. You are sure, that in-game was changed?

    Btw, title screen looks really cool!
     
  19. NayTheGamer

    NayTheGamer Active Member Member

    Joined:
    Sep 30, 2022
    Messages:
    29
    Interesting enough, SonMapEd shows the colours that is used instead of SonLVL's palate like dark green and light green.
     
  20. NayTheGamer

    NayTheGamer Active Member Member

    Joined:
    Sep 30, 2022
    Messages:
    29
    I just went ahead and fixed the palate issue in SonMapEd so we have confirmed that SonMapEd seems to be more accurate at seeing palates.
     
    Nik Pi likes this.