News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Editroid Thread

Started by snarfblam, July 27, 2009, 09:44:57 PM

Previous topic - Next topic

Flpjack

#75
Thanks for the information once again. Learning ASM is not an option for me. I have minimal programming experience. Below are a few images that may help the trouble shooting.

How difficult would it be for someone with ASM experience to duplicate an enemy and make some variable changes? I know behavior changes are harder, but I was thinking maybe we could modify some HP and speed variables or double some sizes of normal monsters to make mini-bosses of sorts...

In this first one, I did a Brinstar to Brinstar elevator as you enter the orange zone. I made both elevators the down Brinstar>Brinstar and I can go up and down. It seems to work but it tends to do some funky things with the "creepy music". Would you recommend me taking the elevator out due to potential bugs?
http://i.imgur.com/mqYH7If.jpg

Here is my door issue I tried to explain. In this next image is the area from the editor:
http://i.imgur.com/o4pThMm.jpg

And in this final image, it shows what happens when I go through the door on the bottom right:
http://i.imgur.com/TfrZDMM.jpg

The room I'm put in was initially seemingly random, choosing from all manner of original Metroid Brinstar rooms. I began to delete them one by one until I was left with one I could not delete, which is the one you see with the blue Brinstar ground (originally the palette swap tunnel in Brinstar, I believe). I had a similar issue with the orange area I made (below the elevator I showed you) but it seems to have just disappeared. I can't tell what I do to fix this other than ignore it and come back to it later, at which point it seems to find a new door to mess with.

If I don't add doors to door frames in an effort to offset doors, will that screw things up?

snarfblam

I've never seen this problem before. I'm really not sure what's happening there. If you want, I can take a look at the hack and see what's going on.

As for doors without door bubbles, if you try it, you'll notice that horizontally scrolling areas will keep scrolling into the next room before you enter the door. The bubble tells the game where the room ends.

Flpjack

#77
^Yeah, it seemed to hop around where it would do this and where it would put me. As I began to delete old rooms it was dumping me in, it stopped switching what rooms did it and what rooms didn't. It seems to only effect the lower-ish and left side Brinstar rooms. I've created a fair amount of Norfair and Kraid's lair but I haven't seen any the bug yet. See attached for my work. Test lower rooms in my wastelands (orange tiles) and the caves (blue bubbly tiles).

I was thinking maybe I put Brinstar too low and ran into some kind of issue there, but you can find levels where rooms that are horizontal from each other work and don't work.

snarfblam

If you want to attach a hack to a forum post, make sure to do it in the form of an IPS patch. You know, copyrights and whatnot.

As for the whole wrong room loading issue, this might shed some light:

Quote from: passarbye on May 10, 2012, 07:44:53 PM
so is there any limit to how many rooms we can make?

Quote from: snarfblam on May 11, 2012, 07:21:14 PM
128 per level, or until you run out of free space. Whichever comes first.

Editroid will allow you to add as many rooms as you like, but if you go over 128 you'll start running into these problems, and if you go over 256 things will go terribly, horribly, tragically wrong.

Flpjack

Sorry for not uploading in the correct format.

When you say level, you mean Brinstar, Kraid's lair, Norfair, etc? I notice my issue hasn't effected Kraid's lair or Norfair yet. How does it count to 128 rooms? Do duplicate rooms count as one or does each instance count? Is my issue because I'm past 128 or because I'm past 256?

snarfblam

Yeah, I guess most people call those "areas." I call them "levels." Wanna fight about it?

You can have up to 128 unique rooms in each area (numbered in hex from 00 to 7F).
[spoiler=Room number][/spoiler]

Each of these rooms may be repeated on the map as many times as you like.

Flpjack

OK, to be perfectly clear, I can have 500 of the same duplicated room, and it still counts as 1 to this 128 limit?

Also, I think the best term is "zone". :)

snarfblam


Flpjack

OK, thanks for the information. That will help, but it's still frustrating to work with that limitation.

Any other advice on my map?

Qactis

Pretty sure 128 rooms in each area is already WAYYYY more than any existing nestroid game has. Don't see the reason for your frustration

Flpjack

