Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Loop speeds;

Alright, I'm having major lag with the FOR loop.

I was wondering if the loop speeds vary. Like if While is faster then For or something.

I need to know for my Tilemap class. It works fine for small maps, but when it gets big the damn thing freezes.
 
Well, since you are talking about the Tilemap class, I'm guessing that in each loop it creates a bitmap. That might cause lag, because if I recall correctly, bitmaps take a while to make.

And about your original question, I think they are about the same, but I'll let someone else answer better.
 

Anonymous

Guest

It would only freeze if the loop is caught, i.e. never broken. Are you doing something like "for i in 1...@tilemap_tiles.size (note: that's not a real variable :D)" with a huge tileset? It may simply be that you have a slow computer. Sorry, that probably wasn't too helpful ;_;...
 
The speed of the loops is irrelevant (close to be the same in fact), it´s what is written inside it and/or the number of elements to evaluate that counts. If you could post the code used we could help you better....
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top