Tilemap Scrolling (2D in 3D) - who the what now?

Blitz3D Forums/Blitz3D Beginners Area/Tilemap Scrolling (2D in 3D) - who the what now?

LineOf7s(Posted 2008) [#1]
I'm about to head off to bed, but this is something that's been floating about my head for a while so I thought I'd ask and maybe the answer will be here when I awake:

I've read a lot of stuff in my time about scrolling 2D tilemaps nicely and efficiently (only redrawing tiles that change, stuff about the edge tiles etc). That's all well and good, but the bit that's got me bejiggered is how to translate that to a 2D-in-3D system (eg SpriteCandy), in a general sense.

<begin ignorance>
Is it a case of doing all the same stuff, but then pasting the resultant tilemap onto a quad or something? And if so, then what? Scroll that quad around a bit?
<end>

I'm not looking for code, or any preboxed solutions - just a general conceptual idea of how this sorta thing works. I've Googled (granted, not like my life depends on it), but it doesn't seem to be something that people discuss much. Pseudocode me if you like.

It's just niggling me that I don't know where to begin with the idea behind it. Please, deniggle if you can.


Rob Farley(Posted 2008) [#2]
Just do your standard 2D stuff, then do a renderworld before the flip making sure the cameraclsmode is off.

This way you'll get the 3D over the top of the 2D.

I did this with the Alien Breed community project, had a scrolling 2D tile map with 3D models and sprites running around on it.


LineOf7s(Posted 2008) [#3]
Ah... no. Thankyou anyway, but...

I'm not doing a mix of 2D and 3D per se. I'm doing a 2D thing (think....err... Paradroid), but instead of doing it with your standard DrawImage/DrawBlock or whatever, I want to be rendering it all with a 2D-in-3D single-surface sorta system (again, like SpriteCandy. In fact, exactly like SpriteCandy) so it's all being done using the black magic of 3D.

2D-in-3D. Not "2D and 3D".


Rob Farley(Posted 2008) [#4]
Ah I see where you're coming from now...

Well personally to do that I'd create a mesh of quads (or however many you want on screen at one time), make each quad a different surface then paint the surfaces with the correct tile.

This mesh will be slightly bigger than the screen so you've move it until a tile was completely off screen, jump it back on screen and repaint the surfaces... No idea how fast this would be though.


big10p(Posted 2008) [#5]
Couldn't you just have your quads on a single surface and plonk all your tiles to a single texture?


Rob Farley(Posted 2008) [#6]
That would work well actually, then just adjust the UVs of the quads.


QuickSilva(Posted 2008) [#7]
That`s how Sprite Candy does it I think. Keeping the amount of surfaces down reduces slowdown too if I remember correctly.

Jason.


LineOf7s(Posted 2008) [#8]
Okay, now we're getting somewhere. :)

Let's get more specific: I'm looking to adapt the following library of functions (that I'm rather fond of) to work with Sprite Candy (that I'm also rather fond of), and from studying it, I'm sure really the only functions I need to deal with (mainly) are the Simplscroller_Draw function and the SimpleScroller_DrawRegions one.

From what I understand, the various functions use the dark arts to split the screen up into regions and determine what tiles need drawing to which region (based on what tiles are animating etc). It draws (using good ole DrawImage) the appropriate tiles to the image in a particular buffer, then uses DrawImageRect to draw the four sections of that buffer to the BackBuffer() before Flipping and livin' la vida loca.

Now, being the 3D mega-ultra-n00b that I am, I'm having trouble conceptually working out how to exchange out the DrawImage and DrawImageRect commands to replace them with Sprite Candy equivalents. If you know Sprite Candy, then sweet (feel free to tell me!), but otherwise I'm just looking for some guidance on the concept so I can adapt it to Sprite Candy myself.

See? :)

Here's the library I made reference to, if it adds detail to what I've said:



LineOf7s(Posted 2008) [#9]
btw, it's entirely possible in my current drug-addled state (wisdom tooth extraction) that I'm just not looking at this closely enough and if I did it's rather straightforward.

If that's the case, feel free to call me on it. :)