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

Author Topic: Drawing a (big) non tiled map  (Read 2478 times)

0 Members and 1 Guest are viewing this topic.

Naz

  • Newbie
  • *
  • Posts: 7
    • View Profile
Drawing a (big) non tiled map
« on: November 15, 2014, 12:27:22 pm »
Hello,

I am currently working on a new game where I would like to make a map, which is not tiled. It is going to be a side scroller with platforms. For a example, something like this : http://www.gamerjargon.net/wp-content/uploads/2012/10/newsupermariobrosu_600x334.png

Anyways, my design at this moment is:
- I have seperate layers, background, first layer, second etc.
- I draw all these layers to a sf::RenderTexture, since the map is static anyways.
- Every time the player moves, I use sf::View to make sure the right part of the RenderTexture is shown

Besides that, if a monster walks or something else non static happen, I draw this after the RenderTexture to my window.

Now I wonder about this design, since I read some things about that aRenderTexture can't be to big? Maybe some of my maps are going to be 3000x3000, would this be a problem? And if so, how could I solve it?

Gr

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Drawing a (big) non tiled map
« Reply #1 on: November 15, 2014, 12:37:42 pm »
Either render all the objects individually (not to a render texture), and cull the ones that are outside the screen. This should not be a performance problem if there are not millions of objects to draw; especially not when you can use vertex arrays.

Or, draw the background to multiple render textures, and draw the (probably 4) render textures that are in the player's view to the window.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Naz

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Drawing a (big) non tiled map
« Reply #2 on: November 15, 2014, 01:27:54 pm »
Either render all the objects individually (not to a render texture), and cull the ones that are outside the screen. This should not be a performance problem if there are not millions of objects to draw; especially not when you can use vertex arrays.

Or, draw the background to multiple render textures, and draw the (probably 4) render textures that are in the player's view to the window.

But if you make the curent view of the player in lets say 4 render textures, you will have to make 1xx render textures for a big map right?

Also when would you use a render texture then if this is not the ebst scenario?

Also a vertex array works only with 1 texture right?