Table of Contents

Creating games

Until the editor is created, this is how to create games.

File Structure

game.ini

[general]
#any text with spaces must be enclosed in ""

#game and author names displayed at start and on CACK game selector
game_name="Demo game" # will default to game folder name if missing
game_author=Woogal # will default to unknown if missing

#custom text to be displayed when exit button is pressed. Will default to
#these values if missing
exit_message="Exit current game?"
exit_yes=Yes
exit_no=No

#initial zone must exist
initial_zone=houseupstairs  
#Optional action to be performed after initial zone is loaded
initial_action="1" # quotes needed so numbers can be read as a string

#Font details. If missing will default back to these settings
font=dejavusans.ttf          
font_size=12
font_style=normal # enclose multiple values in "" (eg, "italic bold")

#Font colour in hex
font_color=0xffffff          

#The text background can also have an alpha channel,
#so the format is RGBA
font_background=0x00000080   

#Text to be displayed on inventory screen
inventory_name=Bag

[video]
#Area size is the size of the zones on the screen. These settings
#will place a 160x120 window in the centre of a 320x240 display.
area_width=160              
area_height=120

#On windows, this changes the size of the window. The gp2x will
#scale the screen size to fit onto the physical screen (eg,
#set the screen size to 160x120 to make all graphics 2x). 
screen_width=320            
screen_height=240          

[sound]
#Default sound to play when using objects. Also plays when an
#object has no action.
default_use_sound=noaction.wav
default_use_volume=70

objects.xml

Everything in CACK is made up of objects. The Hero, all zone tiles, and even inventory items are all objects and should be listed in objects.xml. The Hero is always object 0 unless set in the starting zone ini. The xml isn't checked for errors, so CACK will crash if the xml is incorrect. All attributes should be contained in ” (x=“0” is right, x=0 is wrong), and all tags should be closed (if a tag doesn't contain anything (like walkable) then the tag can be closed like this <walkable/>). All object tags are optional apart from the name.

<object id="7">
  <name>name</name>
  <walkable/>
  <image x="0" y="0">image.png</image>
</object>

Object tags reference (italics = optional attribute)

actions.xml

An action is performed when an object is used or when a trigger is walked over (see Zones below).

<action id="0">
  <sound vol="20">sound.wav</sound>
  <usetext>
    <p>Page 1 of text.</p>
    <p>Page 2 of text.</p>
  </usetext>
  <inventorydel id="40"/>
  <inventoryadd id="41"/>
</action>

Action tags reference (italics = optional attribute)

Zones

Zones can be any size (not tested huge zones do I don't know if there's an upper limit other than memory). Each zone has a .ini and a .map.

.ini

[general]
#width and height of zone in 16x16 pixel blocks
width=30
height=20
#The hero values below are only used if this is a starting zone
#Starting position of the Hero.
hero_x=2
hero_y=2
#object id of the hero.
hero_id=90
#facing direction of the hero (0:right, 1:down, 2:left, 3:up).
#Defaults to 0
hero_dir=3
[sound]
#Background sound. Constantly plays
ambient=zone1.wav
ambient_volume=7

#Background music
music=zone1.ogg
music_volume=50

.map

The maps are a grid of object IDs.

01,01,01,01
01,02,02,01
01,02,02,01
01,01,01,01

The width and height must match the values set in the .ini. After the main map data comes the list of triggers. A trigger is a block on the map which will perform an action if the block is walked on. The trigger list is x,y,action with one trigger per line. Action is either a single action id or a list as with use and doaction above. With any map positioning (triggers, teleports, changes etc.) 0,0 is the top left block.

Graphics

The Hero graphic should contain the Hero facing (from the top) right, down, left, up. The height of every position should be the same (but can be any height) and the width must be 16. The Hero can have 1, 2, 4, 8, or 16 frames of animation. The frames should be placed alongside each other (so if there are 4 frame the final graphic will be 64 pixels wide). The graphic should be something like a png so the background can be transparent.

All other object images can either be seperate files like the Hero, or can be collected together in tilesets. In a tileset, all images should be placed on a 16×16 pixel grid. The Hero is the only image that can have it's base placed over other images, so all object images should make sure they include a background in the base block (eg, a tree trunk should also include the floor in it's base block). Objects taller than 16 pixels can have transparency on the pixels above 16 as these will overlap the blocks above on the map. If the height of an object image is not a multiple of 16, then it's bottom should be aligned on the grid, not it's top. Objects can also have animated tiles, and the animation will loop every second. CACK plays at 30fps, so there can be up to 30 frames of animation. Animation is done in the same way as the Hero, with each frame placed in the tileset to the right of the last.

If separate images are used instead of a tileset, then the height and number of frames are automatically calculated from the width and height of the image and don't need to be entered into objects.xml.