Author Topic: #CPCtelera Sprite Flipping Demo (WIP)  (Read 3544 times)

0 Members and 1 Guest are viewing this topic.

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
#CPCtelera Sprite Flipping Demo (WIP)
« on: 13:04, 31 March 16 »
We are working now on adding sprite flipping features to CPCtelera 1.4. and this is a first mini demo:

[youtube]https://www.youtube.com/watch?v=hCtLluBWhGQ[/youtube]
* Direct link to video (Youtube).
* Source Code
* DSK and CDT files

Features planned for CPCtelera 1.4. include:
  • Sprite direct flipping (flipping an sprite data array)
  • Sprite flipped drawing (draw a sprite flipped, without flipping it previously in data array)
  • Sprite flipped drawing with Interlaced Mask and/or mask table
  • Both horizontal and vertical flipping
  • Every function will have compact and fast versions
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:

Offline EgoTrip

  • 6128 Plus
  • ******
  • Posts: 1.058
  • Country: gl
    • http://egochip.blogspot.co.uk/
  • Liked: 704
  • Likes Given: 305
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #1 on: 17:34, 31 March 16 »
Nice. Look forward to that, will save loads of RAM. Will you also be adding sprite scaling too?
EgoTrip's Stuff
EgoTrip's Stuff

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #2 on: 17: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.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1985
  • Likes Given: 4650
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #3 on: 18:01, 31 March 16 »
Will you use expansion RAM for things like Sprite scaling, flipping etc.?
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #4 on: 19: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.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1985
  • Likes Given: 4650
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #5 on: 22:33, 31 March 16 »
Well, it's a lot of hard work. And you really archived something never seen before for CPC.  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #6 on: 15: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 in ASM:

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

Enjoy :).
« Last Edit: 16:25, 06 April 16 by ronaldo »

Offline reidrac

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.012
  • Country: gb
  • Trying to gamedev!
    • index.php?action=treasury
    • usebox.net
  • Liked: 1865
  • Likes Given: 1018
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #7 on: 19: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" ;)
« Last Edit: 20:31, 06 April 16 by reidrac »
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse and Brick Rick for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.003
  • Liked: 487
  • Likes Given: 82
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #8 on: 19:26, 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.

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #9 on: 20:32, 06 April 16 »
@reidrac: 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 :).

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2281
  • Likes Given: 3478
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #10 on: 11:06, 07 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.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #11 on: 14:32, 07 April 16 »
And there you another example. This time, a complete Mode 2 animation is flipped on every keypress. Enjoy :).

[youtube]https://www.youtube.com/watch?v=wIfO2q8wu34[/youtube]
(Video URL:
http://www.youtube.com/watch?v=wIfO2q8wu34)

Offline Rhino

  • CPC6128
  • ****
  • Posts: 291
  • Liked: 870
  • Likes Given: 366
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #12 on: 16: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,

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #13 on: 00:02, 09 April 16 »
@Rhino: 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 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 .

Offline reidrac

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.012
  • Country: gb
  • Trying to gamedev!
    • index.php?action=treasury
    • usebox.net
  • Liked: 1865
  • Likes Given: 1018
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #14 on: 20: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: I didn't think about this until you started this thread, so thanks a lot!
« Last Edit: 21:17, 09 April 16 by reidrac »
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse and Brick Rick for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

Offline Rhino

  • CPC6128
  • ****
  • Posts: 291
  • Liked: 870
  • Likes Given: 366
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #15 on: 15:16, 10 April 16 »
@Rhino: 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 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.

Offline AugustoRuiz

  • CPC664
  • ***
  • Posts: 121
  • Country: es
  • Liked: 157
  • Likes Given: 49
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #16 on: 23:10, 24 April 16 »
If the format for compiled sprites is specified, I would gladly include it in Img2CPC ;)

Offline Rhino

  • CPC6128
  • ****
  • Posts: 291
  • Liked: 870
  • Likes Given: 366
Re: #CPCtelera Sprite Flipping Demo (WIP)
« Reply #17 on: 14:05, 25 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.