Newbie Q's

Blitz3D Forums/Blitz3D Beginners Area/Newbie Q's

Nando_K(Posted 2003) [#1]
First of all, hi everybody. Just got B3d and I have some questions:
I'm creating two levels, one an exterior level with a structure that has a long tunnel that leads to the next level.


Ross C(Posted 2003) [#2]
Hey, welcome :D Hehehe, you mind putting in the question ?

:)


Nando_K(Posted 2003) [#3]
This post got sqruewed up. Let me try again.


Ross C(Posted 2003) [#4]
Ok


Nando_K(Posted 2003) [#5]
First of all, hi everybody. Just got B3d and I have some questions:
I'm creating two levels, one an exterior level with a structure that has a long tunnel that leads to the next level.
I'd like to arrange it so that the viewer, when he gets about midway in the tunnel, gets transported to the next level. Also, I'd like to clear the first level from memory
until it's needed again.
Can some one give me a very general idea of what is involved, and point me to some examples where this, or something similar has been done?

I'd be thankfull.
-Nando.
There.


Ross C(Posted 2003) [#6]
Well, are you wanting to have a loading time (perhaps small) in between each level? Or are you anting on the fly?

Well, when you rwach the middle of the tunnel, you would free all the entities (using FreeEntity) then use load entity to load in the new level. Then position the world back to 0,0,0 and position your character to where he should be for the beginning of the next level.


Nando_K(Posted 2003) [#7]
Right now, the levels are tiny; Just trying to figure out how's it done. I suspect that if I wind up with huge levels, there would have to be some loading time.
Thanks.


Hansie(Posted 2003) [#8]
Welcome to the wonderful world of Blitz, Nando_K


Nando_K(Posted 2003) [#9]
Thanks.


MSW(Posted 2003) [#10]
this is actually really easy, and there are many, many ways to do it...but it does take some preplanning...

To have the most flexable system possable...I would look into "scripting" systems...for simplicity sake, you could have a file that describes things about the level...what .B3D model to load for the level, what enemies to load, where to place them inside the level and all that...

Then all you need would be a function to load, read, and execute such scripts...as it does so it resets the game world (frees all existing entities)...Then loads in the new models, textures, and creates the new types of enemies sets everything into the correct location and so on...once done the function returns to the main game loop and the game continues...

For things like level exits and such...have a look at the old Quake level editors...you will find that they allow you to place "entities" in the level...and by assigning these entites special "functions" different things can happen...essentialy, at it's simplest, in your code you create a specific Blitz3D type for each seperate type of action you want to achieve...

like so:

Type EXTlevel
 Field PivotID% ; Pivot handle describeing location of this Exit in 3D space
 Field SizeX#,SizeY#,SizeZ# ;size of this entity
 Field EXTto$ ;file name of script this exit leads to
 Field EXTstart$ ;name of start location entity in script file
End Type


Then in your loadlevel() function you phrase through your script...and when you find a section with the appropriate Exit level label you create a new EXTlevel type...create a new Pivot this entity is parent over...use the EXT size values to set up collisions with the player (player sphere to EXT cube)...and set the EXTto and EXTstart strings to the proper values...do the same for each EXTlevel type you find in the script file...

Then as the game is playing you can run through each of these EXTlevel types to see if the player has touched one...if so you then pass that particular EXTlevel/EXTto and EXTlevel/EXTstart strings on to the the loadlevel() function...

To place the camera and such in the proper location once a new level has been started...just use the EXTstart string to phrase through any "PlayerStart" entityes the script file contains for one with the matching name...then move the camera/player to the 3D location it describes...

Sorry if this is confuseing...