week 5, Loading screen

As our game has grown larger and larger asset wise over the weeks I guess it’s not that surprising that there might be a great amount of data that needs to be loaded for the game to start. This could of course have been handled differently than we did but we chose to load every game texture as the game starts, in comparison to load everything as it is needed. This is also a viable way to do it as the game only has one level and is rather small. If the game would have had multiple levels I guess we should at least have loaded only the needed textures and sounds for the current level that was playing.
The reason for a loading screen was because of some of the textures (e.g. the level background textures) was too large. This made the game freeze as the player pressed “Play” in the start menu and he would have to wait for about 10 seconds for the game to actually start. We figured that if you got to see the process of assets being loaded this wouldn’t give the player a reason to reach for the exit button in the top right corner too quickly.

Anyways, between the menu scene and the game scene we added our new loading scene. Before this we also added a texture cache class which would store all the needed textures for the game with a load- and a get texture function. The loading screen does the actual loading call for each texture to the cache class which may later be used in the game. It also loads in every sound needed through the sound manager which stores them for later use.

Once the loading screen is displayed on the screen we wanted, as mentioned, something for the user to visually see assets being loaded and as for now this is represented by two growing bars in the middle of the screen. One for textures and one for sounds. To make these grow we added two integers to the loading scene which we added a value to in between each loaded item. This might most definitively be changed to a more fitting way to represent process and growth which are more relatable to the game.

To make this feature work we used something called multi threading. (Be gentle with me from now on since my experience on this matter is below beginner level.) Anyhow, multi threading allowed us to do the loading process separately form the main process. Why? Because else we would have needed to call the draw function in between each loaded item as well as the integer additions. Now the main process only needed to keep track of those integers, scale the bars sprites accordingly and of course draw them to the window surface while the other thread loaded in the assets to its handlers.

loading

week 5, Loading screen

One thought on “week 5, Loading screen

  1. Well, I am not sure what to comment on. It is really well written. You start of by telling what you have done, why it was needed and then proceed to explain how you did it. Explain problems occuring during the process and how they were solved as well as why they were solved in that specific way. Textbook stuff, nothing to complain on.

    However like with everything it could have been explained deeper, the 400 words are just a minimum target and not a border that may not be crossed.
    Since I have not been in charge of making the loading screen in our project, and I am sure it is not done this way, I would have loved to read more into how and why you did. Get more out of the text, get more out of your experience. I get that you might be new to a lot of the things and that some things might be hard to explain deeper and that is fine but I get the feeling that most of the things you write about could have been explained further but that you might have been a bit to lazy to do it, that 400 words were enough. (Which it is though)

    But as I said, good post otherwhise. Textbook stuff and can’t really complain. Could have explained a bit deeper however you didn’t miss anything, all the parts that was needed where there. Keep it up! 🙂

    Like

Leave a comment