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

Author Topic: Best way to create tilemaps?  (Read 2604 times)

0 Members and 1 Guest are viewing this topic.

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Best way to create tilemaps?
« on: July 23, 2012, 03:29:14 am »
For my engine that I'm creating, I want to include tilemap support. The problem is, I want several different things and I don't really know how to do it in a clean, simple way. A way that I know I could do it is with multidimensional arrays and manually assigning them in code, but I'm not so sure that's the easiest way. Is there a way to read the values from a txt file or XML file? I also want to make it to where some tiles have collision against them. Like for example, if you attempt to run onto a rock tile, you would collide against it and stop. Same with water, etc. Help is greatly appreciated, thank you for your time.
Current Projects:
Technoport

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Best way to create tilemaps?
« Reply #1 on: July 23, 2012, 03:34:41 am »
Ever heared of Google? ::)
Tilemaps aren't something new and there's alot of stuff out there that can teach you how to use  and imppement tilemaps. SFML has no special function specific for tilemaps.
It's adviced to use a sf::VertexArray for the drawing of the tilemap.
But maybe you're lucky and someone will explain it to you in detail here. :)

(Also the forum search function will find you a lot of topics about tilemaps...)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: Best way to create tilemaps?
« Reply #2 on: July 23, 2012, 03:46:13 am »
Trust me, I've googled it A LOT, but I wanted to know C++/SFML specific ways to make it easier, because a lot of tutorials were with like cocos2d with Objective-C, or Java. And I'll read up on VertexArrays, and it would really be nice if somebody explained the concept just a bit  ;D
Current Projects:
Technoport

game_maker

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • Email
Re: Best way to create tilemaps?
« Reply #3 on: July 23, 2012, 05:10:12 pm »
I created a tilemap loader (credits for  eXpl0it3r).

The tiles are written this way in the file:

path.png:x:y:xscale:yscale

It's very useful.

If u want, contact me.

My MSN: pedroh.souza13@hotmail.com

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: Best way to create tilemaps?
« Reply #4 on: July 23, 2012, 06:16:51 pm »
All the tiles are going to be the same size which is 16x16 pixels, but thanks for the info
Current Projects:
Technoport

 

anything