I'm trying to optimize the game I am working on. It's a space themed game and has an unbound layout. My stars and "radiation" layers are tiledbackgrounds using parallax. And to dress things up a bit I've added sprites of planets and nebulas.
My question is about the nebula. I've had my artist draw up a 1920x1080 image of a nebula on a transparent background. This doesn't seem very efficient to me. I'm only using the 1 nebula in the game, and its always in the same place on the unbound layout. So sometimes the player is over it and other times not.
I'd like to add a lot more nebulae and swirls of gaseous anomalies... would using a tilemap be effective for this? or are tilemaps for games with less detail? like blocky tile images?
I've read posts like: "It is not appropriate to use the Tilemap object to display large images. The tilemap object draws tile-by-tile, but can optimise if there are areas of the same tile. " So I was thinking I'd like to make a generic nebula tile map and then be able to draw a bunch of different shaped nebulae from it.
Anyone have any suggestions on how to do this? How to add more background elements efficiently?
Nebulas are irregularly shaped with wispy edges, assuming I could make a tilemap that would look good. I'm thinking 4x4 or 5x5 tiles (each tile 128x128 pixels?).
and I'd make a bunch of these in the game, different shapes and different colors (webgl).
so which is more efficient? five 1920x1080 images spread throughout the game that require 1 draw call each (requiring 8MB x5 of memory), or a 5x5 tilemap (totaling 640x640 pixels) requiring 20 draw calls (requiring <4MB of memory)?
There's probably no easy answer.. I guess my confusion is about draw calls versus memory...and how best to add background images to my game...sort of how they fill the background in SPAZ.
Develop games in your browser. Powerful, performant & highly capable.
Did you solve this? I achieve a sort of space-wispy-cloud affect in my game here - http://korelos.clay.io/
I didn't use tilemaps though. iirc, they're just a bunch of sprites.... hmmm, or maybe I used tiled backgrounds..... can't remember but can look back if you're interested.
farflamex, no I never did solve this, I made a tiledbackground that is around 512x512 huge: 40,000x40,000 the player could run out of it if they kept going in one direction for a long while.. but I try to keep the action close to the center..
I still need a solution. I was toying with the idea of making a set boundary and then making the edge push the player backwards as if some sort of gravitation pull is keeping them from going any further...not crazy about that idea though..
your cloud pattern looks animated! how did you achieve that? seems like its more than 1 image and they are moving with bullet? how do you keep them repeating way far out?