Alter Ego

Use this forum to share and discuss Uzebox games and demos.
User avatar
uze6666
Site Admin
Posts: 4449
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Alter Ego

Post by uze6666 » Sun May 10, 2015 10:44 pm

Does Uzeamp plays the songs ok?

Can you try setting the bootloader in game start first then cycle the power to see what happens?

phiber
Posts: 3
Joined: Sun May 10, 2015 3:22 am

Re: Alter Ego

Post by phiber » Mon May 11, 2015 5:57 am

Yes, 0.
D3thAdd3r wrote:I will check on this when I get home tomorrow, but I might need help verifying as I gave away my 256mB card. Which error number are you getting, 0?

phiber
Posts: 3
Joined: Sun May 10, 2015 3:22 am

Re: Alter Ego

Post by phiber » Mon May 11, 2015 6:03 am

Yes, Uzeamp plays just fine.

Interesting! I did what you suggested setting boot to game, and it still gives the same "SD ERROR: 0" at
first, then it pauses, clears the screen, and the game starts! Very odd. With boot set to menu, it just gives the
error and goes back to the main menu.

So it would appear the game can be made to work, despite the error.

Thanks,
Mark

uze6666 wrote:Does Uzeamp plays the songs ok?

Can you try setting the bootloader in game start first then cycle the power to see what happens?

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Alter Ego

Post by D3thAdd3r » Mon May 11, 2015 6:47 am

phiber wrote: I did what you suggested setting boot to game, and it still gives the same "SD ERROR: 0" at
first, then it pauses, clears the screen, and the game starts!
That is rather interesting, but I'm afraid I don't know enough to be sure what the cause is. One possibility, as you can see in the code snippet a few posts back, is to increase the retries when mounting fails. This code below explains why you would see it fail, 3 seconds stall, then clear screen(and luckily run). Basically what that means is, somehow, doing a SoftReset() makes it mount next time it runs?!

Code: Select all

void SDCrash(uint8_t err){
        ResetSprites();
        StopSong();
        AEClearVram();
        AEPrintByte(20,12,err,0);
        AEPrintBigRam(11,11,"SD ERROR?");
        
        DDRC = 255;
        WaitVsync(180);
        SoftReset();
}
The previous build does a maximum of 3 retries, with a 2 frame wait in between. The attached version attempts 10 times before giving up, so please give that a try. Solving this problem could potentially improve the kernel/games in the future. I would be a little surprised if that made the game run right off the bat. If it doesn't it, I'm convinced it must be some bootloader stuff I am not in the know about.
Attachments
ALTEREGO.UZE
(60.02 KiB) Downloaded 140 times

User avatar
nicksen782
Posts: 667
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Alter Ego

Post by nicksen782 » Mon May 11, 2015 2:49 pm

Using the emulator I can see the "SD ERROR" message if the .bin file doesn't exist. However, sometimes I won't get the error but I also will get minimal graphics as well. This only happens if there are other files in the directory such as the Tornado2000 .lvl file.

That is probably more of an emulator bug though.

User avatar
uze6666
Site Admin
Posts: 4449
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Alter Ego

Post by uze6666 » Tue May 12, 2015 6:54 pm

The bootloader may be the culprit, but I looked at it a couple time and it's hard to find out what's going on. I'll have another look and try to reinitialize the sd card and correctly de-assert it after flashing the rom and jumping to the game.

Btw, how hard is it to create new levels? Do you have notes on the format of the data file?

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Alter Ego

Post by D3thAdd3r » Tue May 12, 2015 11:22 pm

uze6666 wrote:Btw, how hard is it to create new levels? Do you have notes on the format of the data file?
An editor is probably necessary, it would take time to get familiar with how level bytes relate to map tiles, but nothing overly complex. The tables of interest are in "aedefines.h" named

Code: Select all

const uint8_t MapTileTable[] PROGMEM"(a linear list of how map bytes relate to actual tile indices, for each of the 5 tile sets)
const uint8_t IsForegroundTile[] PROGMEM"(bit table, each bit(MSB&MSb first) is directly related to corresponding vram indiex)
const uint8_t tileType[] PROGMEM"(1 byte directly related to vram indices for tile properties like ladder, solid, kill, etc).
It is pretty flexible and would allow for quite different tile sets than the ones currently available including extra foreground/background non-solid decorations like AlterEgo 2 has. I'd be happy to explain any detail, I have no planned time frame to make a level editor, but it would be an entertaining expansion to play with.

