Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Elsewhere on February 13, 2011, 12:19:23 pm

Title: Polarizer
Post by: Elsewhere on February 13, 2011, 12:19:23 pm
Yay, finished my first Axe game!

I didn't know if it warranted a new thread or not but I erred on the side of caution and put it here.

So, anyway, Polarizer! Basically, you try to fill all the squares in, but filling in a square makes it so you can't fill in adjacent squares until you fill in another. Use the arrows to select, 2nd to confirm, and Clear to exit level/menu/game. Beating all the levels might get you something nice! Warning: This game has to be run by either DCS, MOS, or some similar shell to work. The two versions are also slightly different due to TI weirdness. Nothing big, though.

Currently I need help coming up with harder levels because a lot of them are just huge pushovers. Anyone who thinks they came up with a tough one, feel free to share it and I could overwrite one of the filler levels.

So... tell me what you think!

EDIT: Newest version is here (http://ourl.ca/9182/176886)
Title: Polarizer
Post by: ztrumpet on February 13, 2011, 01:05:10 pm
Wow, this looks great!  Nice job!  I think it should be a stand-alone topic.  Would you like me to do that for you? ;)
Title: Polarizer
Post by: Munchor on February 13, 2011, 01:07:47 pm
(http://www.omnimaga.org/index.php?action=dlattach;topic=1564.0;attach=6096;image)

Elsewhere, that sure looks cool, I imagine how hard it was to write the algorithm of the game (and the squares) looks quite complex maths to me ;D
Title: Polarizer
Post by: Elsewhere on February 13, 2011, 02:18:52 pm
ztrumpet: Uh, if you want to; that is, if you think it's big enough to warrant one. I haven't a scope of these things.

Scout: Nah, just a lot of tongue-in-cheek For( loops and way too many variables. For later projects I'll have to be more careful, though, as I had a hard time cramming this under 8811 and it was initially supposed to be a small getting-to-know-Axe project.
Title: Polarizer
Post by: Munchor on February 13, 2011, 02:25:49 pm
ztrumpet: Uh, if you want to; that is, if you think it's big enough to warrant one. I haven't a scope of these things.

Scout: Nah, just a lot of tongue-in-cheek For( loops and way too many variables. For later projects I'll have to be more careful, though, as I had a hard time cramming this under 8811 and it was initially supposed to be a small getting-to-know-Axe project.

Was it your first Axe program? Or just your first game?
Title: Re: Polarizer
Post by: shmibs on February 13, 2011, 03:04:46 pm
for a first project, this most definitely merits it's own thread. i can't say i'm a huge fan of the sprite set, but it's definitely consistent(which is difficult to manage). if you're worried about things being too massive you could always post source and ask people about how to go about optimising.
Title: Re: Polarizer
Post by: Munchor on February 13, 2011, 03:05:54 pm
Nice to see a particular thread for it ;D It's quite cool.
Title: Re: Polarizer
Post by: Elsewhere on February 13, 2011, 05:59:20 pm
Scout: Yeah, first program with Axe, but it's not like I'm new to programming or anything.

shmibs: Yeah, it's just my everyday programmer art... enough to get the job done, but just barely :P

So, I'm not planning on adding much except bugfixes and the like because I'm simply out of space... I guess I'll link to the really inefficient source code for anyone who wants to try and optimize it. Just be warned, it's probably really bad.

POLSRC (http://pastebin.com/9KE7Kpnd) (Main thing)
POLINIT (http://pastebin.com/STnkQktj) (Loads sprites and stuff)
Title: Re: Polarizer
Post by: Happybobjr on February 13, 2011, 06:31:20 pm
http://pastebin.com/XzXgSpp4

Some optimizations.
I skipped many obvious ones because I didn't want to double check some things.
This should be at least 200 bytes smaller.
Probably much much smaller ;)
Title: Re: Polarizer
Post by: leafy on February 13, 2011, 10:18:32 pm
This reminds me of that Lights Off game for the iPhone.
Great work!
Title: Re: Polarizer
Post by: z80man on February 13, 2011, 11:23:03 pm
I just noticed on the screen shot you posted it seems like on the levels there was supposed to be grayscale in the background because of the checkerboard pattern. To get the grayscale effect you need to constantly update the buffer by using DispGraphr. This can be done with either a custom interrupt routine or you can place it in the getkey loop in your code.
Title: Re: Polarizer
Post by: ztrumpet on February 13, 2011, 11:34:19 pm
Nah, I think the were meant for just black and white - when the screen's updated they don't flicker back and forth. :)
Title: Re: Polarizer
Post by: leafy on February 13, 2011, 11:37:18 pm
Yeah if it were greyscale the checkerboard would alternate.
Title: Re: Polarizer
Post by: Darl181 on February 13, 2011, 11:46:51 pm
And the pattern's different for different levels.
Title: Re: Polarizer
Post by: DJ Omnimaga on February 13, 2011, 11:54:55 pm
I don't really get it from the screenshot, but it looks nice. It reminds me of lights-out, but I'll have to try it eventually to figure out how to play.
Title: Re: Polarizer
Post by: Elsewhere on February 14, 2011, 03:42:38 pm
Happybobjr: Thanks! After implementing it, it's about 500 bytes smaller! I'll have to remember that Else!If trick for later.

z80man: It's not grayscale, but I'm planning on doing grayscale on another project, so thanks for the tip!

Anyway, I'm trying to figure out what to do with the extra space! I could either add content or improve upon some preexisting aspect. Or I could even just keep it the way it is and have a smaller game for doing so. Hmm...
Title: Re: Polarizer
Post by: DJ Omnimaga on February 14, 2011, 03:46:02 pm
Do you mean extra space as in free memory? I guess it would be fine if the game remains at its current size, although if it's a Flash APP on its final release it's best to use all the 16384 bytes available. Some people prefer smaller games but large ones aren't necessarily bad (since they generally have more features)
Title: Re: Polarizer
Post by: ztrumpet on February 14, 2011, 03:47:38 pm
I think it's fine to leave it as is.  It looks like a great game! ;D
Title: Re: Polarizer
Post by: Elsewhere on February 14, 2011, 05:39:47 pm
Yeah, I guess I'm pretty close to being done, but I'm trying to get some music in there just because. Once I get that figured out, I guess I can finally call it quits on this one.
Title: Re: Polarizer
Post by: ztrumpet on February 14, 2011, 07:00:42 pm
I you're having any trouble, you may want to look at these topics/posts:
http://ourl.ca/4129/100021
http://ourl.ca/6263

Good luck! ;D
Title: Re: Polarizer
Post by: Elsewhere on February 14, 2011, 10:16:11 pm
Hm, but how would I go about getting the .8xvs onto my 84+? There's no GraphLink for 84s I can find anywhere and TI Connect won't accept them. Is there something I'm missing?
Title: Re: Polarizer
Post by: ztrumpet on February 14, 2011, 10:19:26 pm
You could use CalcSys to change the file types if you needed to. :)
Title: Re: Polarizer
Post by: DJ Omnimaga on February 15, 2011, 04:51:22 am
Strange, normally TI-Connect should accept 8xv files. Maybe they're corrupted?
Title: Re: Polarizer
Post by: FinaleTI on February 15, 2011, 05:36:00 am
The problem is that MiditoAxe doesn't properly calculate the checksum. Opening them in Wabbit, then exporting them will fix this.
Title: Re: Polarizer
Post by: Happybobjr on February 15, 2011, 10:44:52 am
Happybobjr: Thanks! After implementing it, it's about 500 bytes smaller! I'll have to remember that Else!If trick for later.

want me to optimise more?
I have never used pastebin before this :P  Now i realize that it can save me hours of transfers. :D
Title: Re: Polarizer
Post by: DJ Omnimaga on February 15, 2011, 03:49:17 pm
The problem is that MiditoAxe doesn't properly calculate the checksum. Opening them in Wabbit, then exporting them will fix this.
Oh ok. X.x Maybe Quigibo could fix this eventually?
Title: Re: Polarizer
Post by: Elsewhere on February 15, 2011, 06:28:32 pm
Bah, well I can't find a 3.5 to 2.5mm adapter for my headphones. :P I guess I'll have to wait until I can get one. The exporting with Wabbit seemed to do the trick though, and I could send the files, so I guess it works. In the meantime I guess I can do some work on the actual song.

Happybobjr: Any optimization is good optimization! And it should provide me insight on how to make my files smaller in the future, so it's really helpful.
Title: Re: Polarizer
Post by: Happybobjr on February 15, 2011, 07:10:34 pm
Any reason that with your L= checks, you have L=0 through L=16.  and L=18 through L=(big nnumber).

What about L=17?
Title: Re: Polarizer
Post by: Elsewhere on February 15, 2011, 08:04:47 pm
That's the empty level, and all the values are already set as 0 at the start of the LV label, so I didn't need anything for it. Also, I had 3 and 16 or something mixed around in there, but I eventually fixed it in the code.
Title: Re: Polarizer
Post by: Happybobjr on February 15, 2011, 08:21:13 pm
That's the empty level, and all the values are already set as 0 at the start of the LV label, so I didn't need anything for it. Also, I had 3 and 16 or something mixed around in there, but I eventually fixed it in the code.

lol I just fixed that.  I did some other optimizations too.  But not as big as the first one.
There is quite a decrease in the source code size too :P
Title: Re: Polarizer
Post by: Elsewhere on February 17, 2011, 07:08:37 am
Okay, haven't been making much headway on the music front. I got it to work on Wabbit but it didn't sound like the song... I'll probably just keep the game as it is with the reduced source code.

Happybobjr: Currently I'm at 8432 bytes, and it seems like a bit of a dream, but could your optimizations push it under 8192? Then I'd just have to release one Asm(-runnable program ;)
Title: Re: Polarizer
Post by: Ashbad on February 17, 2011, 03:17:59 pm
eh, that looks cool!  nice work :D
Title: Re: Polarizer
Post by: Happybobjr on February 17, 2011, 03:44:18 pm

Happybobjr: Currently I'm at 8432 bytes, and it seems like a bit of a dream, but could your optimizations push it under 8192? Then I'd just have to release one Asm(-runnable program ;)

i will try my best.
do you mind posting your current source on pastebin?
Title: Re: Polarizer
Post by: squidgetx on February 17, 2011, 03:46:44 pm
I can help too with optimizing ;)
Title: Re: Polarizer
Post by: Elsewhere on February 17, 2011, 08:01:03 pm
POLSRC (http://pastebin.com/HWNes3v4)
POLINIT (http://pastebin.com/9xGLAPjV)

Okay, here they are! Note that I haven't changed much besides the implementation of optimizations and a few more backgrounds. Mostly I'd been trying to implement music but I eventually gave up. :-X Also, anyone know of something that takes .8xps and converts them directly into Axe code? Right now I have to manually change everything to make it look nice ::)
Title: Re: Polarizer
Post by: Happybobjr on February 17, 2011, 08:06:30 pm
I think cemetech has something... checking
EDIT: http://www.cemetech.net/projects/basicelite/sourcecoder2.php

EDIT 2: 10 bytes saved here i think http://pastebin.com/8zULvxqg

EDIT 3: Can you give me a list of unused variables?

EDIT 4: Saved 150 bytes so far I think.

EDIT 5: Sorry I think I can only save you 200 of the 240 byes needed.

EDIT 6: Scratch that!  I made it!  Just need to finish up on it tomorrow.
Title: Re: Polarizer
Post by: Elsewhere on February 17, 2011, 11:40:32 pm
Okay, awesome! I think I used all the variables, however. Ans could always be used for very temporary storage, if it was really necessary. Good work, though! ;D
Title: Re: Polarizer
Post by: squidgetx on February 18, 2011, 09:13:21 am
6444 bytes.

Let me know if I messed anything up.

Title: Re: Polarizer
Post by: Happybobjr on February 18, 2011, 10:04:29 am
NOOO!!!!
I didn't make it in time.

Squidgetx:  did you put all the repeated commands into subroutines and reorder the pictures so you could use Sub(SUB,#)
Title: Re: Polarizer
Post by: Elsewhere on February 18, 2011, 01:02:03 pm
It mostly worked, although I'll have to make a few modifications because some aspects didn't work as they should. Also, why did you get rid of all the spaces in the Text( commands? Do extra characters take up a lot of bytes?
Title: Re: Polarizer
Post by: squidgetx on February 18, 2011, 04:34:14 pm
That's how they showed up in pastebin ??? ...They do take up extra space, but you've got plenty of room, so you can put them back in.
Title: Re: Polarizer
Post by: Elsewhere on February 19, 2011, 07:19:59 pm
Oh, alright. However, I'm experiencing some weird happenings. The saving thing wasn't working so I tried to modify the code but nothing seemed to work, and after running the game my calculator would freeze and I'd have to take out the battery and clear my RAM to get up and running again. I figured it was something with the calculator itself so I reset it but it's still experiencing the same freezes or slowdowns after running the game. Got any ideas, anyone? Also, the bug with saving and probably why my calc keeps resetting almost definitely stems from the game not being able to create the saving appvar and then reading and writing to some unknown place in storage.

The things one will do for optimizations :P
Title: Re: Polarizer
Post by: Elsewhere on February 21, 2011, 04:35:42 pm
There! It was just one small little fix, but it took forever to find. Well, here's the 6407-byte version, and it can be run through Asm(. Thanks for the optimizations, squidgetx and Happybobjr!

About the only difference from the original is the size, so don't expect much to be new.

Finally. (Sigh of relief)

EDIT: There was an 8 where there should have been a 9. Fixed.
Title: Re: Polarizer
Post by: ztrumpet on February 21, 2011, 04:44:23 pm
Finally. (Sigh of relief)
I feel ya. ;)  What was the bug?
Title: Re: Polarizer
Post by: Elsewhere on February 21, 2011, 04:47:50 pm
Putting my code on pastebin had an adverse side effect. It gave me "appv" (lowercase letters) instead of the [2nd][8] token. It was really hard to detect (someone else ended up asking me if I used the token, and I told them I had but I checked anyway and therein was the problem).
Title: Re: Polarizer
Post by: DJ Omnimaga on February 23, 2011, 01:17:51 am
I kinda prefer Pastie.org to share code, although I am not certain it is perfect, because Pastebin changed non-ASCII chars to weird stuff sometimes. SourceCoder also works.