• Create Account

# How do i make a level with tiles?

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

14 replies to this topic

### #1rishan1996  Members   -  Reputation: 137

Like
0Likes
Like

Posted 09 September 2012 - 12:43 PM

Hi, I am using C++ and SFML2.0 and c++ Visual 2010. I want to make a level out of tiles but do not know how to. So far this is what I have done. I got 1 tile type and i am putting it together in photoshop to make a map. I then separate each string of tiles and put them manually into the code. So for one map i will be making over 30 Sprites and turn them into blocks and draw them out, then i will have to make boundaries for them separately. This takes a very long time and i am sure that there is a much faster way for example using xml but i don't know how to put that into the code. If you need the code just ask and i will post. Also just to clarify i dont want to make a tile engine which automatically makes them like minecraft. I want to make a puzzle map like bloody trapland so I will have to place them myself. Please help, urgent.

### #2kd7tck  Members   -  Reputation: 715

Like
1Likes
Like

Posted 09 September 2012 - 03:32 PM

Have a look at http://www.gamedev.net/topic/622801-sfml-tile-maps/. If you want specific answers like code, then you will have to post your program.

### #3Servant of the Lord  Crossbones+   -  Reputation: 18279

Like
0Likes
Like

Posted 09 September 2012 - 04:09 PM

I'd recommend reading this thread also, where I've explained the basic idea: (At the risk of turning this forum into someplace that just responds with links)

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                            [Need web hosting? I personally like A Small Orange]
Of Stranger Flames -

### #4rishan1996  Members   -  Reputation: 137

Like
0Likes
Like

Posted 11 September 2012 - 02:25 PM

i have already seen http://www.gamedev.n...sfml-tile-maps/ and don't want this. i recently made a map using "tiled map creator" but it is only one layer will i need more than one? if so why(just so i know when to do it)? I am completely new also i am using SFML 2.0 not 1.6. The 2nd post helped a bit. Also just some background info. I am 16 and started learning c++ in july and have finished a book and online tutorials, i will still have to go over it to understand it better. I am learning at home as i am in school still doing A-Levels if you know what that is. I am completely new to SFML but i am picking it up quite quickly. This is just a little project that im doing so i can build a strong and solid base before i go to uni in 2 years time. plan to go into game development. sorry got a bit sidetracked.

so once again i have built a map using "Tiled map creator" i am just using one tile but has one layer , i dont know if i need more, if so tell me. i want to know how i can load that map which is in a weird format into my game using sfml 2.0.

Edited by rishan1996, 11 September 2012 - 02:27 PM.

### #5Servant of the Lord  Crossbones+   -  Reputation: 18279

Like
0Likes
Like

Posted 11 September 2012 - 03:35 PM

Whether you need more layers or not depends on how you are designing your own game.
Maybe this will help you load the maps. Scroll down to the fourth post or so, and there's a SFML 2.0 compatible version.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                            [Need web hosting? I personally like A Small Orange]
Of Stranger Flames -

### #6rishan1996  Members   -  Reputation: 137

Like
0Likes
Like

Posted 11 September 2012 - 03:54 PM

i tried that before but did not understand how to install tinyxml and didnt understand it much. i am talking about the level.cpp and .h i will take a look again and try to understand it but on the weekend i dont have that much free time.

### #7Servant of the Lord  Crossbones+   -  Reputation: 18279

Like
1Likes
Like

Posted 11 September 2012 - 04:09 PM

