Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: DJ Omnimaga on July 19, 2005, 01:27:00 am

Title: xLIB goodies
Post by: DJ Omnimaga on July 19, 2005, 01:27:00 am
Ok I am currently messing around with xLIB on my 83+ and it can do cool stuff. Recently tr1p1ea gave us the challenge of optimising his demo but since I have issues understanding or optimising other ppl code I decided to rewrite it from scratch. However I decided to change the scrolling style and add animated sprites. Here is what I got:
user posted image
Here is the code of the main program:
c1-->
CODE
ec1
AxesOff
FuncOff
1->X:1->Y
->S:->T
16->W:16->H
prgmMAP1
1->[A](S+Y+1,T+X+1
->C:->D
1->I
While 1
If I=1:Then:2->I:Else:1->I:End
real(2,0,T,S,W,H,0,12,0,8,I,0,1
getkey->K
If K=45:Then:real(0:Return:End
(K=34)-(K=25->C
(K=26)-(K=24->D

->[A](Y+S+1,X+T+1
If not([A](Y+S+C+1,X+T+D+1:Then:X+D->X:Y+C->Y:End
1->[A](Y+S+1,X+T+1
If T=/=4 and X>6:Then:6->X:T+1->T:End:If T=/=0 and X<5:Then:5->X:T-1->T:End
If S=/=8 and Y>4:Then:4->Y:S+1->S:End:If S=/=0 and Y<3:Then:3->Y:S-1->S:End
End
c2
ec2

I dunno if I have fully optimised it but it run prety fast right now, around 3 fps even when scrolling. I might post more stuff in this topic once I have more time :)smile.gif
Title: xLIB goodies
Post by: CDI on July 19, 2005, 03:33:00 am
looking at the grass maked my queasy :(sad.gif
Title: xLIB goodies
Post by: mdjenkins86 on July 19, 2005, 11:38:00 am
Please provide psudeo code for  your tile scrolling.
Please :hi:coucou.gif
Title: xLIB goodies
Post by: DJ Omnimaga on July 19, 2005, 11:42:00 am
how? O_Oshocked2.gif

*Kevin
Title: xLIB goodies
Post by: crzyrbl on July 19, 2005, 12:30:00 pm
that looks awsome!  this reminds me.  i should probably be working on my xLib zelda...
Title: xLIB goodies
Post by: DJ Omnimaga on July 19, 2005, 01:05:00 pm
cool idea %)rolleyes2.gif , well scrolling in a zelda in BASIC might not be a good idea because it might be a bit slow, especially if you have to detect when you need to scroll and not and which direction to scroll
Title: xLIB goodies
Post by: CDI on July 20, 2005, 01:21:00 am
hrm... yeah... but it's possible using one varible for facing, 2 for where you are (in matrix... then do this ((x-1)*8)+1 and -(((y-1)*8)+1) ) then you can do some cmplicated code... I'll write it out tonight and see if I can post it :Pblah.gif the problem is that for a matrix like the one in Kevin's post... It's about 2000b or more... I once used a 27x27 and it loaded SLOW...
Title: xLIB goodies
Post by: DJ Omnimaga on July 20, 2005, 01:24:00 am
do you use xLIB for that?

btw I dunno if I alerady have posted this somewhere on this forum but I also made a GS demo but it had no collision detection at the time I wrote it and it doesnt look very good on the regular 83+ (storepic is slow! :dang:banghead.gif ):

user posted image
Title: xLIB goodies
Post by: CDI on July 20, 2005, 04:26:00 am
@Kevin - 0.3a I can't load apps onto calc... cause of comp...
Title: xLIB goodies
Post by: DJ Omnimaga on July 20, 2005, 04:39:00 am
oh
Title: xLIB goodies
Post by: crzyrbl on July 26, 2005, 04:39:00 pm
QuoteBegin-Kevin+July 19, 2005, 07:27-->
QUOTE (Kevin @ July 19, 2005, 07:27)
c1-->
CODE
ec1
AxesOff
FuncOff
1->X:1->Y
->S:->T
16->W:16->H
prgmMAP1
1->[A](S+Y+1,T+X+1
->C:->D
1->I
While 1
If I=1:Then:2->I:Else:1->I:End
real(2,0,T,S,W,H,0,12,0,8,I,0,1
getkey->K
If K=45:Then:real(0:Return:End
(K=34)-(K=25->C
(K=26)-(K=24->D

->[A](Y+S+1,X+T+1
If not([A](Y+S+C+1,X+T+D+1:Then:X+D->X:Y+C->Y:End
1->[A](Y+S+1,X+T+1
If T=/=4 and X>6:Then:6->X:T+1->T:End:If T=/=0 and X<5:Then:5->X:T-1->T:End
If S=/=8 and Y>4:Then:4->Y:S+1->S:End:If S=/=0 and Y<3:Then:3->Y:S-1->S:End
End
c2
ec2

I dunno if I have fully optimised it but it run prety fast right now, around 3 fps even when scrolling.

get rid of the if K=45 statement and put it with the while statement.  Then put the real(0 at the end.  wonder how much faster it would go....
Title: xLIB goodies
Post by: DJ Omnimaga on July 27, 2005, 12:52:00 am
ah thx, will do
Title: xLIB goodies
Post by: CDI on July 27, 2005, 03:34:00 am
*CDI does some calculations...

Not that much faster, but it really kills the flicker... smooth GS
Title: xLIB goodies
Post by: DJ Omnimaga on July 27, 2005, 09:55:00 am
well that routine isnt the GS version, I stopped working on the GS version right now, actually the pb is because the Store pic takes enough processor time to kill grayscale quality, I wish xLIB had a function like ZSTO that not only recall pics like it does right now but store to pic as well it would be uber fast :(sad.gif
Title: xLIB goodies
Post by: alex10819 on July 28, 2005, 07:16:00 am
ooh... i gotta give XliB another go... i didnt use it before cuz i could do everything i needed with codex... but im kinda in need of excitement, and im gonna make a third BattleTower game... eventually...
Title: xLIB goodies
Post by: crzyrbl on July 28, 2005, 07:16:00 am
umm....y were you using storepic?
Title: xLIB goodies
Post by: alex10819 on July 28, 2005, 07:16:00 am
ooh... i gotta give XliB another go... i didnt use it before cuz i could do everything i needed with codex... but im kinda in need of excitement, and im gonna make a third BattleTower game... eventually...

and you're right... XliB does need to be able to store pics...
Title: xLIB goodies
Post by: DJ Omnimaga on July 28, 2005, 12:05:00 pm
QuoteBegin-crzyrbl+July 28, 2005, 14:16-->
QUOTE (crzyrbl @ July 28, 2005, 14:16)
umm....y were you using storepic?  

 I store the map ina pic because if I am going to display the map everytime for grayscale it s gonnna run uber slow and lok flickery, the pic command in xLIB is much faster than maps