Forums

Forums (http://www.abandonia.com/vbullet/index.php)
-   Games Discussion (http://www.abandonia.com/vbullet/forumdisplay.php?f=17)
-   -   Avish (http://www.abandonia.com/vbullet/showthread.php?t=6266)

Unreg. 24-08-2011 10:45 AM

Hey Dvir,

thanks for offering the feedback address. I wrote an email two weeks ago, but I'm not sure whether you check the address anymore. I'd actually like to get in touch with you or Amit about the game. (You can also email me directly, email address is in the text file I'll link to in the next paragraph.)

Anyone: I'm the same person as two posts above, but I never published what I found out about the Avish level format back then. Basically, I know how to make a single level with a hex editor. To make multiple levels, either one must keep all item counts per level the same, or someone must find out how the game decides what portion of resource.dat to read. Here is a thorough description of how a single level is specified:
http://asdfasdf.ethz.ch/~simon/etc/avishformat.txt

-- Simon

sagesag 20-02-2012 02:10 PM

ah. RES file format is dead easy. first 3 bytes is signature ("RES"). the next byte is the number of files (nof) inside RES. then we have nof*4 bytes which indicates the offset of each file inside RES (nof DWORDs). files goes sequentially, so it's easy to calculate file size. that's all.

if we start counting from 0, we have level files starting from 9 and till 82. no 83 is the game palette, btw.

and yes, there should be at least one item on level. how do you suppose to finish the level without a key? (oh, well, actually you CAN, 'cause you can place opened door somewhere %-)

so we can write an editor now? %-)

The Fifth Horseman 20-02-2012 11:10 PM

Hm. Sounds like a plan.
*MAD SCIENTIST THINKING*

SimonN 23-02-2012 12:03 AM

Thanks for the info on the file format!

On first sight, it seems to fit perfectly, with the 4-byte file positions given in little endian. I'll do some more tests these days, and update the format description I've linked to above.

Making an editor... well, we should have everything necessary, now it's a question of devotion and time investment. I'm busy with real life and other programming projects, but should I ever start an editor, then I'll announce it here. (If someone else wants to have a go, I'll surely follow his efforts!)

-- Simon

sagesag 26-02-2012 12:47 AM

res format is correct. i was able to extract all levels and graphics from it (and convert to PNG). the only thing i was too lazy to decode is backfound pictures, so i used my res-builder tool to set all of them as 'title screen' and just did screenshots.

now i have all the graphics from the game and all maps converted to simple text format. i also figured some more info about items (pretty useless if you'll ask me).

here are all the graphics, extracted levels and so on. it's not in ideal state, though (not sorted, some names are just numbers, etc).

i have level viewer for now and i'm seriously thinking about rewriting the game using SDL. the first task is recreating the original game, and then i'll try to add some sort of scripting to allow users creating new items, tile types, etc.

not sure if the original authors are happy with redistributing ripped graphics and such, so grab the file while you can! %-)

sagesag 26-02-2012 01:08 AM

btw, RES file layout is (by index):

0-6: background images for levels (compressed)
7: title image (compressed)
8: uncompressed 320x200 image with main menu
9-82: levels
83: VGA palette (256 colors, RGB, each byte is [0..63])
84: professor sprites
85: foreground tile sprites
86: background tile sprites
87: map 'minitiles'
88: item sprites
89: map 'miniitems'
90: professor sprites for the intermission screen
91: highlighted menu text sprites
92: seems to be bitmap font: 8 bytes per char, 90 chars starting from '!'

sprite files are easy too: each sprite file contains sprites written one after another without gaps.

the sprite format is (all values are little-endian):
2 bytes: sprite height in pixels
2 bytes: sprite width in pixels
then image data follows, height*width bytes, from left to right, from top to bottom. 0xff byte is transparent pixel, all other colors should be taken from palette (index 83 in RES).

sound and music files are the same as RES but with different signatures (MUS and SND).

sound files are just raw unsigned one-channel 8-bit PCM data sampled at 11025 Hz (but the game seems to play it using sample rate 8192).

music files seems to be some AdLib (OPL-2?) data, but i don't want to go thru the mess reading AdLib docs and checking that with emulator.

sagesag 27-02-2012 04:24 PM

ok, i cracked background picture (idx [0..7]) encoding too (so only the music format is left unknown).

here is C source to decode background image:

static void decodeImage (unsigned char *dest, const unsigned char *pkimg, int pksz) {
int pos = 0; // in packed
int opos = 0; // in unpacked
int cpos = 0; // meaningless here (position of colormap)
int csz, idx;
//
while (opos < 320*200 && pos+2 <= pksz) {
csz = pkimg[pos+0];
csz <<= 8;
csz |= pkimg[pos+1];
cpos = (pos += 2); // colormap
pos += 512; // skip colormap
while (opos < 320*200 && pos < pksz && csz > 0) {
idx = pkimg[pos++];
//
dest[opos++] = pkimg[cpos+idx*2+0];
if (opos < 320*200) dest[opos++] = pkimg[cpos+idx*2+1];
--csz;
}
}
}


first you should read image data from RES file (see the RES format in previous posts). pkimg is the buffer with compressed image, pksz is the size of compressed image. then:

unsigned char decodedData[320*200]; // 320x200 pixels, standard VGA screen
...
decodeImage(decodedData, pkimg, pksz);

now, the editor can use resources from the original game. isn't it cool?

sagesag 27-02-2012 08:52 PM

rewriting is progressing good. for now i have a working map renderer and walking professor. animation system is here too. and it is using original RES file (so just throw RESOURCE.RES in and it will work). if "real life" will not stand in my way, i think that in april we'll have playable Windows and GNU/Linux version of Avish (open-sourced, of course). then i'll rewrite the thing to allow external maps with arbitrary sizes, scripted objects and tiles and so on. stay tuned! %-)

btw: music, anybody?

p.s. can't read captcha! five times.

sagesag 08-03-2012 05:25 PM

progress report.
basic game mechanics is here, along with some items. first 2 levels are completable. no sound, no music. no minimap (sorry).

keys:
f12: exit
gray+/gray-: next/prev level
there is no automatic restart after professor is dead (use +/-).
press 'f' when falling to ignore height.
items: only 'key' is working (and you can pick up monster, hehe).

download win32 demo here.
put original RESOURCE.DAT in bin/ and run awish.exe

p.s. i know that i misspelled the title. %-)

p.p.s. sources will be published later.

sagesag 09-03-2012 05:36 PM

if somebody interested... the new engine is Virtual Machine (a-la Another World). VM sources will be published too, so author will not be restricted to existing animations/tile types.


The current time is 11:25 AM (GMT)

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.