Edit: this was miss understood, let me show you 2 videos of the first snippet presented here.
Normal
Simple method that everyone can use to create some madness and fun. With 3-4 lines of code.
From time to time ill upload a little code snippet that just makes everything runs faster with that lowering battery consumption.
I would really appreciate if forum knights will share their own code optimizations i think members will enjoy this. And also create a small game "Optimize it" not for the glory but for thinking out of the box to make code more efficient and clean.
But if we would think of points received from achieving goals and faster frame rate for the exact same OnScreen result. I would actually start at 100 points and try to keep it rather then counting from 0 to top.
So, a few years ago o have found a neat way to manipulate memblocks by one pixel at a time, then i moved to 2 , 4, 8 , 16 and so on... Eventually i got to a point where 1000 memblock images are running on the same 3D plane in just matter of seconds.
It makes you think how much of "good" architecture can manipulate the tools you already own in order to jump or lead a head of competition that said with the same tools the competition uses.
It is a fun and exciting journey to achieve something you can achieve in a simplier way but make it better so from that point on it will always be better.
So for the first snippet :
"How will i make everything faster in the simplest matter"
You have a game.
You have everything set, its all good, everything works.
And it runs on decent 60 fps.
But battery consumption is a bit much.
What will you do?
The....
Simple Sync Counter.
A simple.sync counter makes any game no matter the kind, to swallow.less battery on any mobile device and can work for any "Stable" Fps chosen by developer or user.
// Before loop
Global syncCounterTimes as integer
syncCounterTimes = 2 // above 1 , as 1 gives us the same result as without it.
Do
//Game stuff
Dec syncCounterTimes
If syncCounterTimes = 0
Sync()
syncCounterTimes = 2
endif
loop
Thats it.
So the game is set to 60 fps.
But it actually draws in to screen once every 2 loop cycles.
So you dont really get 60 fps you actually get a fake 30/60 fps.
And everything is extremlly faster yet battery consumption is half way down.
What!?
Try It and see for yourself
Btw, if you use tweens make sure to correct them to drawTime etc.
Nadav "Haliop" Rosenberg
Lets make the world great forever.