Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: p2 on September 09, 2011, 01:49:04 pm
-
Is it possible to make my code faster?
(I want to make a few different difficulty-modes!)
EDIT: Screenie!!
(http://img.removedfromgame.com/imgs/CAR.gif)
(It's with sound - so you should try it on your TI!)
CARAXE is the ASM-program
The other programs are the surcecode! (CAR is the main-program)
-
Frameskipping would speed it up. ( So only display every other frame ).
-
Pause statements is a crude way, but it works well.
Wouldn't that make the game slower, not faster?
Frameskipping would speed it up. ( So only display every other frame ).
With that, the game speed would remain the same, but it would be even choppier (notes and such would pass at half speed but seemingly at 2 pixels per jump)
Each frame sent to the screen takes about 1/100th of a second, and on top of that there's the time needed to render the frame. Cutting out about 15-20 of these per second would certainly save a lot of processing time, allowing the game to run faster.
-
Frameskipping would speed it up. ( So only display every other frame ).
With that, the game speed would remain the same, but it would be even choppier (notes and such would pass at half speed but seemingly at 2 pixels per jump)
Not at all, you see a lot of processing time is taken in displaying a frame. In TBP I gain a lot of speed by skipping a few frames. You do move two pixels, but it seems to move faster because in truth, the program has more time to work on the actual processing of whatever needs to be done in the background because all the foreground code ( so the displaying ) isn't taking up as much time. The game does start getting pretty choppy when you start skipping a lot of frames but usually just a one fameskip isn't noticeable unless you are looking closely.
EDIT: ninja'd :P With a much better explanation.
-
Er...
So may someone of you tell me how to make it faster??
The speed is more important than the size of the program!
-
I'd use a counter variable and skip every second / third frame using an if statement with the modulus operator ^.
0->C .Counter variable
game loop
.do calculations here
!If C^2 .Increase number to skip more frames -> gain more speed
.do drawing stuff / displaying here
End
C++
End
-
Er...
a CALCULATOR game.
Or can you write that in Axe??
Aniway, Thanx!
-
Er...
a CALCULATOR game.
Or can you write that in Axe??
Aniway, Thanx!
It is written in Axe. ;)
If you're wondering about the ++ operator, it's been in Axe since 0.5.2 or so, and if you're wondering about the ^ operator, it's been in Axe since before 0.1.0.
-
Here i optimized it a bit. A big problem you have is the line...
Dispgraph
Dispgraph^r
(note that i changed some things so this has a chance of not working the way you wish.)
-
I hope it'll be faster!!
-
tell me if it is :)
i hoped that helped. There is some definite improvisation possibilities, but I can't think too hard right now :P