Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: DJ Omnimaga on November 18, 2008, 05:53:16 am

Title: Illusiat on a TI-81
Post by: DJ Omnimaga on November 18, 2008, 05:53:16 am
Some people might know alerady if they frequent #omnimaga on unitedti.org IRC, but I am currently attempting a TI-81 port of the first Illusiat. I know barely anyone will even be able to play it but I wanted to see how it would turn out. This will be a great challenge, if possible at all. The original game, in its current version, is above 10 KB huge after picture files are generated. Now I must fit it under 2400 bytes. Now I have a big advantage on this though, because on the TI-81, all variables (A-Z and Theta) and matrices ([A]-[C], which can be from 1x1 to 6x6 huge) doesn't take any of that RAM. Also because program files are slot-based the only RAM they take is for their content and you don't even need to give them name at all. They are listed as Prgm0-9 and PrgmA-Z and PrgmTheta, followed by their name. No matter the name also, to recall a sub routine from another program you just need to type the prgm ID from 0 to 9 or from A to Z or Theta, like Prgm9 for example. This allows me to have programs doing stuff like Disp "" and when I need such instruction I just recall the sub-program doing it and because I use it a lot, I still save some bytes doing so. But yeah, I need to optimize as much as possible, meaning this game might use all 37 sub programs slots on the calc. Also another thing is that on the TI-81 there is no Then/Else instructions so for conditions where I need to execute multiple commands it costs me a sub-program too. Another limitation is that there are no While/For/Repeat instruction, meaning I have to use Lbl/Goto for loops. They won't cause memory leaks though, due to the absence of Then/Else/While/For/Repeat instructions.

So far the battle engine is done, except you don't gain experience/levels yet and bosses will not work in its current state. Battles will be all text-based, like back when Illusiat used to be called Labyrinth Of Illusions 1. Unlike the original version, which had no stat menus nor leveling up systems, this version will have them, like in the Illusiat 2004 remake (altough only the stat menus, not the entire menu and no healing ability outside battles).  Title screen is done as well and main menu too. Walking engine is not started yet. This will be the hardest part I think. For now you can access the menu from the main loop though and run into enemies. Dungeons will have ascii maps.

Basically it will be different from the original game, but still be similar in some ways. It will be far from being as good as my other games, and I could even say that it will be worse than the original Illusiat itself, altough less flawed. That's of course if the project proves to be possible at all. Of course if I lack the RAM I could always split the game into two chapters though. Also I need to make sure to finish the game before running out of batteries because the TI-81 has no lithium battery, meaning if you need to change your batteries it causes an automatic memory reset.

If I finish this I will copy the code in a txt file and post it in the download section. For screenshots I will either use my digital camera or I will port the game to the 83+ and do screenies from there.

I am curious how this would turn out :P It would be funny if I still had RAM left when finished. For sure the install process will NOT be user friendly, as the TI-81 has no link port and user needs to type the PRGMs by hand. Due to lack of space the user will also need to type in the matrices.

