Points of Required Attention™
Smaghetti, a new Super Mario Advance 4 editor, is currently in development! Check out the thread HERE!

Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,316,889
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 03-29-24 08:40 AM
Guest: Register | Login

0 users currently in ROM Hacking | 1 guest | 1 bot

Main - ROM Hacking - Making level editor programs? New thread | New reply


CKY-9K
Posted on 07-03-07 10:49 PM Link | Quote | ID: 51968


Pokey
Level: 57

Posts: 56/693
EXP: 1427202
Next: 58726

Since: 06-27-07
From: cKy

Last post: 182 days
Last view: 90 days
Someday I'd like to make a StarTropics level editor.

But the thing I want to know is how. What utilities do I need? How do I program it to edit the ROM like that? Blah blah.

____________________








GuyPerfect
Posted on 07-03-07 11:20 PM Link | Quote | ID: 51971


Paratroopa
Level: 30

Posts: 87/155
EXP: 152257
Next: 13612

Since: 03-14-07

Last post: 6017 days
Last view: 5966 days
Basically, editors just do what you would do, except they are capable of performing all of the tasks in one package.

In B.O.B., I had to do a few things to get a graphical representation of the level. 1) I had a list of pointers referencing where in the ROM file I needed to get data from. 2) I had to decompress the level and its panel definitions. 3) I had to decode the tile graphics and palette data. So if I were to edit all of those things, I'd need to re-encode the tile and palette data, re-compress the level and panel data, insert them into the ROM, then change the pointers accordingly.

A level editor for the game would take care of all those things.
__________

So basically, this is what it boils down to:
* You need to know enough about a game's level format that you would be able to change it to make your own levels. Some games will allow you to edit levels in a hex editor; some will require more effort. But if you have the knowledge of what to do, you can start on a level editor.
* You'll need to program routines to take care of any processes that go into extracting data then inserting it into the ROM. Compression codecs, graphics manipulation, and of course level data itself are all common bits of information that level editors use.
* Level editors aren't very useful without some kind of user interface. It's up to you how to best allow the user to manage the level data once your program can take care of it.

Squash Monster
Posted on 07-03-07 11:31 PM (rev. 2 of 07-03-07 11:34 PM) Link | Quote | ID: 51974


Buster Beetle
Level: 48

Posts: 229/469
EXP: 802648
Next: 20895

Since: 02-22-07
From: New York

Last post: 5669 days
Last view: 5668 days
All you need is knowledge of a programming language and a compiler.

If you haven't programmed before, it might be a good idea to take a class. Otherwise, pick one (popular choices are C and Visual Basic, though I personally recommend Java) and learn it.

Within your language, you need to know how to create a GUI, how to render images (there are DLLs available somewhere that help display graphics from ROMs), and how to read and save files.


Additionally, you will have to know where the data in your game is located and what format it is in. There are lots of ways to find data. The best is using a tracer, but that requires knowledge of assembly programming. A simple method is to use a program called a corrupter to mess up random chunks of a copy of the game until you find one that looks like level data. A more advanced technique is to guess the format without looking for data, then use a hex editor's search feature to find the data that matches your guess.

Once you find the data, you need to figure out the format. This is primarily just logic. However, it helps to know some common things you'll see. Games are typically either stored in an object format or a tile format. Object format means the format will be a series of object IDs with locations, widths, and heights. Tile format means there will be something like one byte per tile of the level, in order. Compression is fairly common, and makes this a lot less simple, but it's also usually really simple. The most common example is RLE, or Run Length Encoding, where a certain tile number is actually a code meaning "use the tile number from the next byte, and then repeat it a number of times equal to byte after that", or any similar method.

The last thing you may want to figure out is where the game keeps its level pointer table. Almost every game has one, and it's not too hard to find. Just take the addresses you found for the start of a few levels and convert them to the game's system's pointer format (look up NES pointers in your case) and then search the ROM for those in order. This'll probably be a list of locations of levels, which is a lot easier than finding every level.

Once you have all this information, make a program that opens the ROM, goes to the location of a level, reads all the information contained there into memory in an easy to work with format*, lets the user fiddle with it via a GUI, and converts the format you use in the editor back into the game's format as it saves.

Don't get discouraged. It's a lot of work, but it's not actually that hard if you stick with it. Start with finding data and learning a programming language, and the rest will look easy.



* A lot of people make the format their program uses the same as the format the game uses. This is rarely a good idea. If the game's format is hard to work with, every function you make to modify it has to deal with the hard format, whereas you'd only have to do it twice if you converted. For a rather visible example, look at EggVine. EggVine deals with objects that take up two different amounts of space. If it didn't convert to an internal format, new levels would have to use the same number of a given size of objects as old ones. But it does convert, so four 5-byte objects can become five 4-byte objects without the user even realizing it.

