How much can be done within one area and layers for a longer game?

I would like to know, while the game engine was designed for small scenes, how many mini games could work out in one, using the scenes, you can’t use the layer for a scene change from one area to the next. All mini games require small area for stability. So to make a longer game, having them connected is possible using small parts for one mini game, but what about linking game to game?

Can it be done to play from scene 1 to 3 and then restart the one that ends game over, without starting from the beginning?

if you want a game with multiple levels, and restart the same blend when you fail or for what ever the reason is, then you need libload. It is designed for this in particular. and then you can use loading screens to.

It’s just a matter of making 1 blend with all over and underlay scenes, and a main scene. Then you load in your level.blend into the main scene, once level is done, you call libfree() to remove the loaded blend and then you can load in level2.blend. you can do this unlimmited amount of times. The plus is you just open 1 blend to start, you can then use the hud as an inventory or even the player. This means you can easily use hud information, or data that you want to use in multiple levels, just by putting that data into the hud scene. And while you doing it through libload then save and loading get’s very easy too.

But i know you struggle with python, so i assume that would be a bit to hard to pull of for you. This means the best way for you to do it is by using the game logic brick, level complete then with that brick load the next level.blend.

But to fully use that so you can transfer data from 1 blend to an other you still need a custom save and load for those data.

Of course you can use scenes as levels, the scene brick can switch scenes back and forth. For a small game using scenes as levels is more then enough.

I had the idea few years back, I think I can may be do what I want all in one, but for one scene or two, restart option for each of them while playing them would be better. I’ve tried one scene layor, so it begins with a cut scene then moves to the robot scene, the one you made with the code. Hmm, the next would involve another one once the robot has been eliminated, I guess I would need to just add an object to bounce into and then loads a new layer, the programming shouldn’t matter or interfere with it since the file you got working ran on python for collision, bullet, so on.

The key to keep scenes small and move ahead where possible, and practical, having long ended scene in an unstable game engine, bouncing around, probably is where the scene I tried where the player went one from scene to the other and the camera angle just went bonkers. The video on youtube really summed the buggy problem of moving away from the center to far.

Exactly, so if you learned a bit python by know then you can simply change the script to skip to the next scene, this really isn’t hard to do.

this is i belive from 40km2 radius so 20km up, down, left and right from the center. that means plenty of room to play with :wink:

I don’t know.

#####################

Created by Cotaks

#####################

from bge import logic

def bullet_action(cont):

own = cont.owner

if not allPositive:
    return

speed = 100
damage = 10
bullet_drop = 0.0015 # higher means faster drop
hole = 'bullet_hole' #name of the bullethole plane

distance = speed/logic.getLogicTicRate()

own.applyMovement([0,distance,-bullet_drop], 1)

y_vec = own.worldOrientation.copy().col[1] 
y_vec.magnitude = distance

end_vec = own.worldPosition.copy() + y_vec
ray = own.rayCast(end_vec, own.worldPosition.copy(), 0)

if ray[0]:
    
    if 'health' in ray[0]:
        ray[0]['health'] -= damage
        
        if ray[0]['health'] <= 0:

            if 'enemy' in ray[0]:
                player = own.scene.objects['Hitbox_FPS']
                player['score_count'] += 1
            
            if not 'player' in ray[0]:
                ray[0].endObject()
                    
    bullet_hole(cont,ray,hole)

def bullet_hole(cont,ray,bullet_hole):

own = cont.owner
own.endObject()

#300 is the duration timer (second * 60 so 5 seconds) 
bullet_hole = own.scene.addObject(bullet_hole, ray[0], 300)

offset = ray[2]
offset.magnitude = 0.001

bullet_hole.alignAxisToVect(ray[2], 2, 1)
bullet_hole.worldPosition = ray[1] + offset
bullet_hole.setParent(ray[0])

def player_healthbar(cont):

own = cont.owner

player_health = get_object('gameplay scene','Hitbox_FPS')['health']
own.playAction('Plane.002Action.001',player_health, player_health)

def enemy_healthbar(cont):

own = cont.owner    

enemy_health = own.parent['health']
own.playAction('enemy_healthbar.002',enemy_health, enemy_health)

def get_scene(scene_name):

scenes = logic.getSceneList()      
scene = None
     
for sce in scenes:
    if sce.name == scene_name:
        scene = sce

if scene == None:     
    print('\n*** No scene found with the name: ' + str(scene_name) + ' ***\n')
else:
    return scene

def get_object(scene_name, object_name):

scene   = get_scene(scene_name)
object  = scene.objects[object_name]

return object    

def allPositive(cont):
for sensor in cont.sensors:
if not sensor.positive:
return False
return True

This is from the robot scene, so once knocked of by the robot the lay again code loads or scene, I tried removing the restart scene, no change, is it in the code?

No, you could see it by yourself it’s in the bricks.

I messed around with it, but yeah I don’t know.

The problem with having one game in another is it leads to clashes, I loaded my mini game of the spiders, but it then crashed the file.

So I wouldn’t be able to add this particular scene with it. I would need to keep it seperate, so build on further from the second game, if that makes sense.

I will simply have to build for each mini game. It isn’t practical to have small scenes with one mini game, and then add in another, and then another file, probably too big.

If you’ve loaded in assets with the bge.logic.LibLoad() function, you can simply do bge.logic.LibFree() to free the assets from RAM memory anytime after import.

Well so far, I have one scene, then one mini game, and then one scene, so beyond would require a new scene, that would probably be in the demo, once from there, it would load the spider mini game or a derivative of that, and then lead onto that. So the game would be in two parts, instead of just mini game scenes as I have had them.

So I don’t know how to make this possible, I thought the scenes were probably the correct way, may be if I had made all the games in one file. Too late for that now, I’m just building and tinkering with the existing stuff to make it more complete.

So robotbattle.blend is one game, then the other is in demodec20.blend, so since I need a small part, I may simply be able to add it into the robot battle file, with the spider battle, you had separate layers everything all over the place, it isn’t practical.

i bet your problem is this: you used the file in both engines(bge and upbge) and that made the blendfile corrupt.

So what to do now?

  • Choose an engine
  • stick with chosen engine don’t switch after you made your choice
  • open a new file
  • append all the things from your game blend into the new file (file->append)
  • now you can create a new scene and in that scene append all files from your level 2.blend
  • repeat for as many levels you have
  • save it

Now everything should work again without crashing.

1 Like

I don’t use any other engine, only blender game engine. All the files I made don’t work in upbge. As for the linking well, I can’t include the spider game in with the three scenes, since it then has the healthbar, and so on, layers, just too messy. I’d have to have the two mini games seperate, assuming I add in the one I am editing, with the complete one, and then add in a scene, and then a player scene with then the player goes to explore, I had tried this already one user helped with it, but it wasn’t great when trying to add another scene in the camera was all funny, but that isn’t the point, it is mainly ideas, textures, and where to go with it, unless I just keep it as is, and add the future scene, and then the last scene would probably be in upbge, it may include one scene and then last, unlikely I can add any blender game engine scene to it, so hopefully one character I have will work for itin upbge, if not well, oh well. I’ll just make the best of it.

Only one does, so that may have to remain separate entirely, since some special effects can’t be done in the game engine.

For example, one scene it has the objects away from the grid, another scene one character is somewhere else. So four scenes in total. It isn’t practical, one scene to another, I added a character now its floating somewhere else, I appended this from one file, and moved it to the grid. I don’t know.

This one above, when I loaded it before adding a new scene like below, the character was elsewhere. I used it from blend swap, so its from the demo file, I use as Dr smith, and now I use it for a professor Robinson character.