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.

DarkBASIC Professional Discussion / Where to start..?

Author
Message
Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 21st Jun 2010 02:06 Edited at: 21st Jun 2010 02:10
I'm lost as to where to start with.......coding a map editor. Anyone done this? My "levels" that I need to pump out are like a 2d tile map [ie....Map(x,y)], and it's got differant layers. Is there a definante or recommended way to make an editor for this type of map? Any Tips? I'd gladly accept some psedo(I'd rather code it myself for learning purposes...) code or any advice........

Tom0001
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location:
Posted: 21st Jun 2010 03:44
I think you need to give us some more detail on what exactly your editor is going to need, but...

I'd imagine you'll want to give the user a way to input the size of the map, in squares. Say, a bar on the right with images of what you want to place, such as grass or water or whatever.

Using FOR loops, you could make 3D objects and check if the mouse is over them and when it's clicked, texture them with what you need, for grass or water and set their values such as whether or not they're passable and such.
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 21st Jun 2010 12:19 Edited at: 21st Jun 2010 12:19
You just need to think carefully on how you will manage everything. A few basic questions:

How will you manage your layers and their tiles?
You can use a simple array to store them.



But then you must also be aware of the limitations of this method. For example, layers can only have a fixed width and height, and swapping layers might be hard.
A possible solution might be using memblocks to store the tile data:



Here the memblock contains the image numbers (a DWORD for each tile for example). This makes managing layers much easier. You can also use the array index as the layer priority order for drawing.

How will you draw tiles to the screen?
A small map of 50x50 tiles might be able to be drawn using nested for loops, but much larger maps can be supported if you only redraw the parts that need redrawing. This obviously results in more complex code.
You can choose to draw to a separate bitmap and copy that bitmap to the screen so you don't have to worry about clipping tiles, but be careful not to make bitmaps that are too large to save some RAM memory.

Misc
I consider those first two to be the basic questions you really have to ask yourself before starting this project. Pretty much all other features depend on this. Most other features, most likely won't depend on each other so you can divide those into separate groups.

Cheers!
Sven B

Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 21st Jun 2010 19:01
Thanks Tom, Sven B...
I slept on this, and before logging on, I'd actually thought about some of these.......and others i'd completely overlooked. Taking from Tom, I'll set up a good Gui first, then worry about storing my tiles position and what not.........Thanks! I'll put these suggestions to good use....

Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 21st Jun 2010 20:42 Edited at: 21st Jun 2010 20:44
K, I've gotta problem. Look at this code:





Dim Tileset(32)..... I cant seem to get layers set up, cuz i cant dim like this :




Or must I use Types.....?

anyway to do something like this?

Don Malone
23
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 22nd Jun 2010 06:21
Actually your array can handle that easily. Quoting from the help file

Quote: "You are able to create arrays with up to five dimensions."


Don Malone
Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 22nd Jun 2010 22:37
@ Don

See, I know that's what it should seem like. but, i'm using



To capture my tiles.

Help?

Login to post a reply

Server time is: 2026-07-25 08:30:09
Your offset time is: 2026-07-25 08:30:09