____________________

CKY-9K
Posted on 07-04-07 12:12 AM Link | Quote | ID: 51983


Pokey
Level: 57

Posts: 57/693
EXP: 1427202
Next: 58726

Since: 06-27-07
From: cKy

Last post: 182 days
Last view: 90 days
I'm good with game maker so... I donno. I could probably somewhat manage it.

____________________








Smallhacker
Posted on 07-04-07 01:18 AM Link | Quote | ID: 51992


Panser
Swedish weirdo times eleven

Level: 42

Posts: 143/339
EXP: 493369
Next: 27993

Since: 02-19-07
From: Stockholm, Sweden

Last post: 5157 days
Last view: 5156 days
Posted by CKY-2K
I'm good with game maker so...


For some reason, I really doubt that that will help.

____________________
SMW Central

GuyPerfect
Posted on 07-04-07 01:49 AM (rev. 2 of 07-04-07 01:50 AM) Link | Quote | ID: 52000


Paratroopa
Level: 30

Posts: 88/155
EXP: 152257
Next: 13612

Since: 03-14-07

Last post: 6017 days
Last view: 5966 days
What Smallhacker really means is that you'd be better off using a language designed to be able to work with file data to this extent. Game Maker is a very specialized language and it will likely not allow you to do what you need to do if you want to make a level editor.

CKY-9K
Posted on 07-04-07 02:39 AM Link | Quote | ID: 52008


Pokey
Level: 57

Posts: 58/693
EXP: 1427202
Next: 58726

Since: 06-27-07
From: cKy

Last post: 182 days
Last view: 90 days
I would be guessing C++ and stuff would be simliar.

____________________








Squash Monster
Posted on 07-04-07 03:50 AM Link | Quote | ID: 52020


Buster Beetle
Level: 48

Posts: 230/469
EXP: 802648
Next: 20895

Since: 02-22-07
From: New York

Last post: 5669 days
Last view: 5668 days
I'm assuming you're using the GML scripting function extensively. If not, then, well. no, they're not really similar enough. If you're using the scripting language, they are similar in that they're programming languages. However, Game Maker does not have proper support for functions and objects. You can get by without objects, but you stand no chance without functional programming.

Start reading a programming language tutorial and see how far you can get. Here is the Java tutorial. If you get through as far as the object portion without getting lost, you can handle it.

____________________

CKY-9K
Posted on 07-04-07 05:02 AM Link | Quote | ID: 52031


Pokey
Level: 57

Posts: 60/693
EXP: 1427202
Next: 58726

Since: 06-27-07
From: cKy

Last post: 182 days
Last view: 90 days
How about Visual Basic?

____________________








Squash Monster
Posted on 07-04-07 05:23 AM (rev. 2 of 07-04-07 05:24 AM) Link | Quote | ID: 52039


Buster Beetle
Level: 48

Posts: 231/469
EXP: 802648
Next: 20895

Since: 02-22-07
From: New York

Last post: 5669 days
Last view: 5668 days
Visual basic gives you a small amount of help laying out your interface and gets rid of the need to understand objects. You still need to know programming in general, including functions.

VB6 is a good enough programming language to do stuff in. I know nothing about VB.net. Either way, you'll either need to pirate or buy the software.

____________________

CKY-9K
Posted on 07-04-07 05:27 AM Link | Quote | ID: 52040


Pokey
Level: 57

Posts: 61/693
EXP: 1427202
Next: 58726

Since: 06-27-07
From: cKy

Last post: 182 days
Last view: 90 days
I did VB last year in school.

____________________








Squash Monster
Posted on 07-04-07 10:04 AM (rev. 2 of 07-04-07 10:04 AM) Link | Quote | ID: 52184


Buster Beetle
Level: 48

Posts: 232/469
EXP: 802648
Next: 20895

Since: 02-22-07
From: New York

Last post: 5669 days
Last view: 5668 days
If you did VB6, then go into the help and find the different file access modes. Read up on the one called Binary.

That's pretty much all you need.

If you did VB.net then hell if I know.

____________________

Stifu
Posted on 07-04-07 10:25 AM Link | Quote | ID: 52189


Cobrat
Level: 56

Posts: 171/666
EXP: 1358245
Next: 39931

Since: 02-22-07

Last post: 657 days
Last view: 279 days
That may not help, but... I'd say that what you really need in the first place, is data/offsets of the concerned game. Obviously, you first need to be able to do manually everything you want the editor to do (like in a hex editor)... The editor is just an automatization of those processes.
Then, on the programming part, it's about learning how to handle and play with bytes...

1337_Ac3
Posted on 07-05-07 01:51 AM (rev. 3 of 07-05-07 01:53 AM) Link | Quote | ID: 52359


Paragoomba
Level: 21

