I’m planning on making a 2D game with a massive randomly generated game world. The game world will be built up by many different pieces, like a set of legos.
What would be the least memory intensive alternative, pixel or vector based building blocks?
It’s not clear cut. It could be either. You could have a 1024x1024 texture containing tiles and build an absolutely massive tilemap from it. Or you could make it out of mesh triangles and have millions of triangles slowing things down. It depends more on what kind of a look you want.
A sprite is really just (at its most minimal) a pair of 2 triangles with a texture applied to it. If you break out of the goemetry restraints and use repeating texture then you could have any shape be textured. So that’s a bit more versatile if you want everything to be highly unique. But if you don’t mind some repetition then you can save a lot with tilemaps. Or you could go wild and have all totally custom textures for every single pixel which would be a huge memory hog.
Thanks guys! Tilemaps seem like the best solution for this, so that’s definitely something to look into for building massive 2D worlds (w/o toasting the CPU).
It really is a toss-up. Vectors aren’t the default way in which graphics are handled in modern rendering. However, the savings they can achieve in file size and scalability are pretty massive. And being based on mathematical equations as opposed to pre-determined arrays of color data, they are far more flexible when it comes to dynamic changes.
The best solution is probably going to be somewhere between the two. Possibly where certain underlying data is stored as vectors, and actual rendering data is stored as pixels. Of course, I think what you’re really referring to is more of a block-based approach. The comparison still applies, but in more of a data sense than a rendering one.