Help with Changing between levels 3d

Blitz3D Forums/Blitz3D Beginners Area/Help with Changing between levels 3d

Newbie31(Posted 2014) [#1]
Heyo,

I need some help with changing between levels, I'm trying for an oblivion type effect where it switches between a outside low poly model to an interior high poly model. But I don't know where to start and would be much appreciated if someone could point me in the right direction.

What I've got so far-
Test World:



Test Room:


Code that links them?:



RemiD(Posted 2014) [#2]
What i would do :

For each zone i would have a file where the properties of the zone are stored.
for example
Zone001.map
Zone002.map
Zone003.map

Then in the program, i would have a variable with the active zone name and a variable with the GameSate to update the zone :
global GameState%
const CLoading% = 1 ;load the properties of the zone
const CBuilding% = 2 ;build the zone with the appropriate components (meshes, textures, animations, images, sounds, fonts, lights)
const CUpdating% = 3 ;update the game
const CSaving% = 4 ;save the properties of the zone
const CDestroying% = 5 ;destroy the zone, free the components

global ZoneName$

Then depending on the ZoneName and of the GameState, the program will do what i tell it to do.

For example :

While(keydown(1)<>1)
 If(GameState = CLoading)
  ;Load ZoneName
 elseif(GameState = CBuilding)
  ;Build the zone with the appropriate components
 elseif(GameState = CUpdating)
  ;update the game and the zone "Zone001"
 elseif(GameState = CSaving)
   ;save the properties of the zone
 elseif(GameState = CDestroying)
  ;destroy the zone, free the components
 endif
wend


Also in each zone, there would be one of several "entryexit" and when the player or a bot go to this entryexit, it will tell the program to which other zone this entryexit is connected to (and will go to).
So each entryexit will allow the player or a bot to go from one zone to another, with a "loading screen" displayed while the active zone is saved, then destroyed, and the target zone is loaded, then built (as in Daggerfall, Morrowind, Oblivion)


gerald(Posted 2014) [#3]
Hi,

Basic textbook answer is to use a proximity switch. Set entity and if player is abs<100 x,y,z then goto level2.

Your code looks out of my league.

Gerald


Newbie31(Posted 2014) [#4]
Zone idea is interesting and I'll give it a try but I was hoping I could make each level in an individual bb file and have moving to a certain points closes the current and opens the new level without closing the render window. I'll try with zones and includes but I suspect there will be problems unless I declare all the globals each level has whether there currently used or not.


RemiD(Posted 2014) [#5]
Often a game uses the same kinds of components and the same variables for the different maps/zones. What changes is the way they are represented (the meshes, the textures, the animations). But a building is always considered as a building, a door as a door, a weapon as a weapon, a bot as a bot...

You can use different globals and arrays or types to store your components/variables.


Newbie31(Posted 2014) [#6]
Heyo, Back again.

I altered my code to do what RemiD suggested .....I think. but I'm getting an error "undefined label" where I'm clearing the world. Could you please have look and see what you think and where I'm going wrong?





Kryzon(Posted 2014) [#7]
Things that I would do if I were working on that code:

- Move major routines into their own code files, which you Include in the main code file. It enforces organisation and separation (replacing globals with function parameters, less chances to get confused), and makes it easier to expand your functions.

- Use Types for representing complex entities and for organising variables (i.e all engine related variables as fields in a Global TEngine type instance).

- Use more constants instead of magic numbers (make the entity-types for collision as Consts, so they can be used in more than one function etc.) (Initial values as Consts as well so its easier to tweak the values and the values will each have a name: instead of 402, you'll have CAMERA_VIEWPORT_X).

- Replace the labels, a relatively confusing way of controlling the program flow, with loops, function calls and Select...Case blocks.

You can learn more in the tutorials area:
http://www.blitzbasic.com/Community/topics.php?forum=88