I'm new to BGE.. level streaming in blender or only insanced levels?

Hello, I’m new to BGE, like I said and I saw one tutorial that showed how to set up a level instance but haven’t found anything on “streaming levels” yet, and I cant afford to pay at the present for access to advanced tutorial videos that may contain information on the subject of streaming levels of open terrain in BGE… I want to explain where my understanding level is at currently, concepts, and areas of study of mine that may be relevant to this subject in some form or another and to give any reader a Idea of my current level of understanding… I have some understanding of c+ and C ++ so Python is easy to grasp and I will learn as I progress. I was a instrument operator for years in land surveying and I am well versed in using coordinate systems. surveying coordinates use northings and eastings and are usually assumed at N-5000’ and E-5000’,and elevation at a given benchmark, so as to eliminate the negative numbers as long as the distance parameter is not exceeded. rather than a x0,y0,z0 format. i have a good understanding of topography to say the least lol… I took a course on LPA. (the Art Institute of Houston) which is == Graphic Art or Commercial Art and have used various programs like Photoshop, Illustrator etc. and I have Gimp2 so blender will give up its mystery’s to me eventually also 8) tho I’m just beginning. all of this said let me begin… Dev.s try to keep the memory usage low to reduce the lag or chance of a crash and make the game run better. that means reducing the poly count, right?. the more static mesh’s you add to a level and also the skeletal mesh’s plus the level environment or terrain then the scripting… the more memory you use. other GE’s I’ve taken a peek at have “Streaming Levels” as children of a parent with a persistent world or Level, so as to load in a level as the player moves to the next area or level and unload a level the player is no longer in or see by streaming the levels in or out as needed to reduce the memory that rendering a total open world map/level and all its assets would take and avoid crashing the game. I don’t know if there is level streaming in Blender or not. I haven’t found a video tutorial on it yet and I am POOR! lol cant afford to be a citizen of blender right now. how ever I wanted to put forward what I think could work with my feeble knowledge… I think it is possible to stream in only parts of a level that are at a set distance to the right or left of the player camera so WYSIWYG in effect, and that certain distance right or left would give the streaming levels time to load before the camera pans into a void area or unloaded area of a level… and a persistently streamed in area or box/raidius say mabie 10 blender units around the player(s) and moves as the player moves(like a collision box) so that the current loaded level would be defined by that player’s local area persistent level envelope, A Dynamicly streamed level that continuously loads as the player moves and includes what the player camera see’s. the only other loaded assets should only be the pawns or actors that can interact with the player or visa versa…I hope my vision of how this could work makes sense… or mabie there is something im missing like the memory used in making things like this happen. a silly notion I guess, but say this theoretical level steaming idea of mine would work the poly count would allways be low as far as the total being rendered at a given time…mabie someone smarter and well versed in python could build a add-on for BGE that could work like this and make this type of streaming easy to set up and execute as a user of BGE… at least it seems possible in my mind… I understand the concept of instanced levels or dungeons. I Hope a more knowledgeable individual can enlighten me further on level streaming for Open World MMORPG type of games…thank you 8)

This wall of text looks exactly like 60% of all spam-mails we receive (usually they talk about boots). Luckily you do not have any URL in your text.