Posts: 61/72
EXP: 47933
Next: 2010

Since: 05-22-07
From: swedun

Last post: 6094 days
Last view: 6071 days
Posted by Squash Monster
Either way, you'll either need to pirate or buy the software.

Wrong. There's VB.net express (just like there's C++.net,C#.net and J#.net express) and it's free. But if you're going to use an express edition you should go with C++.net. I'm not sure what the limitations are, nothing big tho, one of them is that you are bound to the .net framework...

____________________
Python Powered

interdpth
Posted on 07-05-07 05:49 AM Link | Quote | ID: 52416


Buzzy Beetle
Level: 44

Posts: 84/383
EXP: 592337
Next: 18948

Since: 02-22-07

Last post: 4071 days
Last view: 4044 days
If you have a copy of VB

here's a simple test to grab a byte from the rom

make a form with a text box and a command button

we'll assume the textbox is name text1
double click the command button to get to it's command1_click() event

code is
dim thisbyte as byte
open rompath for binary as #1'Open File for input/output

Get #1, offset+1,thisbyte 'Always add a one to your offset it's just how VB does 'it also gets the value
close #1'close the file for output/input
text1.text = hex(thisbyte)'the text for the textbox now because the number you pulled from the ROM

____________________
lawl blog

http://interdpths.blogspot.com/

GuyPerfect
Posted on 07-05-07 07:45 AM (rev. 2 of 07-05-07 07:47 AM) Link | Quote | ID: 52439


Paratroopa
Level: 30

Posts: 89/155
EXP: 152257
Next: 13612

Since: 03-14-07

Last post: 6017 days
Last view: 5966 days
Reading individual bytes from hard disk is very slow. It'd be better to load the whole ROM into memory and read bytes from there.

...

Dim ROMData() As Byte 'Dynamic array for storing ROM data
Dim ROMSize As Double 'For the file's full size
Dim FileNum As Long 'File number... a BASIC thing.

'Get an unused file number, then open the file
FileNum = FreeFile
Open "ROM.rom" For Binary Access Read As FileNum
ROMSize = LoF(FileNum) 'Get the file's size
ReDim ROMData(0 To ROMSize - 1) As Byte 'Allocate memory
Get FileNum, 1, ROMData 'Load the data from file
Close FileNum
...

Once you do things that way, you can pick out individual bytes from the ROM, even using a base index of 0. ROMData(0) is the first byte of the ROM. You can also use hexadecimal offsets with the &H prefix. For example: ROMData(&HF3B48)

Kawa
Posted on 07-05-07 09:29 PM Link | Quote | ID: 52555


CHIKKN NI A BAAZZKIT!!!
80's Cheerilee is best pony
Level: 138

Posts: 393/5344
EXP: 30875617
Next: 787364

Since: 02-20-07
From: The Netherlands

Last post: 4470 days
Last view: 2605 days
Individual bytes might be slow, but I prefer this method myself:
Private Type tItem

sName As String * 14
iItemID As Integer
iPrice As Integer
iSpecial1 As Byte
iSpecial2 As Byte
pDescription As Long
End Type
...and then you just do something like Get #1, ItemOffset + (I * SizeOfOneItem) + 1, myItem.

____________________
Wife make lunch - Shampoo
Opera - give it a spin
Spare some of your free time?
<GreyMaria> I walked around the Lake so many goddamn times that my sex drive was brutally murdered
Kawa rocks — byuu

GuyPerfect
Posted on 07-05-07 10:27 PM Link | Quote | ID: 52565


Paratroopa
Level: 30

Posts: 90/155
EXP: 152257
Next: 13612

Since: 03-14-07

Last post: 6017 days
Last view: 5966 days
That won't work for instances where data is stored big-endian. It's always better to manipulate data manually when it comes to ROM hacking, and having all data in memory is the fastest way to get things done.

Kawa
Posted on 07-06-07 01:38 PM Link | Quote | ID: 52697


CHIKKN NI A BAAZZKIT!!!
80's Cheerilee is best pony
Level: 138

Posts: 394/5344
EXP: 30875617
Next: 787364

Since: 02-20-07
From: The Netherlands

Last post: 4470 days
Last view: 2605 days
Posted by GuyPerfect
That won't work for instances where data is stored big-endian.
Not a problem for me. So far, all editors I made were Windows only and for little-endian systems like the GBA. Maybe later.

____________________
Wife make lunch - Shampoo
Opera - give it a spin
Spare some of your free time?
<GreyMaria> I walked around the Lake so many goddamn times that my sex drive was brutally murdered
Kawa rocks — byuu

Main - ROM Hacking - Making level editor programs? New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.029 seconds. (340KB of memory used)
MySQL - queries: 117, rows: 156/156, time: 0.018 seconds.