The Mystery of EBX .DAT Files Explained - by Loco-san ----------------------------------------------------- Quick Notes ----------- This is all for Demo 9 and possibly later versions of EBX. Forget about all that old Demo 8 and earlier stuff. Open and edit the .dat files in a plain text editor. Notepad works best. At the end of all your .dat files, make sure there is an extra return/enter space, otherwise you may get errors. When I'm going through the .dat files explaining, you should open up one from EBX or something and follow along. View this file with a fixed-width font if you want to see my terrible diagrams correctly Directory Structure ------------------- If you unzipped EBX correctly, you should get the folders like this: ==================== Ebx\ contains: ebx.exe readme.htm leveldir.dat levels\ ==================== Ebx\levels\ contains: default\ ==================== Ebx\levels\default\ contains: levelXX.dats levelXX\ folders levelseq.dat images\ sounds\ ==================== Inside the levels folder is where you want to put the folder for your own EBX game. So your folder should be along side the default folder. Inside your game folder, you can make more folders, such as one for each level, one for graphics, sound, etc, just like Tomato did, to make it more organized. But it's not necessary. leveldir.dat ------------ Open this up, and there should be a simple line that tells EBX which game to play. It starts pointing to default, which are the EarthboundX levels. Change this to the name of your game folder. Example: "levels\pikachux" levelseq.dat ------------ This one's simple enough. It should be in your game folder. Lets go through it line by line: 1. x.bmp - this is the name of the bitmap for your title screen 2. x.wav - this sound will play at the title screen 3. x.wav - this sound plays when you start the game 4. x.bmp - this picture shows when you beat the game, put your ending/winning screen here 5. x.bmp - this picture shows after the prevoius one, put your credits and contact info here The rest of the lines tell EBX the names of the level .dats, and what order to play them in. So it will probably look like this: level1.dat level2.dat level3.dat etc... Now that's if you named the files that way. You could name them more descriptive names, like this: charmander.dat bulbasaur.dat kabuto.dat pikachu.dat etc... You can even repeat levels if you wish, and do other creative things, like: level1.dat level2.dat level3.dat boss1.dat level4.dat level5.dat level6.dat boss2.dat level7.dat level8.dat level9.dat boss3.dat level10.dat boss1.dat boss2.dat boss3.dat finalboss.dat When testing your levels, you should put the one you're working on first, so you don't have to keep skipping levels, then switch it back when done: level4.dat level1.dat level2.dat level3.dat Level .dats ----------- Lets check out that header line: 1. This is a message to show on the screen before the level starts. You can use it to show your name, a level subtitle, or whatever. Don't make it too long, and keep it on one line. If you don't wish to use this line, put an * at the start of the line. A very important note: Use the underscore _ where there should be a space. It will show in the game as a space, not an underscore, so don't worry. If you forget this, it will most likely crash the game instantly. 2. This is the level title. Same rules as above, expect the * part. Oh yeah, and don't put the level number on either of those lines, because EBX will put it there automatically. 3. x.bmp - this is the name of the bitmap file with all the level graphics, including background, enemies, ball, paddle, etc. 4. x.mid - name of the MIDI file to use as background music on this level 5. x.wav - this sound will play when you beat the level 6. x.wav - this sound plays when you get an extra life (every 20,000 points) 7. x.wav - this sound plays when you lose (game over!) 8. x.wav - this sound is played like 20 times quickly when your score gets added up at the end of the level, make it a very short sound 9. This is an integer for bonus time points. It starts from this number and counts down while playing. Should be around 3000 to 5000 points or so, or more if you want your game easier. 10. This line is/was for future use where you could choose which characters are available to choose for this level. Right now you'll have to leave it as Y N N N So an example of the header would be: -_by_Super_Bob A_Cool_Level level1\coollev.bmp music\mysong.mid sound\youwin.wav sound\kaching.wav sound\gameover.wav sound\beep.wav 5000 Y N N N Enemy Programming ----------------- Alright, finally the good stuff! Lets jump right in to it. BEP means Begin Enemy Program EEP means End Enemy Program The structure for an enemy program looks like this: BEP # Movement commands More Movement commands etc... EEP where # is an ID number for that enemy program script The movement command lines look like this: DIRECTION # # # where the 3 #'s are: how far to move the enemy in that direction, the starting enemy frame to use for animation, and the ending frame to use Say you have an enemy with 8 walking frames, the first 4 face left, the second 4 face right. To make him walk back and forth the program might look like this: BEP 0 RIGHT 200 4 7 LEFT 200 0 3 EEP First of all, notice I indented. That's optional, and you can use as many spaces, tabs, or returns as you wish to make it look nice and readable, or none at all. Okay, BEP 0. I start counting at 0, but it may work if you use any number you want. See, there's 8 different directions to use: UP, DOWN, LEFT, RIGHT, UPRIGHT, DOWNRIGHT, DOWNLEFT, and UPLEFT, as well as STOP. They must be all caps, and spelled just like that. The first number, 200, is the number of units or steps to move. This relates to the enemy speed. If the speed is 1, then he will move 200 pixels. If the speed is 2, then he will move 400, and so on. Okay, now look at the frame numbers. Notice they are numbered 0 through 7 rather than 1 through 8, remember that. So while the enemy is moving right, he will animate using the frames 4 through 7 (that's 4 frames, not 3, count em). It will loop, like 4, 5, 6, 7, 4, 5, 6, 7, etc. Then the enemy moves back left, using the other 4 frames, 0-3. Then the whole script starts over again, right 200, left 200, etc. EEP! Don't forget it, I did a few times! If your enemy only has 1 frame for each direction, just use that frame number for both frames: BEP 1 UP 55 0 0 DOWN 55 1 1 EEP Say you want a stationary enemy, then use STOP: BEP 2 STOP 64 0 3 EEP The first number, it's something like how many frames it stops for. For this purpose, it can be almost any number. But to keep it from skipping (if animating), Tomato says to use a power of 2 number, like 4, 8, 16, 32, 64, etc. Okay, the enemies don't have to be so boring. You can make them move all around the level like crazy in all directions, but it's important to make them return to the exact spot they started. You may need a calculator as I did many times. To make an enemy move in this shape (sorry about the crude drawing): |-----<---- | | v ^ | ----- | | |__>__| Use a program like this: (assuming the enemy has 8 frames, 2 for each direction, in the order of up, down, left, and right) BEP 3 DOWN 100 2 3 RIGHT 50 6 7 UP 50 0 1 RIGHT 50 6 7 UP 50 0 1 LEFT 100 4 5 EEP Got that? Let's see this shape (well I hope you get the idea): /\ / \ / / / / \ / \/ BEP 4 DOWNRIGHT 50 6 7 DOWNLEFT 100 2 3 UPLEFT 50 0 1 UPRIGHT 100 4 5 BEP Here's a tip. Say you want 2 enemies to have the same program, such as the last one, like they are chasing each other. If you assigned that same program to both enemies, they would probably be on top of each other. So what I do is copy the program, change the ID, and just cut the first half or so of the commands, and paste on the bottom: BEP 5 UPLEFT 50 0 1 UPRIGHT 100 4 5 DOWNRIGHT 50 6 7 DOWNLEFT 100 2 3 BEP Then, later when you create your enemies, just change the starting position of the second enemy, by adding and/or subtracting the total amount of the chunk of commands you moved to the bottom. So for this one, lets say the first enemy started at (300, 100), and the enemy speeds are 2. For the X axis, 50 x 2 - 100 x 2 = -100. For Y, 50 x 2 + 100 x 2 = 300. So the starting position for the second enemy is 300-100, 100+300, or (200, 400). Hmmm did that make sense? Lets try a more complex one. This guy will walk down, look back and forth, walk left, stop, then turn around and go back where he started. BEP 6 DOWN 100 2 3 STOP 30 2 3 STOP 30 4 5 STOP 30 6 7 STOP 60 4 5 LEFT 100 4 5 STOP 90 4 5 STOP 10 2 3 STOP 10 6 7 STOP 10 0 1 UPRIGHT 100 0 1 STOP 90 6 7 EEP Enemy Graphics -------------- Okay, now you've programmed the enemies, now you need to create them. First, you have to define the enemy's graphic properties. Use the CIS command for this. CIS = Create Image Set. Lets briefly look at it: CIS [X pos] [Y pos] [width] [height] [frames] [ID number] 1 & 2. X and Y position - These tell EBX where to find the enemy sprite frames in the big level bitmap file that you created. I'll explain "sprites" for you right now, in case you didn't know already. A sprite is just like any 2D graphic in a game, but usually it will have special properties, like animation, movement, transparent edges, etc. Examples of sprites would be the player character, enemies, bullets, etc. In the case of EBX, the paddle, ball, and enemies are obviously sprites. And they are presented in the level bitmap file by all the animation frames side by side, separated by a border of 1 pixel wide. So, back to CIS. The X and Y position are actually the coordinates of the top left corner of the border of the first frame of the enemy sprite. 3 & 4. Width and Height - Width is how many pixels wide your enemy sprite is horizontally, and height is how many pixels tall it is. Remember, all your sprite frames must be the same width and height, and don't include the border when figuring the width and height. 5. Frames - this is just how many frames of animation your enemy sprite has. Right now, there is a limit of 8, but that may change in the future. 6. ID - you need to give this sprite an ID number. Use the numbers 0 through 9, as the max is 10, but that could change... So to create a sprite for a guy I have in my bitmap at (0, 680), who is 24x20 pixels, and 8 frames: CIS 0 680 24 20 8 0 Enemy Creation -------------- Whew, we're almost done. But up until now, with just the BEP and CIS commands, nothing will show up yet. So now we use the ENEMY command to make the enemy, tell it what program script to use, which sprite graphics to use, and what properties it has. Lets check it out: ENEMY [program #] [speed] [ani rate] [HP] [X pos] [Y pos] [image #] Looks simple enough, right? 1. Program number - The ID number of the program script (that you created earlier with the BEP command) that you want this enemy to use. 2. Speed - The movement speed of this enemy. Basically, it's how many pixels to move for each step in the direction commands on the enemy program. So if the speed was 2, and the enemy program had "RIGHT 100", the enemy sprite would actually move 200 pixels (but in 100 frames or steps). 3. Animation rate - It's how many screen updates (frames) each enemy frame is shown on the screen. Since EBX should be running at 60 FPS (Frames Per Second), a rate of 10 would mean animate the enemy at 6 frames per second. It may be confusing at first, but just try some values from 1 to 20, and see the difference. Lower numbers mean animate faster. 4. Hit Points - how many hits until your enemy dies. Weak enemies should be 1 to 3 hits, stronger ones 4-10 or so. Try not to make them too strong, otherwise the game gets boring. 5 & 6. Starting X and Y position - Where the enemy sprite starts on the screen, and then the enemy program takes over and moves it from there. These coordinates are for the upper left corner of the enemy sprite. 7. Image set number - Which enemy sprite to use, created by the CIS command earlier. This is the ID number that you gave on the CIS command for the enemy you want to use. Finishing up ------------ At the end of your level .dat files, put the command END. If you wish, you can put additional comments after the END command, and EBX will ignore them. Additional Tips --------------- Open up any level*.dat file from EarthboundX to see how everything fits together. For practice, try to add your own enemies, or reprogram the ones that are there already. When you make your own games (and I hope you do!), try not to use anything from other people's levels, including graphics, sounds, and enemy programs. Well if you get permission it's okay, but you want each game to have its own theme. It wouldn't make sense to have Earthbound sounds in a Final Fantasy game. Real Quick Graphic Tips ----------------------- This is a big subject, that someone could write a whole text file on, but let me give some quick tips on creating the graphics for EBX levels. EBX uses 8-bit graphics. That means it shows only 256 colors at once. That doesn't mean it's bad, 8-bit graphics can look really good, but only when done well. Even though SNES games use 8-bit graphics, you can still mess up the quality of the images if you don't deal with the palettes well. So, here's my tip for making EBX games. When piecing together your graphics for your EBX game, keep all of the graphics in True Color (24-bit). Then, when you're finally done with the level bitmap, reduce the color depth down to 256 colors. When reducing down to 256 colors, depending on what paint program you use, you'll notice a few options. Make sure you try them, so you can see which way looks better. Because often, the option "dithering" will make the graphics look horrible. But always keep a true color version of the bitmap, in case you need to make changes later. The title screen, and 2 ending screens should be 640x480, 8 bit. The level bitmap is 640 wide, and as tall as you need it, to fit all your enemies. You can pretty much put your enemy sprite frames anywhere you can fit them. Remember to separate each frame by a 1 pixel border. You can use any color you want for that. You'll want your sprites to have transparent edges, rather than a box around them. To do that, their background needs to be color index 0. Usually that's pure black. Then, if you need to use pure black in your sprites, you need to make sure it uses another color number. The best way to do that, is to make it a slightly different black. And if you need to see the edges against the background black, just change color 0 to a bright color temporarily. Adios ----- Written by Loco-san (locosan@yahoo.com) Contact me if there are any problems in here, or you wish to add something. If you need additional help, I may be able to, if I have the time. Thanks ------ Thanks to Tomato, Cake, Tomato, Goemon, Tomato, Goldfish, and Tomato. And also everybody who visits EarthBound.Net and #earthbound on Undernet!