Question: levels

Hello. I have question about levels. I already know how to load new game levels (scenes) from blend files. It’s very handy for game creation. But what if i would like to prevent player skiping level just by launchuing another one from my levels directory. Game is fun when it’s challenging but if player can skip difficult place in level just by launching next one it’s not that cool.
So question is: is there a way in BGE (using blend files as levels) to force player finish one level before he can move to next one? Maybe somehow “lock” 2_level.blend, 3_level.blend etc, before player finished 1_level.blend. So he can’t just skip 1_level.blend and open *_level.blend in blender.

At the end of the level, have a sensor object. When the player collides with it, load the next level.

you can make a property I guess, when the player completes a task it increments…say from 0…then when they complete level 1’s task it adds 1…then the colider looks for that property(should now be 1) and if it matches the player can proceed…there are a million ways to do this. I’m not sure if you understand what I mean…but hopefully you do.

I would recommend using the “Save” feature in blender to store info about players progress in the game.
Example save file:
Level 1: 289 (score or checkpoint or something)
Level 2: 144
Level 3: -1
Level 4: -1

You can have a script at the end of your level that sets the score for the next level to 0. In each level you can load the score for that level and check if its 0 or above, if its not then quit the game.

Also when distributing the game to non Blender users you can just change the filename from level2.blend to level2 and most of them wont do the digging to find out that Blender can open the file.

If your game is based on tiles or tilesets you can store the level as a encrypted text file and load it with python to reconstruct the level during a loading screen.

Yeah but what can prevent player just skip entire level and load next level from blend files, where levels are placed. Say player get stuck on first level and instead trying to complete first level he will just load blend file contaning level 2 and so on.

Thank you for help. I guess i understand what are you saying. So if player has 0 property he won’t be able to start game on level 2 untill player object will get property 1. But what will stop one just to change this property to 1 inside blender (editing blend files) and start level 2 without completing level 1?

Thank you for your advice. I will take a look at save feature with scripts that saving game progress. Tho my knowleges of scripting is very poor. I’m still very newbie in BGE and especiall in Python programming. But I am learning. :slight_smile:

Nothing, but nothing stops you on any game neither from editing the saves. Only encryption and obfuscation can prevent an user from editing a save file, and they’re not really effective neither (you can just download a save from someone else).

online server and stream global data from a host.

no server,
no level.

Yeah, but efforts to decrypt files or finding save files(for small unfamous game) would be harder than just to complete level and pass to next one. And in case if level files are so easy to edit\open it’s easier for player just to skip difficult place and load level he want.

I recommend to think about what JustinBarrett and Josip Kladarik suggested.

You will need some sort of save/load system as the Game Actuator completely unload any game data including python modules. This means your level files need to load the saved status, extract the current level and if the level does not match load the correct blend from the file.

Due to the dynamic nature of that behavior you will need Python for implementation.

Thank you for help. Definitly I should learn Python not only for save-load system but for any other fancy features. I begun to watch some simple tutorials about Python scripting in BGE, and even wrote few primitive scripts which are working to my surprise. :slight_smile:

Monster also brings up a good point…if your player changes levels he will not maintain any changes from the old level…thus the need to save and load data when changing levels.