Horizontal bitmap scrolling technique

More
1 hour 27 minutes ago #186 by ludojoey
Thank you the tip!

Yes, some frames are missing.
I will try to optimize, but as I want that everything move (!!) I am afraid that the time to make moving all the elements is much more than one frame !

Thanks again, I learn a lot of things with micro-8 !
The following user(s) said Thank You: Franck

Please Log in or Create an account to join the conversation.

More
33 minutes ago - 29 minutes ago #187 by Franck
Remember that the Lofi compiler is a simple single pass compiler that does not perform optimizations on its own, it compiles source code as-is.

So a few things to keep in mind:

Minimize computations, pre-compute if possible. Ex: a=9; is faster than a=4+5;
Calling functions requires arguments to be pushed to the stack during call, than pop from the stack in the function execution. Sometimes it's better to just inline stuff (performance wise), even if it is less 'pretty'.
Custom types are particularly heavy to pass around. If a function just uses a single member, it is better to just pass the member beforehand for instance. Being able to pass custom types as references would be better but it is what it is at the moment.

Back to the scrolling topic, time dilution is a powerful tool that can reduce dramatically the cost of copying the tile buffer. Thanks to the double buffered tile buffer and the hardware scrolling, say you move 2 pixels/frame, you can copy 1/8th of the draw buffer each frame and only swap the buffers once complete, dividing the cost by 8. The slower the scrolling, the more you can divide, making it pretty much costless.


 
Last edit: 29 minutes ago by Franck.

Please Log in or Create an account to join the conversation.

Time to create page: 0.163 seconds
Powered by Kunena Forum