• Rise from your gwave!

Alundra port/clone

Discussion in 'Saturn Dev' started by surixurient, Jul 17, 2014.

  1. surixurient

    surixurient New Member

    I have been working on the beginnings of an Alundra engine for saturn.
    Alundra is a tile-based adventure game for playstation. What sets it apart from others is it is a 3d platformer of sorts but rendered isometrically from the front. I have made an alundra clone engine for windows but this time around I want to use the original content files in their original format, which means i pretty much need to throw out everything i've done previously.

    So far I have been focusing on that content, understanding how to parse it. There is a big file called DATAS.BIN which has the maps,tilesets, sprites,events, string tables, etc.

    This shows a map being read in my investigative tool.

    Currently I am stuck on the event format, so if anyone is interested in joining this project or knows of someone who might be, send them my way and i can give a crash course on the DATAS.BIN file.
  2. vbt

    vbt Staff Member

    nice project !
    does it mean everything is scripted in one or more files and so it needs only a good interpreter to develop ?
  3. surixurient

    surixurient New Member

    Yeah there is bytecode that controls everything from defining sprite animations to launching dialog. I was actually able to get unstuck due to the conditional breakpoints feature of the psxfin emulator which helped a lot. Now I am making progress but it is slow going. ive broken up the event files into 5 sectors which I am still mapping out and identifying what everything represents. After I get most of it accounted for I'll start working out what each bytecode and parameters actually do.
  4. vbt

    vbt Staff Member

    would some help from scummvm masters could be useful ?
  5. surixurient

    surixurient New Member

    I'm starting to figure out the animation but I made a horrible discovery. many of the sprite bitmaps are not byte aligned, ie they are 4 bits per pixel and they start at odd x coordinates or have odd widths. That is kind of a disaster for my plan of using the original content. ill have to rejigger all of the sprite bitmaps and hope it doesn't introduce any new unwanted pixels at the edges.

  6. vbt

    vbt Staff Member

    maybe you have to round width by 8. i had to do that on sega system 1 driver.
  7. surixurient

    surixurient New Member

    yeah ill need to extend widths of sprites to 8. currently i think I have the sprites mostly figured out and am trying to get further on event codes.

    I have identified what i call entities which have a position and other properties. usually they are npcs or monsters or buttons/switches/etc. each entity has 8 strings of event codes. one string is executed on map load, another when you touch the entity, another when you interact with the entity, another on each AI tick, etc. the problem is some entities are having strings of codes executing on them which are not one of their 8 strings, and i cant tell where those codes are coming from. i see them in the files but cant tell how they are being linked to the entities.
  8. surixurient

    surixurient New Member

    I guess sprites are not completely sorted out. there are issues to address with semi transparency and special effects. also there is some more to figure out with reversed sprites. My biggest roadblock is still events though. i can handle set animation, face player, launch dialog, dialog branching, but that's about it so far.

    here is my latest tool state
  9. vbt

    vbt Staff Member

    your tool looks really good :ridinghorse:
  10. surixurient

    surixurient New Member

    I'm making a lot of progress on events now after discovering the logic flow commands. setvariable, if, ifnot, until, and jump. the logic branches and jumps explain where the mystery event codes were coming from, it jumped to them.
  11. surixurient

    surixurient New Member

    I've started on the saturn renderer now.

    unfortunately all of the graphics wont fit in saturn video memory. because I cant use the vdp2 for anything besides cloud shadows and stuff, im stuck with under 512kb of video memory and the psx game uses over 700kb. I'm not sure what ill do at this point, either try to identify and not load unused bitmaps or else load bitmaps on the fly when they are requested (for spells and attacks and stuff)
  12. vbt

    vbt Staff Member

    normally, it should be easier on saturn as PS1 has 1MB of vram and saturn 1,54M. as you display everything as sprite can't you use a part of the VDP1 framebuffer to get enough memory ? the other way is to use more the vdp2 but i guess you'll need more rework
  13. surixurient

    surixurient New Member

    Im not sure how id use part of the framebuffer because you only have enough bits (when drawing a sprite) to specify an address in the 512kb range. I could maybe store extra sprites in the framebuffer and move them to actual vram once i need them which might be faster than moving them from workram? but dont saturn sprites use the framebuffer? i remember reading that they are not traditional sprites which are drawn when the monitor traces.

    There are a few things I can move to vdp2, like sprites i know will always be below everything else like animated water, cloud shadows that are always above everything else, and possibly the inventory menu and items, but I dont think anything else will work because its either maptiles which need to be sorted, or sprite animations and effects. even the font wont work on vdp2 because its variable width characters.
    The issue is that the psx game has way more stored in vram than it's actually going to ever render. But, its hard to say what can safely be left out and when it needs to come back. here is a breakdown of what is in vram:
    -all of the main characters animations and spells(some of which are only used a specific parts of the game or in certain cutscenes, but its always in vram)
    7 256x256 spritesheets
    -inventory graphics
    1 256x256 spritesheet
    -background or shadow graphics
    1 256x256 spritesheet
    -menu and gui graphics
    1 256x256 spritesheet
    -a font area also used as backbuffer for dialog
    1 256x256 area

    those are always in memory

    then for each gamemap/level there are
    0-5 256x256 spritesheets for sprites (usually its just 2, but some maps use all 5)
    6 256x256 sheets for maptiles the last one is usually an 8 frame animated sheet like water

    so its up to 22 4bpp sheets in total
  14. surixurient

    surixurient New Member

    I'm documenting some stuff here in this thread that I can refer to in email communications.

    Event Entities

    • The Red highlighted areas are event objects, they hold event programs which are executed based on criteria. The top group are physical entities which have a map position, the bottom group just hold event programs and do not have a map position.
    • The Green highlighted area are the associated sprite, an index/id to loaded sprite definition. On this map there are only 2 loaded sprites, 19 is not one of them so it must represent something else for those entities, they are a kind of dummy entity which doesn't have a visible sprite.
    • The Blue highlighted area are the entity types. 0,4,8,C are some types. 0 and 4 types do not have sprites in this case, 8 and c types do.

    • The Orange highlighted are their event program IDs, programs which execute under certain conditions (entity activated, entity touched, entity interacted with, every frame, etc)

    Example Event Programs
    These are some event programs
    • Green is a door event program which opens a door and makes it a walkable area when you approach it.
    • Red is an event program to switch the walkability of tiles around an overhanging part of the map (the crows nest of the ship in this case)where sometimes you are on the upper part and sometimes underneath depending on which position-based trigger you hit last.
    • Blue is an event program on an invisible dummy entity which is followed to simulate a camera pan.

    Dummy entities(0-5) related to the overhanging crows nest

    Dummy entity(10) next to the bird used for a camera pan
  15. vbt

    vbt Staff Member

    surixurient, any news about your nice alundra project ?
  16. surixurient

    surixurient New Member

    Well I got sidetracked for a long while playing a certain mmorpg. Now I am back to converting some of the game functions to c code. I am trying to automate as much of the conversion as possible, so im developing a MIPS disassembler and i create symbols for it as i am able to identify them.
  17. mrkotfw

    mrkotfw Member

    Don't copy from VDP1 VRAM to VDP2 VRAM.

    Things are going to have to be a little different than on the PlayStation. You need to decide what needs to be a sprite and what can be considered a background. In other words, whether to use the VDP1 or VDP2.

    I would suggest you keep the font, inventory, shadow, sprite sheets graphics on the VDP1 and the rest on the VDP2. Depending on how many backgrounds you need, you can probably designate a background for the menu. Depending on how many sprites you need on screen at once, you can probably get away with keeping everything in memory. On the Saturn, the commands sent to the VDP1 are stored in memory.

    What library are you using? SGL? SBL?

    As for the sprites being unaligned, that should be fine. If you use the VDP1, you can copy one sprite, then calculate the address for the next sprite to be on a 8x1 (4-BPP) byte boundary (4-byte boundary) by rounding up. That's the smallest a texture can be.

    This way, you can still keep the original data untouched.
  18. Wesker

    Wesker New Member

    How is this going along? Really interested in the possible outcome of such a monumental effort like this. It would certainly be a fantastic game for the Sega Saturn.
  19. SloppyStone

    SloppyStone New Member

    I too, would like to know how this project is doing... I've never owned or played a Sega game but am a huge, HUGE fan of Alundra and this gets me very excited. Been lurking this thread for a year now in shadows.

    DONT give up! Or at the very least, release your awesome tool to the public, lol

Share This Page