loading question

Blitz3D Forums/Blitz3D Beginners Area/loading question

melonhead(Posted 2010) [#1]
like an RPG you load into one map then into an other and go back and fourth how is that done. i want to make all the maps in separate .BB file. i was also thinking on making a 3d model that i lay on the ground and make a collision but with that i still don't know how to load up an other map and close off the old one. sorry if it not clear.


Serpent(Posted 2010) [#2]
In those games this is done to minimise memory usage - i.e. only the content needed for the current level is loaded in memory.

How is this done:
- Detect when player moves to new map
- Clear up memory space taken by media for old map (in Blitz use functions like FreeEntity to 'free' memory)
- Load all media needed for the new map
- Initialise new map (i.e. put all of the objects in the right positions, or whatever else to setup the new map)


Implementing this in Blitz3D:

First of all you need to decide how you are going to do your maps. For the main part of the map (i.e. terrain - hills, dips, shape of land) you can use a 3D model or a terrain. To find out more about terrains you can look in the Blitz3D documentation. If you want to use 3D models for your maps you'll need to create them using 3D modelling software.

You've said you want to make the maps in separate .bb files. I'm not exactly sure what you mean by this, but if you want to encode 3D models in Blitz3D source code you're going to have a hard time. A sensible option would be to have functions which load, initialise, and free maps in separate .bb files so that you can easily locate functions for different maps.

Basic collisions in Blitz3D are quite easy. You should see the documentation about this, but basically you set different entities to different types (i.e. the map could be type '1' and the player type '2') and then use the Collisions function to start collisions between different types. Then, whenever you call 'UpdateWorld' Blitz does the collisions and moves everything where they should go.

i was also thinking on making a 3d model that i lay on the ground

In a game like this you can set collisions to occur with the 'ground'. I'm not sure exactly about what you mean but you don't need another 3D model to make the player collide with the ground.


And if I haven't answered your question directly (which I've probably done):

LoadMesh loads a 3D model
FreeEntity frees a 3D model


melonhead(Posted 2010) [#3]
the world map is a model im making in 3d studio max that the main map i will load that model up in worldmap.bb file then a an other model of a town in an other town_A.bb. i was thinking on using IF , THEN,ELSE commands to go from one map to an other. im very in an out with blitz basic 3d. i always had trubble on loading map


Matty(Posted 2010) [#4]
You do not want to load different maps with different ".bb" files. It is better to have individual text files which you then parse with a load routine (your own) to set up the environment. Otherwise you are going to have to 'hard code' everything, and will need to recompile your program every time you want to make a change to an area.

One method, and as with any programming problem - there are many solutions, is to do this:

have a function which removes the current environment from memory, eg
"Unload_Environment()" (which you write yourself)
another function which as "Load_Environment(filename$)" which you place all your load commands.


melonhead(Posted 2010) [#5]
im not that good at coding i can load .3ds files with no prob, is load and unloading i was never rely good at programming graphics, i am good at doing


Matty(Posted 2010) [#6]
Perhaps you could aim for something within your level of ability, and work your way up to more complex things over time...
blitz is good for that...


melonhead(Posted 2010) [#7]
i know i get into it then i loss track on what im doing then i end up cutting my self off of it for a bit. but 3d is the only thing i can do and know how to do.


AvestheFox(Posted 2010) [#8]
Yep, it can be easy to lose track of yourself if you have a mess of a code. Try separating your functions into separate include files (organization makes everything easier :) )

As for loading and unloading maps for a massive 3D world, its like what Matty said, there are many methods for doing this.

But since you are kinda new to this, its highly advised to start small and work your way up the developer ladder.

A small simple 3D puzzle game would suffice. or a simple platform game.

And if you need any help, these forums have proven to me to be the best place for that kind of help that you will need :)

Good luck!