Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How to define 2d map size

Author
Message
Alaror
13
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 28th Jun 2011 19:34
I'm beginning work on procedural map generation for my game which will use a chunk loading scheme. Because of this I need to know where the player is in relation to the entire map, meaning that point (0, 0) should be the upper left most corner (in the sky) while point (xMax, yMax) should be the bottom right most corner (under the earth). Right now (0, 0) is the top left corner of the game screen.

What's the best way to go about doing this? I was thinking that at the start of the game four marker sprites could be created, one for each of the four corners. Will having a massive (but empty) map slow down the game in the slightest?
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 28th Jun 2011 22:24
Try setting up 3D plains as 2D tiles if you want to move them with out slow downs.

Moving too many sprites at once will slow down the whole game.

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Alaror
13
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 29th Jun 2011 07:28
The only sprites that will be moving are the player sprite and monster sprites. The rest of them will be stationary, created only when the player gets within a certain range and deleted once it's out of that range.

Again, I'm just trying to find the best way to define the map size so I can know exactly where the player is in relation to chunks.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 29th Jun 2011 09:55
The easiest way to do a 2D map is with a 2D array that usually stores either the image number or sprite number of each tile.



TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Jun 2011 10:34 Edited at: 29th Jun 2011 10:35
Quote: "Try setting up 3D plains as 2D tiles if you want to move them with out slow downs."


Sprites are already rendered as 3D plains, so there's no need to write your own sprite system

Quote: "Moving too many sprites at once will slow down the whole game."


Moving too many objects at once will slow down the whole game as well.

TheComet

Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 29th Jun 2011 12:02 Edited at: 29th Jun 2011 12:02
Quote: "Moving too many objects at once will slow down the whole game as well."


But when using 3D plain objects I can move the camera instead of the sprites or objects. I just thought he wanted to move the whole map :-P

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 29th Jun 2011 12:47
Quote: "Sprites are already rendered as 3D plains, so there's no need to write your own sprite system
"


Actually... I'd like to say that making a 2d world with sprites is a pain in the arse. You can only rotate a sprite around a given pixel (not a fraction of a pixel), and only position a sprite at a given pixel. This makes stuff like anti-aliasing pointless, and holes where two tiles don't quiite touch nearly unavoidable.

For a 2d map, you only draw/create the tiles that are onscreen. In 3d, this is super hard to do, but in top-down 2d, it's relatively easy. So, with top-down 2d stuff, it's a lot easier to have massive landscapes.

If I ever attempt a 2d game in DBPro, I'll make my own sprite system using 3d planes, TYVM. (I've made a pretty decent infinite map editor, with chunk loading, on-screen only drawing, and last but not best, sprites. When I couldn't work around some issues with sprites, I figured I'd better devote my time to learning more code stuffs)


Why does blue text appear every time you are near?
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Jun 2011 13:46
Good point, I didn't consider moving the camera. But still, I've pasted 5000 images to the screen every loop, and there isn't really any slow down...

@ Neuro Fuzzy

There are a few tricks with 2D, the one I use a lot is creating one large image and pasting all of the little tiles onto it. Then all I have to do is paste that image with the corresponding offset to the screen. I tend to stick to sprites when I make 2D games, it's by far the easiest thing to do, and you have complete control over the stack order.

TheComet

Alaror
13
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 30th Jun 2011 08:36
@Cybermind

I realize now what you were saying, you were just a step ahead of me in the thinking process! If I wanted to use sprites I would have to move the map, not the player. This is all kinds of complicated and seems like a huge waste of processing power, so I've opted for a 2d game made with the 3d tools. I had actually been toying with the idea before since there seem to be a lot of cool things you can do with 3d (effects and otherwise) which aren't supported in 2d, not to mention the built in camera feature.

In a roundabout way this also answers the question that prompted this topic. Thanks!

Login to post a reply

Server time is: 2024-11-27 21:43:26
Your offset time is: 2024-11-27 21:43:26