Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: Demon on July 03, 2006, 04:08:00 pm

Title: [83+ xLIB] Faster XLIB?
Post by: Demon on July 03, 2006, 04:08:00 pm
I am wanting to use XLIB to make nice games, and I've figured out enough how to make sprites and tilemaps appear on the screen, but when it comes to making things move on the screen, my methods end up being really really slow (even the XLIB mouse I tried to make came out REALLY slow).
How can I speed things up a little bit?  And even better is ther e a better tuturial on XLIB than the one that comes with the app?  The commands were a bit cryptic and I don't know how many times I crashed trying to figure how where things go when I first tried it...
Title: [83+ xLIB] Faster XLIB?
Post by: Spellshaper on July 03, 2006, 10:19:00 pm
1. Welcome to the forums!
2. post your code, and we shall see if we can help you... Guessing how you did your routine is a lil hard ;)wink.gif
3. No extra tut that I know of. Hm, we could make one...
Title: [83+ xLIB] Faster XLIB?
Post by: kalan_vod on July 03, 2006, 10:22:00 pm
QuoteBegin-Spellshaper+Jul 4 2006, 04:19 AM-->
QUOTE (Spellshaper @ Jul 4 2006, 04:19 AM)
3. No extra tut that I know of. Hm, we could make one...  

 There was one in development, but due to loss of help it was dropped as far as I know (necro had taken it into his hands, but he needed help then no one wanted to give a hand).

Welcome here, I hope you enjoy your stay! And if you would like to post some code I will be glade to help out.
Title: [83+ xLIB] Faster XLIB?
Post by: DJ Omnimaga on July 04, 2006, 12:52:00 am
Welcome to the forums pyro_xp2k and welcome back kalan_vod :)smile.gif feel free to post your code if you need help :)smile.gif


Wasnt tifreak8x going to write a xlib tutorial?
Title: [83+ xLIB] Faster XLIB?
Post by: kalan_vod on July 04, 2006, 04:48:00 am
QuoteBegin-xlibman+Jul 4 2006, 06:52 AM-->
QUOTE (xlibman @ Jul 4 2006, 06:52 AM)
Wasnt tifreak8x going to write a xlib tutorial?  

 I believe so, but I know nothing other than he was going to write one. Thanks for the welcome back, it has been a little bit hasn't it?
Title: [83+ xLIB] Faster XLIB?
Post by: Dragon__lance on July 04, 2006, 05:31:00 am
nice  to see your back :)smile.gif Hmm, i think it should be an Omni Forum project to write the Xlib guru...if you need any help, feel free to ask anyone here, as they're all Experts :)smile.gif
Title: [83+ xLIB] Faster XLIB?
Post by: Demon on July 04, 2006, 05:43:00 am
\->\ : STO>
\L\ : List symbol

c1-->
CODE
ec1
PROGRAM:ZMOUSE
real(9,1,253
real(9,0,253
real(0,0
real(12,0,0,0,0,7,0
real(12,0,1,1,5,5,0
real(12,0,0,7,5,5,1
real(9,1,252
real(9,0,252
real(3,253,1
real(9,1,253
{H,V\->\\L\MTP
real(1,H,V,1,8,252,0,0,3,0,1
Repeat K=21
 
Title: [83+ xLIB] Faster XLIB?
Post by: kalan_vod on July 04, 2006, 06:37:00 am
c1-->
CODE
ec1
PROGRAM:ZMOUSE
real(9,1,253
Title: [83+ xLIB] Faster XLIB?
Post by: Demon on July 04, 2006, 08:01:00 am
QUOTE
real(9,0,253
Title: [83+ xLIB] Faster XLIB?
Post by: Spellshaper on July 04, 2006, 08:05:00 am
Isn't it so that xLib won't overwrite already existing Pics?
Try adding
c1-->
CODE
ec1real(9,1,253c2
ec2
before saving the Screen to Pic 255.
Title: [83+ xLIB] Faster XLIB?
Post by: kalan_vod on July 04, 2006, 09:42:00 am
c1-->
CODE
ec1For(I,1,0,-1
real(1,H,Ans,1,8,252,0,0,3,0,I
Endc2
ec2

Since you will be using a list, you will need to change Ans back to V.
Title: [83+ xLIB] Faster XLIB?
Post by: threefingeredguy on July 06, 2006, 08:51:00 am
In my professional experience, an rpg made in xLIB can be as fast as an rpg made using ASM (with getcsc for the keydetection). It's also easier to calculate the stats.
Title: [83+ xLIB] Faster XLIB?
Post by: Dragon__lance on July 06, 2006, 09:59:00 am
very tru,but with not as much features, in ASM you can fit in so much more at a decent speed, *points to Spencer's Zelda. One thing about the Mouse program, one way to make it seem faster is to increment (x,y) by more than 1. And i have a question, is it faster to include the key detection within the main loop, or as a seperate loop as Kalan__vod coded?
Title: [83+ xLIB] Faster XLIB?
Post by: Spellshaper on July 06, 2006, 11:09:00 am
Dunno, I'd say a seperate loop inside the main loop is faster.
Why?
When you put it directly into the main loop, it goes through the whole loop every time, thus eating up some time. A seperate loop however is likely to be smaller and is thus repeated faster, making key detection overall faster.
Just a theory though :ninja:ninja.gif
Title: [83+ xLIB] Faster XLIB?
Post by: kalan_vod on July 07, 2006, 09:28:00 am
It detects the key faster if you have a loop for the getkey function, as apposed to going through the whole loop for the game and only hitting the getkey once. If you have a small game loop, then you may not need a getkey loop but I would recommend it if it is not a live/action type game.
Title: [83+ xLIB] Faster XLIB?
Post by: threefingeredguy on July 10, 2006, 03:36:00 am
You canc1-->
CODE
ec1Repeat getkey
End
Ans->Kc2
ec2or if you need to update after a bit of a delay, I do this, though there may be a better wayc1
-->
CODE
ec1For(A,0,10
getkey->K
If Ans
1-A
Endc2
ec2
Title: [83+ xLIB] Faster XLIB?
Post by: DJ Omnimaga on July 10, 2006, 12:39:00 pm
yeah thats what reuben quest did, because key detection was slow
unfortunately it wouldnt work in metroid, altough I have a lil idea how I could make it work but that would make enemies move at insane speed when not walking
Title: [83+ xLIB] Faster XLIB?
Post by: Speler on July 10, 2006, 03:53:00 pm
ThreeFingeredGuy the first code doesn't work, you want:

Repeat Ans
getKey->K
End

Or for delay, you can optimize to:

For(K,0,10
getkey->K
End
Title: [83+ xLIB] Faster XLIB?
Post by: Demon on July 10, 2006, 04:01:00 pm
What about this if you need more responce speed?

Repeat Ans
    getKey
End
Ans->K

or don't even use K at all?  Or put the getkey into a FINANCE var?
Title: [83+ xLIB] Faster XLIB?
Post by: Speler on July 10, 2006, 04:09:00 pm
That last code is fairly pointless because there is no need to worry about speed when waiting for the user to press the button so all you have to do is optimize for memory (no offence), but the FINANCE variables is something I will forever incourage (hehe).
Title: [83+ xLIB] Faster XLIB?
Post by: crzyrbl on July 10, 2006, 06:16:00 pm
pyro....your sig takes forever...
Title: [83+ xLIB] Faster XLIB?
Post by: Spellshaper on July 10, 2006, 10:27:00 pm
for modem users, that is XDsmiley.gif

still, you should *try* to keep your sig size down bytewise...