Once I was up to speed with the manual "screen shot->hex editor" process, I spent an average maybe 20-30 focused minutes per level, keeping in mind my goal was %100 replication with no creative additions. If an editor existed, I think anyone could build the same episode I did without needing to know the inner workings, probably faster. The best way to understand the level data is to open up the data file in a hex editor, set your columns width to 32 characters, and go to offset 0xd5e0. You will be at the first byte of the first level "HELLO WORLD" . The first 32 bytes of each level is always the header with this format:

Code: Select all

header[0...27] = name of level, 0x20 is space, terminate the string with '?'
header[28] = song to play
header[29] = tile set to use(try changing just this, it works out nice generally!)
header[30] = number of exchanges
header[31] = sync type(vertical or horizontal alter ego)
Then starts the level bytes. You will see there is always 2 bytes of padding with the value of "0xbb" on the left and right columns, the actual map is always 28 tiles wide in the game. This padding is to make things line up and clearly separate nicely to 32 bytes in a hex editor, no other use. There are always 20 rows of 32 bytes with that format. After each level there is always 32 bytes padding of "0xbb" just to make it easy to distinguish. All map bytes < 0xA0 are entries into MapTileTable[](which in the comments gives a description about each entry, each set is separated by \n in the source code), which uses the map tile set specified by the level, to determine which tile to draw. For the most part all the tilesets use the low number for similar types of tiles, only decorations like foliage, spikes, fake wall, are different between sets. A '0' always means empty, it will automatically and randomly get filled with stars when the level is loaded, stars are never explicitly stored in the map.

Objects are specified with "magic numbers" that are >= 0xA0, player start is always "0xFF". Looking at LoadLevel() is better than words to explain that part. If you change the byte at offset 0xd7a5(which should be 0xa4) to 0xa7 you will turn the enemy on the first level into a leftward moving alter skull(player can walk through it, but it kills if it touches your alter ego). There are only 8 types of enemies, or rather 2 types of enemies with 4 possible moving directions(skull/alter skull, up, down, left, right) Other values will be pixels items, etc. The recorded demo format is simple, but the current code that saves it to eeprom is admittedly very bad and I wouldn't base anything off that because you need to manually fix timings quite frequently. It is 1 byte for the state of the pad with another byte for the number of frames to hold that state.

User avatar
uze6666
Site Admin
Posts: 4449
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Alter Ego

Post by uze6666 » Wed May 13, 2015 3:14 am

Thanks for the info, very interesting. Seems pretty easy to do a level by hand, admittedly a level editor would be pretty cool. It's one thing I'd like to work on when I get more time.

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Alter Ego

Post by D3thAdd3r » Wed May 13, 2015 9:42 pm

You could make Alter Ego 2 much easier with an editor and I think many people would enjoy it just to play around with their own levels. AE2(ZX Spectrum only, and I believe actually a better game than the first) screenshots do not match up resolution or graphics wise so it's so hard to count tiles and keeping everything in your head without actual visual feedback besides just hex. Not that I am against doing it personally in the semi-distant future, but I have no foreseeable plan for it and would love to see the sequel get ported by you just as well.

As currently compiled, the game has only ~500 bytes of flash free. Eliminate all intro/logo/title/ending code and title/ending music and you would probably have about ~6k free minus whatever pff needs to write SD(and the task perhaps harder than writing the editor, Uzem support for SD writing ;) ) Using the rest of the existing code for in editor level testing should be straight forward work. I was considering it might be better to have all new tiles, but that would take some research and conversion since the speccy version is the only graphics available to use.

Edit----
ae_pc.jpg
ae_pc.jpg (100.63 KiB) Viewed 3347 times
Yet another option to make another whole game out of it is to port the levels from the PC version. The game map is slightly more tiles wide and they occasionally use a sliding pixel, but it seems most levels could be slightly altered to be narrower and play the same. The sliding pixel I don't recall every adding much to the gameplay, just an eye candy thing like the fancy lighting and stuff they have there.

User avatar
Jubatian
Posts: 1355
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Alter Ego

Post by Jubatian » Sat Oct 24, 2015 8:57 am

I guess a compliment is due here :)

I played this game through, and all I can say it just works perfectly. The animations and all the graphics are nice and pleasant, the game responds well to controls, and its feature of saving is also just all right, simple and efficient for the user. The way of using the SD card also seems smoothly done, all the while keeping size small, by impression just right for the content (of course by no doubt some wild crunching could be done on it, maybe hindered though by the lack of RAM, but it is simply not necessary). For me as of now this game feels like one of the best things done for the console! And it is definitely a good little game, would worth more content! :) What it already has is fun, some levels really took time and though to figure out, but still I managed it all in a few hours without ever playing any variation of Alter Ego. Hope the engine is capable to handle more!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests