So nice that it is seriously screwing with my eyes. I imagine that is what it looks like when someone that really needs glasses takes them off.
Well done!
So nice that it is seriously screwing with my eyes. I imagine that is what it looks like when someone that really needs glasses takes them off.
Well done!
Yeah… It seems like your eyes like to do a gaussian-blurr-post-processing-shader instead of giving you a nice picture of what you see…
I’ve got eyes like that too, and if I stand up too quickly I get this wonderful particle effect too - just think of the power of the GPU in my head!
So everyone who’s ever done a tutorial or answered a question about making tilemaps is insane?
Do you mean I should do it with a 1D array and treat it as a matrix as described here
instead of this:
int[][] tiles = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
};
???
I certainly believe not all tutorials uses multi-dimensional arrays, but I get the sentiment.
There’s a ton of tilemap-implementations, and you can do it however you want. Using a single array is just more of a pain to implement versus the time spent. It’s not worth it, unless you’re looking for a tiny optimization. Mostly, you aren’t. The only “real” difference is the lookup time (it’s about double in the multidimensional), but it doesn’t really make a difference unless you’re quering a lot!
I think those tutorials use that memory layout for the sake of clarity, which is what a tutorial is all about anyway.
Eventually you’re going to store your level in a file, and from there on you don’t give a crap about what the sourcecode representation would be.
On the other hand, one dimensional or multi-dimensional array lookups (for a tile-engine) are not going to be your bottleneck either way.
Thanks for clearing that up. I was afraid I was in for a terribly confusing rewrite of my level-system :emo:
But since you’re querying all tiles in the tilemap (within the screen and all that) every update, wouldn’t it be a big optimization considering it takes half the time to do each look-up with a 1D array?
Don’t guess, measure.
Multiplying a tiny value by 2, still leaves you with a tiny number.
Erm… I’m kind of feeling old-school or whatever here…
I’ve always used two-dimenisonal arrays until I added my N-Dimensional array mapping class?!? (which was just some days ago…) ???
Please, may i use your Blooming.jar jar as a library in my game?