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

Author Topic: How to make a tiled program less laggy  (Read 1602 times)

0 Members and 1 Guest are viewing this topic.

BeautiCode

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
How to make a tiled program less laggy
« on: July 30, 2014, 05:23:06 am »
So I'm fairly new to SFML, I have a new game in development which is almost complete.
It's sort of laggy though, it has a big tilemap and theres a character ontop of the tiles that move around.

It's sort of like this

int main()
{
       while(window.isopen())
       {
               while(pollevent)
                 {
                         CHECK_IF_HOLDING_KEY_AND_MOVE_CHAR_POSITION_IN_DIRECTION();
                 }
         DRAW_AND_DISPLAY_CHARACTER_AND_ALL_TILES();
         }
}
 

It's sort of skippy.       

Strelok

  • Full Member
  • ***
  • Posts: 139
    • View Profile
    • GitHub
Re: How to make a tiled program less laggy
« Reply #1 on: July 30, 2014, 06:10:14 am »
Try this way
int main()
{
SOMEGENERICFUNCTIONALLINCAPSLOCK();
return 0;
}

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: How to make a tiled program less laggy
« Reply #2 on: July 30, 2014, 06:19:14 am »
Draw only the tiles that are inside the view.
And maybe use vertex arrays, if you're not already using them.

BeautiCode

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: How to make a tiled program less laggy
« Reply #3 on: August 01, 2014, 03:04:44 am »
Alright thanks guys