How to use this spritesheet?
Moderator: Stef
How to use this spritesheet?
I have read documentation and understand most of it. Im seeing the feasibility of a computer game to mega drive. Many question have arised, one of them:
1)how would i approach to use a spritesheet like this?
i have the code that joins the parts and renders ingame, but not the rendered image separetedly for each frame animation.
2) whats the maximum "sprite" width/height size?
thx
1)how would i approach to use a spritesheet like this?
i have the code that joins the parts and renders ingame, but not the rendered image separetedly for each frame animation.
2) whats the maximum "sprite" width/height size?
thx
Re: How to use this spritesheet?
Hardware sprites can be from 8x8 pixels to 32x32 pixels, any combination in increments of 8 pixels. So you need to fragment those images.
So maximum hardware sprite size is 32x32 pixels. By software, combining all 80 hardware sprites (so a software sprite), you can do a single 320x256 pixels sprite, for example, just to understand max capabilities.
BUT usually in MD the hardware sprite capabilities is not the limiting factor, instead typically this two are:
- Size of video memory
- Cpu performance to maintain several Actors/entities/objects
So maximum hardware sprite size is 32x32 pixels. By software, combining all 80 hardware sprites (so a software sprite), you can do a single 320x256 pixels sprite, for example, just to understand max capabilities.
BUT usually in MD the hardware sprite capabilities is not the limiting factor, instead typically this two are:
- Size of video memory
- Cpu performance to maintain several Actors/entities/objects
HELP. Spanish TVs are brain washing people to be hostile to me.
Re: How to use this spritesheet?
Lower the resolution, tweak the sprites to fit in a grid of 8x8 pixels, and for animations, place the sprites belonging to a certain part/animation in a horizontal line.
You can convert these into tiles, or if you want to use some of the rescomp features, you can save the sprite sheet as: 16-color indexed PNG(15 if it has a transperency layer), or an 8-bit BMP-bitmap with indexed colors too.
For example:
then point to your image file through a header like so:
So for example
Then you include the header file in your game with
and then you can get both the palette data and sprite from the resources by referring to the sprites by their sprite name.
You can convert these into tiles, or if you want to use some of the rescomp features, you can save the sprite sheet as: 16-color indexed PNG(15 if it has a transperency layer), or an 8-bit BMP-bitmap with indexed colors too.
For example:
then point to your image file through a header like so:
Code: Select all
SPRITE <spriteName> "<spriteFilePath&name.png/bmp>" <SpriteWidthInTiles(8x8)> <spriteHeightInTiles> <CompressionLevel>
Code: Select all
SPRITE player "gfx/player.png" 4 3 BEST
Code: Select all
include<"headername.h">
Last edited by Boyfinn on Sun Dec 17, 2017 8:04 pm, edited 3 times in total.
Re: How to use this spritesheet?
Thanks! Thats Very clarifying
Can i do parallax with plan a and plan b? If so is It a good Idea?
How to check for vram use It is It Just simplesmath(which i cant figure out ahah)
Can i do parallax with plan a and plan b? If so is It a good Idea?
How to check for vram use It is It Just simplesmath(which i cant figure out ahah)
Re: How to use this spritesheet?
You can do parallax with them, and if you want to simulate even more layers of parallax you can do tile scrolling, or for an illusion of 3d perspective, line scrolling.
Use the Kmod for GENS emulator to check how many tiles you have free in your vram.
There should be space for around 1300 tiles.
Use the Kmod for GENS emulator to check how many tiles you have free in your vram.
There should be space for around 1300 tiles.
Re: How to use this spritesheet?
It's probably the most common use ever made of those (plane A as foreground, plane B as background).
Also don't forget linescrolling to get extra "layers" that don't overlap (but move at different speeds) in the background, that's how you get e.g. mountains scrolling faster than clouds (there's a dedicated table for this, don't waste time with raster effects).
Sik is pronounced as "seek", not as "sick".
Re: How to use this spritesheet?
thanks for the help everybody. I still have some doubts
how do i make a "infinite" scrolling background? like when the last background tile goes "back" when scrolled all the way around. Is there a way to do it automatically?
btw, the original WIP game is here:
https://greenjuiceteam.herokuapp.com/ ( it might take a while to load, after that SPACE and directionals to play)
==============
some porogress.. still a lot to go i think ill have to fine tune the animations at some point. im using the automatic animations for now, but if handled manually it might look better
how do i make a "infinite" scrolling background? like when the last background tile goes "back" when scrolled all the way around. Is there a way to do it automatically?
btw, the original WIP game is here:
https://greenjuiceteam.herokuapp.com/ ( it might take a while to load, after that SPACE and directionals to play)
==============
some porogress.. still a lot to go i think ill have to fine tune the animations at some point. im using the automatic animations for now, but if handled manually it might look better
Re: How to use this spritesheet?
The background plane is 640 pixels wide, fill that with tiles and it should repeat when you scroll through it.
Re: How to use this spritesheet?
Um, no? The size of the tilemaps can be configured, but 640px is not one of the available options (it'd be either 256px, 512px or 1024px).
If the background is exactly one of those sizes, great, otherwise you'll have to be writing new tiles into the tilemap as the background scrolls (as long as the tiles that are visible on screen are present in that given frame you'll be OK). Note that the tilemaps themselves do wrap around, no need to rewrite everything because you reached their boundary.
If the background is exactly one of those sizes, great, otherwise you'll have to be writing new tiles into the tilemap as the background scrolls (as long as the tiles that are visible on screen are present in that given frame you'll be OK). Note that the tilemaps themselves do wrap around, no need to rewrite everything because you reached their boundary.
Sik is pronounced as "seek", not as "sick".
Re: How to use this spritesheet?
thanks, any tutorials and apis to scroll the background? the sprite sample has backgrounds but i dont see any samples on how to scroll them =/
Re: How to use this spritesheet?
Oops, i didint notice i wrote 640.Sik wrote: ↑Wed Dec 20, 2017 2:37 pmUm, no? The size of the tilemaps can be configured, but 640px is not one of the available options (it'd be either 256px, 512px or 1024px).
If the background is exactly one of those sizes, great, otherwise you'll have to be writing new tiles into the tilemap as the background scrolls (as long as the tiles that are visible on screen are present in that given frame you'll be OK). Note that the tilemaps themselves do wrap around, no need to rewrite everything because you reached their boundary.
I meant 512.
As for the scrolling, when you initialize all the stuff for your game, like setting the background and so on.
Change the scrolling mode of your plane with VDP_setScrollingMode(<HscrollMode>, <VscrollMode>)
It takes two vaues, the first value declares the horizontal scroll and the second value is for vertical scroll
the horizontal value can have one of these as its value depending on what you're going to do:
Code: Select all
HSCROLL_PLANE
HSCROLL_TILE
HSCROLL_LINE
Code: Select all
VSCROLL_PLANE
VSCROLL_2TILE
Code: Select all
VDP_setScrollingMode(HSCROLL_PLANE, VSCROLL_PLANE);
Next, in your game loop you need to scroll the background with VDP_setHorizontalScroll(<planeToScroll>,<scrollAmount>), like this:
Code: Select all
VDP_setHorizontalScroll(PLAN_A, scrollValueVariable);
If you calculate your position with a fixed-point number you can turn it into an integer with the function:
fix32ToInt(value)
or
fix16ToInt(value)
Depending on which type you use.
But this isn't necessary if the value you want to use for your scrolling is an integer in the first place.
Re: How to use this spritesheet?
thanks very much it would be nice to have a compilation of samples like these in the wiki or github. Not much is covered currently github has some tutorials, but a bit outdated i think. good thing we have this forum =)
Re: How to use this spritesheet?
Yeah, i think the docs should have examples for most of the functions