How about some structure? A six line sentence is not worth to be read :spin:. A 31 lines of text without a break is even more discouraging :(.

I will not read this text :no:.

Edit: If you open a new thread with clean simple sentences I can remove this one.

So funny, you took the words right out of my mouth.

I agree with the others (and yes monster, boots seem to be popular among spammers don’t they! I wonder why?)

Yes, streaming levels (loading only what is around you) is indeed possible. The easiest way is to use a system like kupomans LOD system in a custom blender build (I’m hoping it will be in trunk sometime soon).

Other was are to use Libload to load whatever you come near.

I reccomend you take a look at the BGE API.

I’m “streaming” terrain data for my game and, while i don’t think it is a particularily elegant way to do the job, it works.
It’s all really based on naming conventions.
A descriptor file tells the system how big are the patches, where to find them and where to find the default sector.
Each sector is a .blend file and the file name is SOMETHINGX.Y.blend, where SOMETHING is a custom prefix X and Y are the coordinates of the patch in the terrain grid. The .blend file contains an object named SOMETHINGX.Y that represents the terrain - and all the attachments as children, if needed.

And… that’s it.
Given the size of the sectors and knowing that the terrain is a grid, for a point P in world space the file to load is PREFIXA.B.blend

A = p.x / SIZE
B = p.y / SIZE

So i load that file (bge.logic.LibLoad) then i get the terrain mesh - whose name is conventionally predefined to be SOMETHINGX.Y - and translate it to (A * SIZE, B * SIZE, 0).
The translation part is needed for practical purposes: i prefer to model the terrain as centered at (0,0,0) but translating it to the real position would spare some line of code and the naming convention for the object inside the blender file.
With A and B I get the eight surrounding cells and load those too - so that a visible terrain portion is made of the nine cells surrounding the player.
When the player moves out of the center cell i load the missing patches and free those that are outside of the new 9x9 sub-grid.

In all this the only bge calls I have to make are:

bge.logic.LibFree(path) -> to remove a patch that is no longer visible
bge.logic.LibLoad(path, “Scene”) -> to load a new patch
obj.worldPosition = (x,y,z) -> to move the patch to is real position
scene.addObject -> to add the default patch - which is preloaded as a background object.

All wrapped in 162 lines of horrible code.

With a lot of help from the cache of the hard disk there is no noticeable lag but for now i’m loading very low resolution sectors (2k triangles for a 4km sector).

Sounds interesting, do you have more information on your project somewhere?

All wrapped in 162 lines of horrible code.

Maybe it’s just me but I don’t think that’s too much. ^^

With a lot of help from the cache of the hard disk there is no noticeable lag but for now i’m loading very low resolution sectors (2k triangles for a 4km sector).

Does it take something extra to best use the cache to your benefit?

I have the test project I built for the terrain. Here’s the zipped stuff:


test.blend is… the test. There is a short readme opened to explain the structure of the json descriptor i use for maps. CMapController.py is the script. In that script the “updateMap” function is the function bound to the object that moves and determines the cells that are loaded. The key sensors are just for testing purposes, it doesn’t really matter how the object moves, you just have to update the map periodically. As a matter of fact the tracked object might not be moving at all but just sits down as a place holder for the cells that you want to be loaded at a given time.
cmap.json is the map descriptor (patch size and where to find the files).

Here’s a short video of the test:

In the video, the blue patches are the default ones (copies of the same patch, stored in terrain/SECTOR_DEFAULT.blend), the colored ones are actual blend files. Three sectors are defined (0,0 - 0,1 - 10,10) the rest is default.
If you want to add a patch, for example define the sector 4,4 of the terrain, open a sector file, like terrain/SECTOR_0.0.blend, name the terrain object inside it SECTOR_4.4, save the file as SECTOR_4.4.blend and that file will be used for the cell (4,4) of the map.
There are no constraints in the system other than the naming convention. Patches that are not SIZExSIZE will simply not merge visually with other ones. If two adjacent patches do not share the positions of the vertices at the edges they will not look as a continuous terrain… just common sense stuff.

I haven’t tested it on Windows, i suppose (sincerely hope) that bpy.path can translate “/” to “” when it creates absolute paths. Otherwise you will se some file not found in the console.

The ways to improve the system are countless.

A defragmented file system I suppose. It’s a built-in feature of non obsolete hard disks. If you load a file two times chances are that the second load will happen from the buffer of the disk rather than a plate of the disk. It makes a very noticeable difference because the buffer access is way faster than the actual reading from the plate.

Could you let me know if you get it working?I am very interested in this type of thing.

My brain hurts for your ugly post. Could you please do the people you are asking an answer from a favor and reformat this message that makes me want to do bad things?

deleted – wrong thread, sorry

@SSXer - While the rest of the posters are correct that the post could be formatted a bit better, they are being a bit rude, in my opinion, and for that I apologize. I personally like this engine because of its capabilities and ease of use, but also for the usually helpful and nice community.

It is possible to “stream” levels in the BGE in a few different ways. One would be by just adding in portions of the level in the game with the level portions stored in the game in hidden layers. Basically, the level data gets loaded with the game. You can also make use of LibLoad, which is a Python function, to load in game data from an external blend file dynamically while the game is running. This way, the running game doesn’t have to load it if it’s not going to be needed.

yeppers the blender community iz so cool. “BREAK” so cool the moderators are trolls…

thank you to all you kind trolls in the helpful blender community. yall are so smart! and kind to us cancer ridden poor hillbillys that muck up your mushs.wow im in awe of yallz intelligence and kindness thx…