Level Editing Astro Trance Levels
_________________________________

Started for AT APR 8
By Jason Earl

	At the moment there is no level editor but I do hope to create one as I really need one to mass produce levels. Anyway here is the level format details.

Sprite Formats:

The AT Engine uses 8 bit sprites, therefore 256 colors. The format used is the same as the one used in GET and PUT for screen 13 and DiectQB. This is stored in an array while the game is running, and in BSAVE (BSV) format on disk. The sprites whole array is simply dumped. BSV files are not pure binary dumps as they do have a 7 byte header. The size of the array needed comparatively to the file size is

bytes = (FileSize - 7) \ 2 - 1

As you may know there is a 4 byte header for the sprite defining the X and Y size of the sprite.

X = SpriteArray(0) / 8 - 1
Y = SpriteArray(1) - 1

This is the way to work out the size of the sprites X and Y size.

In the game the sprites are loaded into one single 64Kb array for each Object Type.

Therefore if my sprite sizes file names are 

Sprite		FileName	Size of File
Number

1		Baddy1    	1024
2		Enemy3    	3000
3		Astro2	  	2053
4		Spiny1    	3067

-Sprite 1 will be loaded at Array (0)
-Sprite 2 will be loaded at Array((Sprite1FileSize - 7) \ 2 - 1)
-Sprite 3 will be loaded at Array(((Sprite1FileSize - 7) \ 2 - 1) + ((Sprite2FileSize - 7) \ 2 - 1))

And So On.

Palette Format
______________

This is just a simple RBG palette. There are two palettes. One for the Backdrop and one for the Main Game. The Backdrop Palette contains 48 colors
so up 48 colors can be used for the backdrop. The palette for the backdrop is the first 48 of 256 colors. The palette can be made importing the backdrop in to Paint Shop Pro and decreasing colors to X colors (under color menu) then type 48 colors. Then try different settings on error diffusion and nearest color. Do not include colors. Then Save the palette.

Colors 48-255 Should be for the main game. You can edit the palette in PSP and save it.

Because the palette format in PSP is not the same as JR do the following things. . . .

1. Open the *.Pal file in notepad or some other text ( or hex ) editor.
2. Remove the header 3 line header
	JASC-PAL
	0100
	256
3. Replace all spaces with commas (,) inbetween the numbers
4. If the palette is for the backdrop divide all numeric numbers by 4 or import the BMP (must be 320x200 in size using 48 first 48 colors of 256 color palette) to BITMAP.BAS file in Tools/Source.Zip file.

Save the file.

As you may gather

1. Keep a backup of your PSP palette so you can change the palette if need so
2. The palette is RRR,GGG,BBB format

Backdrop Format.
________________

This is just a raw BSAVE binary dump

Use the BITMAP.BAS file to read the Bitmap and write a PAL and BIN file.
Or load the bitmap on screen 13 in QB and save 64000 bytes from address A000:0000 Using BSAVE!

Level Format
____________

The Level / Map file is seperated into varios segments / objects types ...

Header Name		What it is used for

Cors			Cordinates header for Scroll and Start X,Y
Scroll			Defines Scroll behaviour
Stars			Defines Star fields
Weapons			Defines Weapon properties
Sound			Defines what Samples are be used from GDM file
Music			Defines Music File and Volume
Bang			Defines Sprites for Weapons and explodions
Power			Defines Where Power Ups are on Map
BackDrop		Defines Backdrop File
Enemy			Defines Enemy Sprites and Behaviour
Back			Defines BackGround Objects and Behavior
Block			Defines Block (wall) Objects and Behavior

The table above shows the different object types.

Cors
____

Layout

X, Y, Energy, Gravity, GForce, Momentum
ScrollXX, ScrollYY
xx1, yy1, xx2, yy2
sxx1, syy1, sxx2, syy2
lefty, righy, upy, downy

Where X is starting X cordinate. Same applies for Y.

Gravity and Gforce defines the amount of gravity there is
This is ideal for Mario type levels with gravity.
- Gforce is pixels to move down (or up if value is negative)
- The frequency in which gravity applies its self

Momentum will define the amount of momentum for when you move

xx1,yy1,xx2,yy2 - this defines the area 'exit game' area. If your ship ends up in this area then then game exits and updates the resume.cfg

sxx1,syy1,sxx2,syy2 - this defines the area you can fly your ship / player

lefty,righty,upy,downy - this defines how fast you ship moves in these directions when you press the arrow keys

