scale sprites/tiles

SGDK only sub forum

Moderator: Stef

Post Reply
Helghast
Interested
Posts: 29
Joined: Sat May 25, 2013 8:53 pm
Location: Amsterdam, Netherlands
Contact:

scale sprites/tiles

Post by Helghast » Wed Jun 05, 2013 9:50 pm

Hey guys,

I'm trying to find a way to render my tiledata double sized (save tiles in vram), all I can find is sprite.size, which states it doesnt work for now, and you can only use it as size>>8.

Am I missing something, or not?
Am I wrong in assuming .size should scale, and if so, is there any ETA on that feature?

Kind regards,
Dennis

djcouchycouch
Very interested
Posts: 677
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Thu Jun 06, 2013 12:26 am

Hi there,

I'm assuming you're talking about the SGDK? The size in that case specifies the number of tiles the sprite uses in the structure. It doesn't specify a scale amount. The Genesis doesn't have any kind of hardware scaling feature.

DJCC

eteream
Very interested
Posts: 81
Joined: Tue Dec 22, 2009 2:13 pm

Post by eteream » Thu Jun 06, 2013 4:43 pm

..
Last edited by eteream on Sat Jul 20, 2013 8:30 pm, edited 1 time in total.

User avatar
Stef
Very interested
Posts: 2801
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Thu Jun 06, 2013 6:23 pm

You can eventually use this method :

Code: Select all

void BMP_loadAndScaleBitmap(const Bitmap *bitmap, u16 x, u16 y, u16 w, u16 h, u16 loadpal);
But it is intented to use with bitmap mode and that is definitely not really fast.

Helghast
Interested
Posts: 29
Joined: Sat May 25, 2013 8:53 pm
Location: Amsterdam, Netherlands
Contact:

Post by Helghast » Thu Jun 06, 2013 9:24 pm

I am indeed using SGDK, and have no knowledge of assembly, so that's kind of an issue :p
The VDP function, is that functional yet, or still wip? Any eta if not?

Thanks for the answers all!
-D.

Chilly Willy
Very interested
Posts: 2618
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Thu Jun 06, 2013 11:04 pm

In general, on the MD the artist is expected to scale any artwork by hand to make it look as good as possible. On the SCD, there is an ASIC that can do scaling and rotation for you.

djcouchycouch
Very interested
Posts: 677
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Fri Jun 07, 2013 12:29 am

Helghast wrote:I am indeed using SGDK, and have no knowledge of assembly, so that's kind of an issue :p
The VDP function, is that functional yet, or still wip? Any eta if not?

Thanks for the answers all!
-D.
One thing I want to make sure you understood is that the BMP_loadAndScaleBitmap() function is part of a special software rendering mode that Stef has in the SGDK. It's a software-based frame buffer. As it's done in software, it's quite slow, uses a fair bit of memory and you have to run at a lower resolution than normal to get ok performance. Stef can correct me if I'm mistaken, and he can definitely share more about it.

So, short version: On a stock Genesis, there are no hardware features for scaling sprites. There are techniques for faking it in various ways, but there is no easy-to-use, built-in feature.

User avatar
Stef
Very interested
Posts: 2801
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri Jun 07, 2013 8:54 am

djcouchycouch wrote: One thing I want to make sure you understood is that the BMP_loadAndScaleBitmap() function is part of a special software rendering mode that Stef has in the SGDK. It's a software-based frame buffer. As it's done in software, it's quite slow, uses a fair bit of memory and you have to run at a lower resolution than normal to get ok performance. Stef can correct me if I'm mistaken, and he can definitely share more about it.
You're totally right, thanks for explained it in detail :)

Helghast
Interested
Posts: 29
Joined: Sat May 25, 2013 8:53 pm
Location: Amsterdam, Netherlands
Contact:

Post by Helghast » Fri Jun 07, 2013 9:32 am

Thanks all for the replies!

Makes sense, I guess I am a bit too spoiled with engines etc nowadays ;)
I just wanted to see if there's an "easy" way to save memory tiles, by loading an image half the screen size, and displaying it twice as big.

Doesnt matter, I'll think of a way to design a better system instead!
(I actually have an idea for loading big maps now).

Thanks for all the help guys, loving this forum so far, gave me a huge insight into the hardware so far :D

regards,
-D.

eteream
Very interested
Posts: 81
Joined: Tue Dec 22, 2009 2:13 pm

Post by eteream » Fri Jun 07, 2013 10:27 am

..
Last edited by eteream on Sat Jul 20, 2013 8:29 pm, edited 1 time in total.

Helghast
Interested
Posts: 29
Joined: Sat May 25, 2013 8:53 pm
Location: Amsterdam, Netherlands
Contact:

Post by Helghast » Fri Jun 07, 2013 11:34 am

eteream wrote:RAM memory is really a restriction in old consoles. But the funny part is we humans become more creative if we have some restrictions, despite it sounds contradictory.

Usually the way to save memory is to repeat tiles or sprites. For example in some cases when a explosion happens on the screen you see lots of fireballs, but in memory there is just a quarter of an animation of a fireball (so every fireball is 4 sprites mirrored themselves).
I have done mobile games, not a big restriction as the megadrive, but certainly lots of trickery there like this.
I have though of several things similar to this kind of trickery :P

Next step is to write me a memory manager, with fixed entry definitions where to store certain data. Then on to see if I can get them tiling backgrounds to work ^_^

I love thinking creative like this!

regards,
-D.

djcouchycouch
Very interested
Posts: 677
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Fri Jun 07, 2013 2:01 pm

Helghast wrote:
eteream wrote:RAM memory is really a restriction in old consoles. But the funny part is we humans become more creative if we have some restrictions, despite it sounds contradictory.

Usually the way to save memory is to repeat tiles or sprites. For example in some cases when a explosion happens on the screen you see lots of fireballs, but in memory there is just a quarter of an animation of a fireball (so every fireball is 4 sprites mirrored themselves).
I have done mobile games, not a big restriction as the megadrive, but certainly lots of trickery there like this.
I have though of several things similar to this kind of trickery :P

Next step is to write me a memory manager, with fixed entry definitions where to store certain data. Then on to see if I can get them tiling backgrounds to work ^_^

I love thinking creative like this!

regards,
-D.
It might interest you to know that there exists Propeller, an SGDK-based game engine.

viewtopic.php?t=1373

Quick feature list:

- 8-way scrolling engine with "special tiles" the player can interact with like coins.
- object management system with per-object type collisions
- contains examples of effects, level structure, tile collisions, projectiles, enemy AI, player handling, animation, rotations and distance calculations
- python based tools to generate sin/cos and distance tables

It's not perfect and has sadly too little optimization. It's meant to be used as a example and as a base to start new projects. It usually goes that you'll probably want to write your own stuff, but you can definitely dig through the code for ideas. Certainly the code for 8-way scrolling of large maps will interest you.

Helghast
Interested
Posts: 29
Joined: Sat May 25, 2013 8:53 pm
Location: Amsterdam, Netherlands
Contact:

Post by Helghast » Fri Jun 07, 2013 2:05 pm

Thanks, I was actually looking at that before.
I am still having a hard time understanding scrolling, but I'll make a new topic for that at some point, first wanna try out some tests ;)

regards,
-D.

Post Reply

Who is online

Users browsing this forum: themrcul and 1 guest