Jump to content

  • Log In with Google      Sign In   
  • Create Account

Kjansen92

Member Since 04 Feb 2013
Offline Last Active Feb 25 2015 02:12 PM

Posts I've Made

In Topic: Optimizing 2D Tile Map

05 December 2014 - 08:46 PM

Hey Ravyne,

 

I appreciate the super tips! 

 

Still implementing the compressed folder with all current serialization techniques, while building other functionality comes first right now.

 

With the rest of the tips offered here, processing speed has decreased multiple times already.

 

Thank you for all of your help!


In Topic: Optimizing 2D Tile Map

25 November 2014 - 09:14 PM

SeanMiddletich, thank you for your input. All things considered, compression is an obvious benefit in this scenario. I've tested all of the approaches and functions, and it is most definitely the loading from disc. 

 

ServantoftheLord, thank you as well. I would not have imagined that changing strings into binary format would be another approach.

 

Obviously, I have much to learn about this. Everyone here has given me a wealth of information on the subject, and I've found all of it useful and to be overall a better approach than what I was using. Not only that, it meets all of my optimization goals (even the lofty ones). 

 

Will leave an update after everything is switched over, with time differences, just for reference sake.

 

Thank again!


In Topic: Optimizing 2D Tile Map

25 November 2014 - 06:24 PM

Servant of the Lord, yes, they are text files, although by using Boost, switching to binary is very simple.

 

Ravyne, the maps do contain a lot of data. Again the 10,000 tiles in each (I know, an atrocity), as well as all of the objects. One example is a forest map (100 * 100), each containing about 5000 trees. Currently, the whole purpose for the tiles is simply for rendering. If I know which tiles are active, then I can render just the objects within those tiles.

 

Will look into compressing files, as that is one major question that I had - having a database that will allow loading of files as needed, and at the same time being able to compartmentalize files. 

 

One other direct application of the same functionality was to create a 300 * 300 tile vector in the Action Screen, and passing all of the objects into them. This way, if an AI unit wants to travel from map to map, it won't actually have to load very many objects (just things like buildings and geographical data), in order to determine travel time and long-term pathfinding.

 

Understanding that this is not comprehensive, I will give you the data here, so you may be able to help me.

 

Each map, currently, is 170kb, and by removing the Tile portion of each, will reduce that number to about 100kb. Saving objects separately will reduce that very dramatically.

 

The maps contain a few private integers and a string variable, as well as a private vector of objects. When the map is saved, it clears a global vector of objects, passes it's objects into it, and then serializes all of the data. 

 

The funny thing is that I don't even use tile images yet!

 

Will change serialization to binary, save objects in a folder separate from the map itself, and implement object passing to the Action Screen Tile vector.

 

Thank you for your insights. Just with this, the bottleneck will be almost gone, less the need to still load all of the objects of a map.


In Topic: When to Implement Game Loop

07 October 2014 - 11:34 PM

 

How are you implementing you game without a loop? In pretty much every game there are things that need to be repeated (even in text games), so how are you doing that now? goto? I don't even understand how you could make a game without a loop of some kind. Even an event driven game has a loop (it may be hidden from you but it's there).

There are always loops. IMHO, a typical beginner game is often just structured around the game logic with many different loops and many different ways to get input, like this simplified pseudocode:

int main() {
  show_intro();
  wait_for_keypress(); // first loop hidden there
  string answer;
  while(1) { // next loop that repeats each time a new game is started
    while(first_scene) { // next loop that repeats in same game state
      do { // next loop that waits for acceptable input
        show_question();
        answer=input_text(); // loop hidden here to collect chars
      } while(!text_validated(answer));
      do_something_with(answer);
      show_something();
      int number;
      do { // next loop that waits for acceptable input in a different way
        show_question();
        number=input_number(); // loop hidden here to collect chars and only let numerals through to convert them
      } while(!number_validated(number,lower_bound,higher_bound));

      // many more loops here
    }
    // many more loops here
  }
  show_end();
  wait_for_keypress(); // another loop hidden here
}

Then sometime later they hear about the game loop and hopefully do the mental leap to realize its just a simplification, by turning this mess inside out, cutting out all those hidden repetitions of slightly modified output, input, validations, loops and replacing it with just one loop and some conditionals inside.

 

Yes, although, one other implementation could last forever. This does not make it a game loop any more than RPG Maker makes a game.

 

The purpose of a loop is vital and easy to understand. 

 

It's the input/output of human energy consumption to anomalies in the creative approaches - that should be utilized to make practice that one notch better - that is valid information to explore objectively.

 

I don't care if the code hardly works, and I have no idea how to fix it yet. What's relevant is that those avenues are being explored, while being subjective to rigidity of code. 


In Topic: When to Implement Game Loop

07 October 2014 - 11:21 PM

How are you implementing you game without a loop? In pretty much every game there are things that need to be repeated (even in text games), so how are you doing that now? goto? I don't even understand how you could make a game without a loop of some kind. Even an event driven game has a loop (it may be hidden from you but it's there).

 

You could always pass a function and check for functionality. As long as your features work seamlessly, you could create a tutorial loop (such as, mentioned above) which allows active responding to game elements until that loop ends. 

 

With a standard loop like the one above, it would maintain forever the end desired game formula. 

 

Objectively, with a tutorial-type loop, you could actively test different parts of your game and improve them, without structuring game schematics.

 

Why else would I build anything other than to learn and produce? 


PARTNERS