Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Tile map editor.  (Read 2687 times)

0 Members and 1 Guest are viewing this topic.

DingusKhan

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Tile map editor.
« on: October 15, 2014, 06:15:43 pm »
Hi guys!

I've been working with C++ and SFML for a short while and when I was learning, I was told that having a multidimensional array or vector was a good way to load tile maps. I'm new to SFML and games development in general, so I worked with this for a while. After setting up a few small programs that used this, I began thinking about other methods of storing maps that allowed a little more freedom, and eventually came up with my current method. I'm not sure if it's in use elsewhere, as I was basically "winging it" and building it as I went instead of doing research on the topic.

Basically, I start with a single sprite and a single texture. I then set up the sprite how I want it, and push it back into a 1D vector of sprites. I then change the sprite again and push it back again. I do this over and over, until I have my map set up. To assist this, as writing it every time was a huge pain, I wrote a small level editor. It's not as feature-rich or nice to look at as something like Tiled, but I was programming to fill a need and it worked well for my projects, so I thought I'd share it.

Some information:
-Maps stored in txt files
-Tiles bound to a grid or freely placed art (or a combination) can be used
-Includes very, very basic collision
-Fill tool
-Rotation
-Adjustable tile and grid size
-Adjustable screen resolution
-Editor, test application, sample art, levels and test application source code in just over 3mb
-Compressed in a 7Z to under 1MB for attaching to this post
-More information in the readme

If this can be of use to you, feel free to use it in any way you like. I'd appreciate being credited, but it's not a requirement. There is absolutely no copyright on this whatsoever. Attached to this post is 3 screenshots and a the editor. The source code for the editor is not included, but I may release it if anyone actually uses it.

Thanks.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Tile map editor.
« Reply #1 on: October 16, 2014, 07:58:29 am »
Cool! :)

Btw a more efficient way to handle tile maps is using a vector of vertices. That way you can draw the whole map with one draw call, significantly increasing performance. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything