CPCWiki forum

General Category => Programming => Topic started by: ronaldo on 11:04, 31 March 16

Title: #CPCtelera Sprite Flipping Demo (WIP)
Post by: ronaldo on 11:04, 31 March 16
We are working now on adding sprite flipping features to CPCtelera (http://lronaldo.github.io/cpctelera) 1.4. and this is a first mini demo:


* Direct link to video (Youtube). (https://www.youtube.com/watch?v=hCtLluBWhGQ)
* Source Code (http://bit.ly/cpct-sprite-flip)
* DSK and CDT files (http://fremos.cheesetea.com/download/cpctelera-sprite-flipping-demo/#)

Features planned for CPCtelera (http://lronaldo.github.io/cpctelera) 1.4. include:
Use of special sort of sprites (like half-pre-flipped) will not be supported in this release, but is planned for future ones.

Enjoy! :D

Demo Credits:
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: EgoTrip on 15:34, 31 March 16
Nice. Look forward to that, will save loads of RAM. Will you also be adding sprite scaling too?
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: ronaldo on 15:49, 31 March 16
Yes, it's planed. However, it will probably be for future releases (say 1.5 or 2.0). There are many features to add and we are trying to order them starting from those we think will have greater use.
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: TFM on 16:01, 31 March 16
Will you use expansion RAM for things like Sprite scaling, flipping etc.?
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: ronaldo on 17:12, 31 March 16
Probably not in first place. We are considering giving direct support to CPC Expansions in the future, but that's still to be designed. First priority is giving nice support for standard CPC architecture.
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: TFM on 20:33, 31 March 16
Well, it's a lot of hard work. And you really archived something never seen before for CPC.  :)
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: ronaldo on 13:54, 06 April 16
Another Little video, showing Mode 1 Sprite Flipping. This example is fully coded in assembler, for those who want to learn and use CPCtelera (https://lronaldo.github.io/cpctelera) in ASM:


(Video URL: http://www.youtube.com/watch?v=4cJPMTr8y9s (http://www.youtube.com/watch?v=4cJPMTr8y9s))

Enjoy :).
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: reidrac on 17:10, 06 April 16
Very nice.

After your first example I though that perhaps you were drawing the sprite horizontally flipped on the fly, then I remembered how weirdly the CPC expects the pixel data to be arranged... and it wouldn't be possible to do it fast enough.

This technique is interesting, even if it requires a lot of flipping (eg, same sprite drawn several times facing opposite directions).

off-topic: I have an English teacher here that just said "astonishingly", re: "Astonishing fast Amstrad CPC game engine for C developers" ;)
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: andycadley on 17:26, 06 April 16
Quote from: reidrac on 17:10, 06 April 16
After your first example I though that perhaps you were drawing the sprite horizontally flipped on the fly, then I remembered how weirdly the CPC expects the pixel data to be arranged... and it wouldn't be possible to do it fast enough.
It's actually quite easy to do if you go via a 256 byte lookup table. And with a little cunning you can use the same trick for doing things like flashing a sprite when it is hit just by using a different lookup.
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: ronaldo on 18:32, 06 April 16
@reidrac (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1504): There are planned functions for drawing flipped sprites on the fly (and I've already implemented one of them, but it is still pending revision and documenting). Rearranging bits is "slow" but not so slow as not to be done on-the-fly, even without a look-up table. If you have a look at the implementation of these functions, the time/space requirements are measured and documented. You may check them as a guide to know if this kind of techniques suite your needs or not.


I assume that fast/slow constraints will mostly depend on the sort of game you wanted to do. Sometimes your sprites are most of the time facing the same direction (so you only want to flip them ocassionaly) and other times you need to flip them many times. Sometimes you have enough space for a 256-bytes look-up table, sometimes you don't.


The idea is giving the user alternatives for different needs. These examples are for functions not requiring look up table and flipping the sprite then drawing. It will take time, but I hope to provide variety to cover different needs :).


Also, thank you for the english tip :).
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: arnoldemu on 09:06, 07 April 16
Quote from: reidrac on 17:10, 06 April 16
After your first example I though that perhaps you were drawing the sprite horizontally flipped on the fly, then I remembered how weirdly the CPC expects the pixel data to be arranged... and it wouldn't be possible to do it fast enough.
Renegade and Gryzor do it on the fly. ;)

It is possible.
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: ronaldo on 12:32, 07 April 16
And there you another example. This time, a complete Mode 2 animation is flipped on every keypress. Enjoy :).


(Video URL: http://www.youtube.com/watch?v=wIfO2q8wu34 (http://www.youtube.com/watch?v=wIfO2q8wu34))
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: Rhino on 14:07, 08 April 16
Hi ronaldo,
Have you thought to include compiled sprites support in CPCtelera?
The inclusion of this tech in your engine may standardize this tech on CPC and do it more popular.
It is true that usually compiled sprites require more memory than other ways, but what you gain in speed can be useful in many cases.

And the same for compiled tiles.

Regards,
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: ronaldo on 22:02, 08 April 16
@Rhino (http://www.cpcwiki.eu/forum/index.php?action=profile;u=174): Yes, indeed :) . Compiled sprites are in the tasklist, like other types of sprites (zig-zagged, reversed, 50% flipped, etc). Altough they are not tagged high priority at the momment, they are in the list.

It will take a great amount of time having many techs in the library, due to the way we are developing it. Everything is developed slowly to include as much documentation and information as possible. The idea is developing slowly but delivering great quality.

However, CPCtelera (http://lronaldo.github.io/cpctelera) is open for everyone to contribute. You can have a look at its sources to get an idea of how it is organized and the way functions are coded, then send pull requests with your own code proposals for discussion and inclusion in the library. I'd personally be much more than happy to receive contributions if you want/have time to :D . Many people is already contributing by testing, reporting and sending proposals and that's always awesome, even when contributions are small :D .
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: reidrac on 18:42, 09 April 16
I tried flipping sprites on the fly with a 256 bytes table and it looks like it could be fast enough, and the memory saving is noticeable.

@ronaldo (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1227): I didn't think about this until you started this thread, so thanks a lot!
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: Rhino on 13:16, 10 April 16
Quote from: ronaldo on 22:02, 08 April 16
@Rhino (http://www.cpcwiki.eu/forum/index.php?action=profile;u=174): Yes, indeed :) . Compiled sprites are in the tasklist, like other types of sprites (zig-zagged, reversed, 50% flipped, etc). Altough they are not tagged high priority at the momment, they are in the list.

It will take a great amount of time having many techs in the library, due to the way we are developing it. Everything is developed slowly to include as much documentation and information as possible. The idea is developing slowly but delivering great quality.

However, CPCtelera (http://lronaldo.github.io/cpctelera) is open for everyone to contribute. You can have a look at its sources to get an idea of how it is organized and the way functions are coded, then send pull requests with your own code proposals for discussion and inclusion in the library. I'd personally be much more than happy to receive contributions if you want/have time to :D . Many people is already contributing by testing, reporting and sending proposals and that's always awesome, even when contributions are small :D .

Great !, I hope to find time to take a look.
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: AugustoRuiz on 21:10, 24 April 16
If the format for compiled sprites is specified, I would gladly include it in Img2CPC ;)
Title: Re: #CPCtelera Sprite Flipping Demo (WIP)
Post by: Rhino on 12:05, 25 April 16
Quote from: AugustoRuiz on 21:10, 24 April 16
If the format for compiled sprites is specified, I would gladly include it in Img2CPC ;)

Thanks!
As you say, the first step is to specify a standard format.
When I have some time, I will do a proposal in the "compiled sprites" thread, so that it can be discussed here.
Powered by SMFPacks Menu Editor Mod