Well, sometimes you run into walls. That's the time when you need to figure out how to get around or over the wall, instead of turning around and leaving thinking it a dead end.
If you couldn't figure out how to install tinyxml, that's the time to keep on trying to figure it out until you succeed, breaking each problem into tiny pieces and researching online how to get over that specific problem, step by step, until you succeed. If a specific problem gives you trouble, and after you've researched it and still can't find a solution, then post on a forums asking for help with that specific step (and mentioning what you've already tried).

I've never used tinyxml personally, but most libraries you don't "install", you download and then link to.

There will always be walls in your way; the skill you need to learn is how to get over them.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                            [Need web hosting? I personally like A Small Orange]
Of Stranger Flames -

### #8rishan1996  Members   -  Reputation: 137

Like
0Likes
Like

Posted 12 September 2012 - 09:58 AM

Yes that was what i was thinking last night, as that will be a valuable skill and a great skill for a game developer/programmer.

### #9html5dev  Members   -  Reputation: 116

Like
1Likes
Like

Posted 16 September 2012 - 09:45 PM

Hi,

Have you looked at Tiled Map editor? Its a free tile-based map editor with open-source. It has integration via xml and .Json I believe.

http://www.mapeditor.org/

Not sure if it will help for your game though.

### #10Pointer2APointer  Members   -  Reputation: 283

Like
0Likes
Like

Posted 17 September 2012 - 02:52 PM

Have you thought about a class or struct consisting of character arrays containing numeric letters to determine which tile to be used in conjuction with a function call to a scene renderer?

What I would do is create a class for the tiles, create a class for the scene renderer, and pass the appropriate tile/tiles as many times as you would like by simply sending an argument of which tile, how many tiles, their positions, to the scene renderer which then draws them on to the screen when necessary, and deletes the garbage(memory)needed when the tiles are offscreen or not shown, etc.

I'd say that SDL(SimpleDirect Media Layer)is a pretty easy library for blitting images to a window.

In SDL you can accomplish an image to the screen as easy as:

typedef SDL_Surface * LOAD;
LOAD Screen = SDL_SetVideoMode(800, 600, 32, SDL_FULLSCREEN);
SDL_BlitSurface(PlayerImage, NULL, NULL, Screen);
SDL_Flip(Screen);
SDL_Delay(3000);


You can also add some more data to maybe flag certain tile types as "solid" so the playable character or enemy will not walk over or "through" it.

Edited by Pointer2APointer, 17 September 2012 - 03:01 PM.

Yes, this is red text.

### #11rishan1996  Members   -  Reputation: 137

Like
0Likes
Like

Posted 20 September 2012 - 01:26 PM

Thanks guys i have found a way to use tiled map editor in a c++ program it was a precreated class file and header file and im using that. sdl does seam easier, what is the difference between sdl and sfml.

### #12Servant of the Lord  Crossbones+   -  Reputation: 18279

Like
4Likes
Like

Posted 20 September 2012 - 01:55 PM

There's no point switching to a new API just from a short snippet of code. I'd recommend SFML over SDL to C++ users in most situations, and I have experience in both APIs. That's not to say one is "better" than another, but you choose the right tool for the right job... and if your job is completing a game, and since both SDL and SFML would both be good choices, switching APIs is detrimental to meeting your goals.

SDL is a 'C' programming language API, that is usable in C++ and uses a functional interface.
SFML is a native C++ programming language API, using object-oriented principles and RAII.

They are both good APIs, but it's bad advice to go hopping from API to API (or language to language as some people also suggest), whenever a wall is encountered, especially when that wall exists in both APIs and switching wouldn't solve your problem anyway.

The issue you were having, was how to load a Tiled Map Editor map file in C++. That's a C++ issue, not a SDL or SFML issue. Both SDL and SFML are not natively familiar with Tiled Map Editor... and both have 3rd party integration with that format.

In my personal opinion, you should stick with what you are already using.

Edited by Servant of the Lord, 20 September 2012 - 01:55 PM.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                            [Need web hosting? I personally like A Small Orange]
Of Stranger Flames -

### #13Pointer2APointer  Members   -  Reputation: 283

Like
1Likes
Like

Posted 20 September 2012 - 02:53 PM

I agree.

I was just simply suggesting my opinion on SDL.

However, the goal of accomplishing tile editing and use in a game wouldn't make a difference between SDL and SFML.

To succeed in game programming you have to sometimes make your own way for things to get done from the ground up.

Like some others, I think game engines are a waste. Simple 2-D applicable game programming doesn't need any special libraries or such for the aid of game development process other than one to supply higher-level access to graphics/windows(which is pretty much all I use SDL for).

I write all of my game's features, I/O, graphics, sounds, etc. from my own native coding, not external engines.

Point is, I'd recommend you use what works best, and make sure you integrate things on your own rather than just using pre-existing code to handle the majority of the tasks for you. The more you learn, the more power you have over programming.
Yes, this is red text.

### #14rishan1996  Members   -  Reputation: 137

Like
0Likes
Like

Posted 24 September 2012 - 11:29 AM

Yeah i know now how to intergrate the tiled maps now just asked for difference to make sure i picked the right language to start with and to use in the futer for programming. Also for future reference what would you suggest i use for making 3d games? could i still use sfml or will that be too difficult also i heard of Unreal Dev Kit and heard that borderlands used it but when i used it, it wasnt much programming with c++ at all it was just making a map much easier without me inputing code which i want to.

### #15Servant of the Lord  Crossbones+   -  Reputation: 18279

Like
0Likes
Like

Posted 24 September 2012 - 12:20 PM

SFML can be used with OpenGL. SFML and OpenGL are APIs.

Unreal Engine is a game engine, which is abstracted to a higher level.
I've never used Unreal Engine personally, but it's certainly more than just a level editor. You were probably just using that tool... but alot of the Unreal Engine logic is handled with scripting (which is just like programming). Further, it is made in C++, but the C++ access is reserved for the real Unreal licensees (which cost serious bank), if I'm not mistaken.

There are plenty of 3D engines for C++ if you're looking for them. For example, see the Source engine. (Which also has a level editor, but that's not the entirety of it, and yes, you can write C++ code with it). Other engines exist, like Crystal Space and C4 engine, with various licensing terms and reasonable costs for commercial releases.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                            [Need web hosting? I personally like A Small Orange]
Of Stranger Flames -

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS