]> git.mxchange.org Git - quix0rs-blobwars.git/blob - doc/hacking
Fix compilation of the mapEditor.
[quix0rs-blobwars.git] / doc / hacking
1 Blob Wars : Metal Blob Solid
2 Copyright (C) 2004-2011 Parallel Realities
3 Copyright (C) 2011-2015 Perpendicular Dimensions
4 Licensed under the GNU General Public License
5
6 Last Updated: August 2015
7
8 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9 +++ Contents
10 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11
12 1) Introduction
13 2) The PAK File
14 3) The FileData Object
15 4) The Map File
16 5) Map Entites
17 6) Other Files
18 7) FAQ
19 8) Closing comments
20
21
22 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 +++ Introduction
24 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25
26 Contained within are pieces of information to do with the game, the map structure
27 and the structure of the pak file that is used in BW:MBS. I have created this
28 document for educational purposes.
29
30 This document is completely unsupported.
31
32 Thank you in advance for understanding.
33
34 To build the game without needing to recreate the PAK file each time to can 
35 build using the following command,
36
37 make USEPAK=0
38
39 The binary created will load files from the directory it resides within (so it
40 will look for data, sound, gfx and music in the local dir). When building the
41 game without using the PAK file you will get debug information to the console
42 and an FPS counter. You may also use the following additional command line
43 options,
44
45 -map <filename> Start the game using the specified map
46
47 -skill <skill level> Start the game using the specified skill (0, 1, 2, 3)
48
49 -showsprites Show the sprites that have been loaded. Use in conjunction with
50                          a map file for best results
51                          
52 -hub Jump directory to the hub. Will automatically load the first available game
53
54 -randomscreens Takes random screenshots and dumps them into a directory called
55                            screenshots. You might not want to use this(!)
56                            
57 -nomonsters        Does not add monsters to levels (does not affect Boss missions)
58
59 -credits           Show the credits
60
61 Stephen Sweeney
62
63
64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
65 +++ The PAK File
66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
67
68 The PAK file used in BW:MBS differs from the one used in Project: Starfighter where
69 as it is compressed and contains a lot more metadata making it a lot more effecient.
70 The format is as follows,
71
72 NB: All binary data is little endian
73
74 <variable length data> (char)
75 <varibale number of binary strutures> (FileData)
76 <offset of FileData structures> (unsigned long)
77 <number of file data structures in archive> (unsigned long)
78
79 BW:MBS will open the pak file, seek to the end, two back two unsigned longs and read
80 them. It then have information regarding the file structure and can read in all the
81 FileData objects that exist. These are stored in memory for the duration of the 
82 program and stepped through when a file needs to be loaded from the PAK.
83
84
85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
86 +++ The FileData Object 
87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
88
89 The FileData object holds the metadata for each file in the PAK archive. The object
90 itself has the following format,
91
92 NB: All binary data is little endian
93
94 char filename[60];
95 uLongf cSize;
96 uLongf fSize;
97 uLongf location;
98
99 Filename is the filename of the file (including the path). It is limited to 56 characters
100 since it is loosely based on the original PAK file spec for Quake. This could obviously
101 be changed if more characters were required.
102
103 cSize is the compressed size of the data. All the data in the PAK file is compressed using
104 zlib compress at a strength of 9. This number is used to tell uncompress how much data there
105 is and also used by CPak.cpp when loading the data from the pak file into a buffer in
106 memory.
107
108 fSize is the full uncompressed size of the data. This is used by uncompress and also when
109 allocating a memory buffer save uncompress the data into.
110
111 location is the offset of the data within the PAK archive. When a match for the filename
112 has been found in stepping through the filedata array, the PAK file is opened and then
113 seeked to the appropriate location. The appropriate amount of data is then read.
114
115 When working with big endian machines it is neccessary to convert the values in the FileData
116 object o little endian so they may of proper use.
117
118
119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
120 +++ The Map Files
121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
122
123 The maps are BW:MBS are plain text. They contain the data for the map, the objectives,
124 enemies, doors, and pretty much everything else you see during the game. Sprites and
125 new enemies can also be configured within the map data.
126
127 The map data beings with a large set of numbers. 400 columns and 300 rows allowing for
128 very large maps. This, in hindsight, was overkill. But the reason this was because the
129 map blocks used to be 16 x 16 pixels whilst they are now 32 x 32 pixels. After these
130 rows the entity data starts.
131
132 The map entities take the following format,
133
134 <skilllevel> <entityname> <entity arguments>
135
136 Skill level is required and should contain a combination of E, M or H to represent
137 whether that entity should appear on Easy Medium or Hard. Pretty much all the entities
138 appear on Hard. For example,
139
140 MH ENEMY "SpiderBlob V1.0" 1000 1000
141
142 This will place a Spider Blob enemy at 1000, 1000 on the map on difficulities Medium
143 and Hard, but not Easy.
144
145 Comments can be represented with C++ still slashes,
146
147 // here is a comment
148
149 Note: Bosses are hard coded. They do not live in the map data.
150
151
152 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
153 +++ Map Entities
154 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
155
156 STAGENAME <"stagename">
157
158 The stage name of the map. Must have within quotes.
159
160
161 BACKGROUND <filename>
162
163 The filename of the background to be used in this level.
164
165
166 MUSIC <filename>
167
168 The music to be used in this level.
169
170
171 TILESET <path>
172
173 The path to the tiles to be used in this level.
174
175
176 REQUIRED_MIAS <initial number to rescue>
177
178 The initial number of MIAs required to complete the stage.
179
180
181 MIA <"name"> <x> <y> <type>
182
183 Defines an MIA for this level. The type of MIA is either MIA_NORMAL or MIA_AQUA
184
185
186 START <x> <y>
187
188 Determines where Bob will initially start on this level. Ignored when returning to a
189 level.
190
191
192 CLIPPING <x1> <x2> <y1> <y2>
193
194 Determines the scroll limit for the map. The map will not scroll further than the 
195 specified coordinates.
196
197
198 AMBIENCE <sound file>
199
200 The sound effect that will be played in the background to represent the ambient sound
201 in the level (like the bubbling sound in the Caves levels).
202
203
204 ALPHATILES <variable length list>
205
206 Tile numbers that should be made transparent. Ideally this should have been in the tileset
207 directory. Numbers should be seperated by spaces with -1 to determine the end of the list.
208
209
210 OBJECTIVE <"description"> <"target"> <requiredAmount> <optional>
211
212 Defines an objective for the level.
213
214
215 ITEM <type> <"name"> <x> <y> <sprite>
216
217 Creates an item of given type, name and sprite at the given coordinates. Types 0 - 4 are
218 used for weapons. 5 - 7 for cherries and 8 - 14 for points pods. Types 100 and 101 are items
219 that can be picked up and carried in the inventory. Items are type 101 are not shown in
220 the inventory (for example, Crystals and Cherry Plants).
221
222
223 ENEMY <"name"> <x> <y>
224
225 Places the specified enemy (via their name) at the specified coordinates.
226
227
228 SPAWN_POINT <name> <x> <y> <type> <subtype> <min wait> <max wait> <active / inactive>
229
230 Used to spawn an item / entity at a random interval. For example, the lava balls that jump
231 out of the lava in Inner Cave Network, Part 1 are spawned by having a type of SPW_HAZARD
232 and a subtype of HAZARD_LAVABALL. They appear every 1 to 10 seconds. The type and subtype
233 are dealt with in defines.h and processed in spawnPoints.cpp. x and y coordinates are also
234 supplied to tell the game where the item should be spawned. The only exception to the rule
235 are enemies. They have an x and y as -1 and -1 since they simply teleport in around the 
236 player's location.
237
238
239 TELEPORTER <name> <x> <y> <destination x> <destination y> <on / off>
240
241 Simply sets up a teleporter with an origin and a destination. Can be on or off by default.
242
243
244 LINEDEF <"type"> <related object> <"message"> <x> <y> <width> <height> <active / inactive>
245
246 Sets up a line that is actived when the player crosses it. Common types can be of "Checkpoint", 
247 "Message, "Exit". "Exit" will prevent the player from crossing until it is the last required
248 objective remaining on the level.
249
250
251 SWITCH <"name"> <target object> <required item> <"message"> <switch type> <x> <y> <active / inactive>
252
253 Creates a switch that can be triggered by the player (or other entities depending on the type)
254 to toggle activate an object. Possible switch types are, 
255
256 SWT_NORMAL 
257 SWT_TOGGLE
258 SWT_TIMED
259 SWT_PRESSURE
260 SWT_RESET 
261 and SWT_WATERLEVEL. 
262
263 Note that for switches that reset Obstacles the obstacle name should
264 be placed into the "message". SWT_RESET switches are timed by default. Also, SWT_NORMALs become SWT_USEDs
265 when they are activated. This is to aid in the persistence of the level.
266
267
268 TRAIN <name> <start x> <start y> <end x> <end y> <wait time> <start location> <active / inactive>
269
270 Creates a train (a moving platform) with start and end locations as specified. The wait time states
271 how long the platform will wait (in 60ths of a second) at each end before changing direction. Start
272 location specifies which end the train will start at (either TR_AT_START or TR_AT_END). Note that
273 end locations must be the same value as or greater values than the start locations.
274
275
276 DOOR <"name"> <type> <open x> <open y> <closed x> <close y> <open / closed>
277
278 Creates a door with the specified open and close coordinates. Available door types are,
279
280 TR_DOOR
281 TR_LOCKED_DOOR
282 TR_GOLD_DOOR
283 TR_SILVER_DOOR
284 TR_BRONZE_DOOR
285 TR_SLIDEDOOR
286 TR_LOCKED_SLIDEDOOR
287 TR_GOLD_SLIDEDOOR
288 TR_SILVER_SLIDEDOOR
289 TR_BRONZE_SLIDEDOOR
290
291 As their names suggest the doors are either normal doors, locked or require a certain key to 
292 open them. Locked doors can be in conjunction with switches and other triggers in order to make
293 them open. Like trains, the closed x and y coordinates much be greater than or equal in value to
294 the open coordinates.
295
296
297 OBSTACLE <"name"> <x> <y> <sprite>
298
299 Sets up an obstacle with the given name and sprite than can be pushed. The name of the obstacle
300 can be used in conjunction with reset type switches to return them to their original location.
301
302
303 TRAP <name> <type> <damage> <speed> <startX> <startY> <endX> <endY> <wait1> <wait2> <sprite> <active>
304
305 Creates a trap in the location specified by start X and start Y. For traps such as the swinging ball
306 and spikes, the end X and end Y specifies the second location to move to. Wait 1 and Wait 2 tell
307 the trap how long to wait for each state (the energy beams have off and on times for example). Trap
308 types available are,
309
310 TRAP_TYPE_SPIKE
311 TRAP_TYPE_MINE
312 TRAP_TYPE_SWING
313 TRAP_TYPE_CRUSHER
314 TRAP_TYPE_BARRIER
315 TRAP_TYPE_FLAME
316
317
318 SPAWNABLE_ENEMY <"name">
319
320 Only ten of these may be defined. Used with enemy spawn points this list details which enemies
321 can be spawned on the map.
322
323
324 SPRITE <name> <frame name> <wait time> * 8
325
326 Can be used to define a new sprite to be used specifically on this level. It supports up
327 to 8 frames and wait times. When there are no more frames to be read, @none@ -1 is used
328 to denote no more reading it required.
329
330
331 DEFENEMY <"name"> <left sprite> <right sprite> <death sprite> <"weapon name"> <health> <score> <flags>
332
333 Create an enemy. Flags should be from the ENT_* flags are defined in defines.h
334
335
336 WATER_LEVEL <level>
337
338 Specifies the water level within the level. Use in conjunction with water level switches to 
339 raise the water level
340
341
342 TIME_LIMIT <minutes> <seconds>
343
344 The time limit for this level when playing on Extreme Mode.
345
346
347 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
348 +++ FAQ
349 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
350
351 Q.      Can you give me some help modifying the source?
352
353 A.      Unfortunately I have other commitments, mainly in the real world, that would prevent me
354         from setting aside the time the do so. In the time I do have spare I prefer to work on
355         new projects.
356         
357
358 Q.      Why package up all the data into one file instead of leaving it loose?
359
360 A.      Three reasons - 1) It takes up less room on disc ; 2) It's easier to deal with one large
361         data file rather than lots of file scattered all over the place ; 3) It stops people 
362         digging around in the data and potentially spoiling the game for themselves.
363         
364
365 Q.      How long did the game take to make?
366
367 A.      About 18 months from beginning to end.
368
369
370 Q.      Why did so much change during the game, like the saves becoming incompatible around 0.91?
371
372 A.      Metal Blob Solid was very much a make-it-up-as-you-go-along game. It was only decided later
373         on that the levels should be kept within a persistant state so as to not force the player
374         to reopen doors, redo puzzles, etc. This in itself was a bit of a headache and due to a
375         small cockup when creating the persistance data the game would crash if you returned to a
376         previous level, left, saved, quit the game and reloaded.
377         
378
379 Q.      Why can't you see all the game or fight the bosses on Easy?
380
381 A.      It's easy mode(!) The bosses aren't exactly a walk in the park and bits of the game (such as
382         battling Galdov for the Reality Crystal) are part of the game's plot. Because on Easy there
383         is nothing to do except rescue MIAs, it was decided that you should get an ending, but not
384         *the* ending after finishing the game on Easy. Also, a hell of a lot of work went into the
385         bosses, other objectives, cutscenes, etc so it also has to do with appreciation.
386         
387
388 Q.      Are there any secrets in the game?
389
390 A.      No. If you finish the game on Normal or Hard you see everything the game has to offer.
391         Although you do unlock Extreme mode which is the whole game again but with a time limit on
392         each mission.
393         
394
395 Q.      Are you going to make any other games?
396
397 A.      There are plans, but nothing set in stone. Again, real life commitments can change
398         everything.
399         
400
401 Q.      Will there be a sequel to Metal Blob Solid?
402
403 A.      See above.
404         
405
406 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
407 +++ Closing Comments
408 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
409
410 Metal Blob Solid was fun to make more often than not. There was some hair pulling and
411 frustation involved in making the game, but that's natural in any project. In the end
412 I grew quite fond of the bandana wearing Blob and decided to give his adventure more
413 meaning, which was why the plot suddenly appeared, along with the bosses and cutscenes.
414
415 I hope you've all enjoyed playing the game and I hope to bring you some more games in the
416 future.
417