Oh and before you suggest lists: no I won't use lists instead of matrices. Because unlike matrices, lists takes RAM space.
Title: Re: Illusiat on a TI-81
Post by: metagross111 on November 18, 2008, 08:31:25 am
awesome. cmon, at least a concept screenshot?
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on November 18, 2008, 02:42:26 pm
yeah i am waiting until map engine works :P it will be very blurry though because the 81 LCD is shit (very hard to see because the text is gray and the background light gray and no matter how the contrast is set it's still hard to see :P
Title: Re: Illusiat on a TI-81
Post by: metagross111 on November 18, 2008, 05:02:04 pm
or, you could go into mspaint and whip some fake stuff up :P
Title: Re: Illusiat on a TI-81
Post by: TIfanx1999 on November 18, 2008, 10:13:21 pm
This should be a really fun project, I'd love to do something on a limited system like this. Being that it's you, I'm sure you'll suceed. ^_^
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on November 27, 2008, 04:52:45 am
Ok some progress:

-The battle engine is done. I did some formula changes in order to have enemy HP very high when they are at high level (in Illusiat 1 there was only one kind of monster), while at low level they still have low HP. Enemies also give more experience and the two magic spells takes less MP (In the original Illusiat you had one magic spell (some kind of lightning magic) and potions. You had an unlimited amount of potions but the amount of HP they restore was quite random, so when enemies dealt lot of damage you had to use them at your own risk. In the 2003 version of Illusiat (that had the Illusiat 12 engine) potions got replaced with a cure spell, which took MP and an additional spell, Scan, was added (to view enemy HP). This TI-81 version of Illusiat keeps cure spell (HEAL) but gets rid of the scan spell.
-The map engine is technically done, but I still need to code the special rooms. I got rid of some switches but some like the one that opens the path to the first boss will remain. I'm thinking about keeping the HP restoring spots like in the second version (in the first version they kept increasing your HP non stop until you get out of the room. This made no sense as you could keep your calc running for 4 hours maybe and end up with 30 million HP and instant kill attack powers...). The way it works is like Mana Force, due to the TI-81 limitation
-I currently have 4 subprogram slots left on the calc and 1222 bytes left (the game is 1178 so far). I will only use two of the matrices, which the user will have to type in the matrix editor himself (not too much of a problem since the game is small and matrices are only 6x6)
Title: Re: Illusiat on a TI-81
Post by: TIfanx1999 on November 27, 2008, 02:02:36 pm
Wow, that's alot of progress so far. I'tll be intersting to see how this turns out. I'm personally betting on you having some RAM left over. Lol
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on November 27, 2008, 07:48:16 pm
Yeah this would be funny, altough I kinda expect it for now. I thought about releasing a version as small as possible then make another version with maybe some other stuff added to it like more text or animations. I was also thinking about a better save system. Currently the system is the same than the very first version of Illusiat 1 on the 83+, but when I say first version, it's really the first ever, not the one in the download section. In the original the game was saved as you progressed. If you quitted you would restart where you left, but when starting a new game it would immediately overwrite your saved game. If I do a second version it will probably store saved data into matrix [C] (matrices won't take any RAM) or other unused variables.
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on November 28, 2008, 03:24:19 am
Ok finally it took more than 1337 bytes so the name will remain Illusiat 81. Unlike the two previous incarnations of Illusiat 1 this one will not have the 2nd and 3rd boss final spell. Bosses will only use one attack. The game is alerady hard enough anyway and there's not enough space left for magic animations (which would most likely be on graph screen due to the lack of an Output( command and they would suck anyway because you can't turn OFF the axis on the TI-81 it seems x.x). I added a very short intro sequence and ending sequence though, with your character running away from goons, altough not as many as in the 2003 remake and the final boss appearing. Also in this version there are only two bosses. In the original there were 3, but now the 2nd boss will basically be the final boss and just morph into a super version of himself after losing 6000+ HP (he has around 33000 total HP and good luck beating him if your LV is not maxed out).

The game is finished by now. Now I just need to take pics and copy the code by hand on the computer. It shouldn't take too long for the code since the game is 2225 bytes huge and only uses two 6x6 matrices entered by the user by hand along with the code, but for pictures it's another story. I don't even know if I have batteries left for my digital camera x.x
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on November 28, 2008, 05:55:47 pm
Here's a video of it:




I will probably try to do a TI-82 or 83  adaptation of the game to be able to make a quality screenshot. On the TI-81 the busy indicator is different (a 3x3 square at the top-right corner of the screen) and there's no pause indicator but i think it should do (I'll just disable it)
Title: Re: Illusiat on a TI-81
Post by: TIfanx1999 on November 30, 2008, 04:39:43 pm
Nice job! Even though I predicted it, it's still funny that you had RAM left over. :D Good work cramming tha 10k game into such a small space. :)
Title: Re: Illusiat on a TI-81
Post by: metagross111 on November 30, 2008, 05:59:25 pm
yep. congrats
Title: Re: Illusiat on a TI-81
Post by: {AP} on November 30, 2008, 06:19:06 pm
Nice work.
Nothing I could tolerate doing on an 81.
Those are hellish machines... >_<
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on November 30, 2008, 08:38:47 pm
thanks. Actually, I have some more good news: I decided to try to see what would happen if I maxed out the entire user RAM and the game still ran without any problems! I guess Ans and temp storage is done in some hidden RAM unlike on the 83+, where it uses your RAM to do that stuff. Maybe I could add some more animations in battles
Title: Re: Illusiat on a TI-81
Post by: TIfanx1999 on November 30, 2008, 09:38:53 pm
I'm not surprised. I figured user RAM was just that. System RAM is completley seprate here. ^_^
Kinda neat.
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on December 01, 2008, 10:54:05 pm
yeah, i wish the TI-83+SE and 84+ models worked like this, given  that they got 128 KB of hidden  RAM. The TI-86 had 32 KB of hidden RAM too and the TI-82 4 KB
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on December 02, 2008, 05:56:46 am
after even further testing, it appears that program names won't take any space either. This means that not only I can have a digit as the first program name character but I can have all 37 programs with 8 characters long names and still have RAM. Altough it can be useful to name programs as reference to what does what during coding it is useless to have users name them when they type in the programs by hand because programs are ran by their ID, not by their name.

Other things: the Y= and param (Y1T, X1T, etc) variables can hold a total of 360 characters together. So the allocated RAM would be:

Programs+Lists content (excluding program names):
2400 bytes
Program names:
296 bytes
Matrices (assuming each elements are 9 bytes like on the TI-83+)
324 bytes
graph functions
360 bytes
home screen
128 bytes
real variables+ans (we'll assume they're 9 bytes too, since there doesn't appear to have any VAT or whatever stuff related to names)
252 bytes

So if I didn't forgot anything there must be at least 3760 bytes of RAM on this calc.

It doesn,t appear to be allocated very well. I had 6 bytes of user RAM free at one point during editing and when I went to the list editor nothing appeared and when i typed something I got an error, and now the PRGM menu is all screwed up. Most programs were renamed to "Do not erase DIM1:Do not erase DIM1:Do not erase DIM1:Do not erase DIM1:Do not erase DIM1:Do not erase DIM1:Do not erase DIM1:Do not erase DIM1:". Some are named like "Y3TERROR Y3TERROR" or such stuff and causes lot of display glitches during editing programs. Deleting these names from the programs fixed the problem though and the game still runs pretty well. The list editor gives an ERR 10 MEMORY when you have 0 bytes of free RAM, meaning it must check if you have remaining RAM but might not check if you actually have enough RAM when it's above 0. Weird calc x.x who knows, maybe I'll manage to crash it but I hope it won't happens before I finish typing all the game on the PC
Title: Re: Illusiat on a TI-81
Post by: simplethinker on December 02, 2008, 04:43:37 pm
Weird calc x.x who knows, maybe I'll manage to crash it but I hope it won't happens before I finish typing all the game on the PC
Isn't it sort of a bad idea to be testing how much it takes to give a memory error while you still have a large, unbacked-up project on it?
Title: Re: Illusiat on a TI-81
Post by: metagross111 on December 02, 2008, 07:09:08 pm
Weird calc x.x who knows, maybe I'll manage to crash it but I hope it won't happens before I finish typing all the game on the PC
Isn't it sort of a bad idea to be testing how much it takes to give a memory error while you still have a large, unbacked-up project on it?

^^^ This
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on December 02, 2008, 11:17:03 pm
Well it was totally unexpected when this happened. I just went in the list editor because i was doing calculations and wanted to see how much bytes each list elements took but i didnt realised i only had  6 bytes free and the calc freaked out when I entered something and pressed enter. At least things seems fine now. I will do further testing after i finishing copying the code.
Title: Re: Illusiat on a TI-81
Post by: metagross111 on December 02, 2008, 11:46:04 pm
lol
Title: Re: Illusiat on a TI-81
Post by: Speler on December 03, 2008, 07:01:10 pm
Nice work :D.  That's some mad compression skills you got.
Title: Re: Illusiat on a TI-81
Post by: TIfanx1999 on December 05, 2008, 01:26:06 pm
Well, that fact that you can crash it means they have some shitty error handling on this thing. Of course, I'm sure they never intended anyone to completly max out all the avalible user space. :D
Title: Re: Illusiat on a TI-81
Post by: DJ Omnimaga on December 05, 2008, 03:47:45 pm
true, back in 1990 2400 bytes of RAM was a lot for a calculator. My guess is that the list editor checks if you have RAM at all to open it instead of checking if you have ENOUGH of it to open it x.x