#85
Because it's a limitation. If this game was built today, they would make 129 rooms if they wanted. I hit around 190 before I knew about this limitation in Brinstar, so that means I have to do a lot of editing, hence, frustration.

Edit: Another question: The little circular things that lob the little balls in an arc in Norfair. I put the ball enemy where it looks like it should go, but the collide with the circular base. If I adjust the enemy any direction, it's offset pretty badly. How do I get those to work?

snarfblam


So, here is a new version of my Metroid editor. This version allows you to add ASM to each screen that will run when the screen loads. It includes a built-in assembler so you can do everything right in Editroid.

This makes it easy to do things like bankswap graphics for different sections of an area or change music for different sections, or to load additional objects into the screen based on a condition, or change the lava height in different screens so it doesn't have to be right at the bottom in every screen. So yeah... all sorts of stuff.

This is an alpha version, meaning everything is implemented and works, but hasn't been tested and debugged too thoroughly, but I've been using it without any problems. (Except the one incident, but we won't talk about that.)

Before you start adding ASM, the ROM needs to be expanded (under the file menu), and then you can click "Create Project" in the project menu. Then, everything ASM-related can be found in the project menu.

http://snarfblam.com/files/Editroid 3.5a.zip

This is what it looks like:
[spoiler][/spoiler]

And here are some code examples.
[spoiler=Graphics bank swap]
; Switch bg to CHR bank 9

lda #$09
sta $7801
sta $7802
sta $7803
rts
[/spoiler]

[spoiler=Change music];Play Tourian theme (simple :)
jmp TourianMusic
;(You can insert a different song in its place to allow two songs in an area)
[/spoiler]

[spoiler=Change layout based on player status]; Draw an object on the screen if the player has at least 1 full e-tank
; (Requires the code below to be added to the general code file)

; Exit if player doesn't have any full tanks
lda HealthHi
and #$F0
bne 
    rts   
*

; Load ptr to data and draw it
ldx #<ObjectData
ldy #>ObjectData
jmp ExtraRoomData
   

ObjectData:
;    xy  type pal  end
.db $88, $08, $01, $FF
[/spoiler]

[spoiler=Needed for above routine]; This is required by the above example.
; This would be placed in the general code file.

; ----------------------------
;  ExtraRoomData
; ----------------------------
;  Draws additional objects to a screen. Call in screen-load
;  routine. This is a modified version of a similar routine in
;  the original game.
;     Parameters:
;     x - low byte of object data
;     y - high byte of object data

    ExtraRoomData:
                stx RoomPtr                             ; Store data address
                sty RoomPtr   1
                ldy #$00                                ; Point to first byte
                lda (RoomPtr),Y                         ; Read it

    DrawExtraObject:
                sta $0E                         ;Store object position byte(%yyyyxxxx).
                lda CartRAMPtr                  ;
                sta CartRAMWorkPtr              ;Set the working pointer equal to the room pointer-->
                lda CartRAMPtr 1                ;(start at beginning of the room).
                sta CartRAMWorkPtr 1            ;
                lda $0E                         ;Reload object position byte.
                jsr Adiv16                      ;($C2BF)/16. Lower nibble contains object y position.-->
                tax                             ;Transfer it to X, prepare for loop.
                beq                             ;Skip y position calculation loop as y position=0 and-->
                                                ;does not need to be calculated.
         *      lda CartRAMWorkPtr              ;LoW byte of pointer working in room RAM.
                clc                             ;
                adc #$40                        ;Advance two rows in room RAM(one y unit).
                sta CartRAMWorkPtr              ;
                bcc                             ;If carry occurred, increment high byte of pointer-->
                inc CartRAMWorkPtr 1            ;in room RAM.
         *      dex                             ;
                bne --                          ;Repeat until at desired y position(X=0).
               
         *      lda $0E                         ;Reload object position byte.
                and #$0F                        ;Remove y position upper nibble.
                asl                             ;Each x unit is 2 tiles.
                adc CartRAMWorkPtr              ;
                sta CartRAMWorkPtr              ;Add x position to room RAM work pointer.
                bcc                             ;If carry occurred, increment high byte of room RAM work-->
                inc CartRAMWorkPtr 1            ;pointer, else branch to draw object.

    ;CartRAMWorkPtr now points to the object's starting location (upper left corner)
    ;on the room RAM which will eventually be loaded into a name table.
               
          *     iny                             ;Move to the next byte of room data which is-->
                lda (RoomPtr),y                 ;the index into the structure pointer table.
                tax                             ;Transfer structure pointer index into X.
                iny                             ;Move to the next byte of room data which is-->
                lda (RoomPtr),y                 ;the attrib table info for the structure.
                sta ObjectPal                   ;Save attribute table info.
                txa                             ;Restore structure pointer to A.
                asl                             ;*2. Structure pointers are two bytes in size.
                tay                             ;
                lda (StructPtrTable),y          ;Low byte of 16-bit structure ptr.
                sta StructPtr                   ;
                iny                             ;
                lda (StructPtrTable),y          ;High byte of 16-bit structure ptr.
                sta StructPtr 1                 ;
                jsr DrawStruct                  ;($EF8C)Draw one structure.

    ; Next Object
                lda #$03                        ;Move to next set of structure data.
                jsr AddToRoomPtr                ;($EAC0)Add A to room data pointer.
                ldy #$00                        ;Zero index.
                lda (RoomPtr),y                 ;Load byte of room data.-->
                cmp #$FF                        ;Is it #$FF(end-of-room)?-->
                beq                             ;If so, branch to exit.
                jmp DrawExtraObject
              * rts
[/spoiler]

Quietus

I must say, snarfblam, while the original Metroid is not my thing, your work and dedication are exemplary. :^_^:

Quote58

Quote from: Quietus on June 11, 2013, 04:37:36 AM
I must say, snarfblam, while the original Metroid is not my thing, your work and dedication are exemplary. :^_^:
Exactly this. Editroid kind of makes me wish I hacked nestroid (and liked the original enough to do so)

DemickXII

#89
S to the I C K! The assembly add-on is going to be off the wall! It's good to see you've been up to stuff. I was afraid that 3.0 was going to be as far as you would take it, but once again I am pleasantly surprised. Keep it up, snarfblam.

xorxif

This motivates me. Appreciate the work!

Any chance of the user manual being updated / detailed?

snarfblam

I appreciate the positive reception. This was actually motivated by the needs of my hack, so this update also means progress on that front. I intend to add more ASM-related features too. I'm thinking of making it so extra ASM can be loaded into RAM, since the main program bank has virtually no free space in it (I did this in my saving hack and it worked like a treat). I'll also probably post more code samples to help others make the most of the built-in assembler.

I should note, too, that some features slipped in by accident. The title screen editor is not 100% complete and is a little buggy. The tile re-arranger also has a big bug in it, as well as some potential gotchas that should be understood before using it. I'd recommend staying away from those two tools. They'll probably be fixed in the next update.

Quote from: xorxif on June 13, 2013, 05:17:20 PM
Any chance of the user manual being updated / detailed?
Well, I'm happy to answer questions here or on IRC. If there's any particular topic that you feel warrants an in-depth explanation, I'll be glad to write it up. You can also check on my site (http://snarfblam.com/words/?tag=editroid) to see if I've already written about it.

snarfblam

So, one of the challenges of hacking Metroid is that there is so little free space in the fixed bank. You can put code in another bank, but then you have to deal with the fact that sometimes it's there and sometimes it isn't. What I did for my saving hack was have it copy some of the new code into RAM so that it's always accessible no matter which bank is loaded. I made a generic version of this that can be added to any hack. It lets you add $600 bytes (1.5 KB) of new code/data/variables.

For the time being, this can be inserted at the end of the general code file. In the future, hopefully you'll be able to add additional ASM files, in which case this could go in it's own file.

[spoiler=CODE]; -----------------------------------------
; Metroid RAM Hack - NEW CODE
; -----------------------------------------

    .PATCH 0e:9400
    .base $7900
    MRH_NEW_CODE:
   
    ; Place your new code/data here!
    ; |
    ; V

    ; RIGHT HERE

    ; ^
    ; |
    ; Since this is RAM, you can also declare variables here!
    ; varname: .DSB 1           ; Declare 8-bit variable named "varname"
    ; varname: .DSW 1           ; Declare 16-bit variable named "varname"
    ; memblock: .DSB N          ; Declare block of RAM with N bytes named "memblock"
    MRH_END_NEW_CODE:

; -----------------------------------------
; Metroid RAM Hack - Copy to RAM
; -----------------------------------------
; Allows usage of RAM to store extra ASM
; that can be used no matter which bank is
; loaded.
   
   
    MRH_RAM     :=  $7900               ; Address in RAM that code/data will be copied to
    MRH_ROM     :=  $9400               ; Address in ROM that code/data will be copied from
    MRH_Size    =   $06                 ; Number of pages of code/data to copy (1 page = $100 bytes)

    .if (<MRH_RAM) != $00
        .error Metroid RAM Hack requires RAM location (MRH_RAM) to begin on a $100 byte boundary
    .endif
    .if ((MRH_END_NEW_CODE - MRH_NEW_CODE) > (MRH_Size * $0100))
        .error Metroid RAM Hack new code exceeded allocated size (MRH_Size)
    .endif


    .PATCH 00:A960
    ; Free space: $A961 - $ABFF
    MRH_Hijack_Section:
    MRH_Hijack_Section_Limit = $ABFF
   
    MRH_Hijack:
        ; From "CopyMap" in the title bank, this code overwrites the RTS and following unused bytes
        ; Trampolines to MRH_CopyToRAM in bank E
        lda #>(MRH_CopyToRAM - 1)
        pha
        lda #<(MRH_CopyToRAM - 1)
        pha
        ldy #$0E
        jmp RomSwitch
       
    ; Feel free to put additional ASM here, but be aware
    ; that it will only be accessible when the title-screen/
    ; game-over/credits bank is loaded.
       
    MRH_Hijack_Section_End:
    .if MRH_Hijack_Section_End > MRH_Hijack_Section_Limit
        .error CODE EXCEEDED MAX SIZE: Metroid RAM Hack Hijack Section
    .endif
   
   
    .PATCH 0e:9000
    MRH_CopyToRAM:
        ; Pointer to data in ROM to copy
        lda #<MRH_ROM
        sta $00
        lda #>MRH_ROM
        sta $01
       
        ; Pointer to RAM it will be copied to
        lda #<MRH_RAM
        sta $02
        lda #>MRH_RAM
        sta $03
       
        ; Copy 6 blocks of $100 bytes
        ldx #$06
       
        *
            ; Copy $100 bytes
            ldy #$00
            *
                lda ($00),Y
                sta ($02),Y
                iny
            bne -
           
            ; Advance each pointer by $100
            inc $01
            inc $03
           
            dex
        bne --
       

    ; We now return you to your normal intialization routine
    ldy #$00
    jmp RomSwitch           ; RomSwitch will RTS to the routine that called MRH_Hijack
[/spoiler]

Vismund Cygnus

The amount of work you do on this editor makes me wish I played Metroid enough to want to hack it. Kudos to you. It's great to see someone here doing something productive  :heheh:
Please nobody kill me for that remark :(

Quietus

I would imagine that most people here would consider the work they're doing on their hack to be productive. :O_o:

Vismund Cygnus

It seems my poor sense of humour doesn't translate well over the Internet. Sorry to anyone who is offended when they read that...

Quietus

It's not really a problem.  It's just that 95% of a hack is created behind the scenes, and constantly showing screenshots and videos would ruin a lot of the excitement when a hack is released.  Take Z-Factor as an example.  For a lot of people, it just popped up one day.  A fully-formed, excellent hack just materialised.  Happy days! :grin:

Grimlock

Great to drop in and find the great news that the editor has been updated.  If you can get the tittle screen editor working then I'll be able to finish my mod.  That is pretty much all I lack.

Thanks for all your hard work!

The Monster of Surrealton

How do I use Test Room? It just asks me what I want to open it with.

snarfblam

This will probably change in the future, but for now Test Room launches the default program associated with .NES files. It can be a pain if you don't already have a file association set up for NES ROMs.