{Alpha Demo} The Garden - A barebones RPG

This was posted in the WIP forum and I wanted to answer it here. We will be using the LoD system created by Kupoman, which is now in trunk. It is very easy to setup and use, while also being quite fast and powerful.

I am wondering how to make a script that uses the name of the object it is attached to, to LibLoad a blend file of the same name. I am currently using this;

from bge import logic as gl
own=gl.getCurrentScene().objects["Empty"]
path=gl.expandPath("//")
path2=path+"lib1.blend" #lib1.blend contain the 
#mesh data to be merged with current scene
print("Path for Library is:"+path2)
if own["loaded"] == 0:
    gl.LibLoad(path2,"Scene", async=True)
    own["loaded"] =1
else:
    print("Library already loaded")

How would I define path2 to point to the blend file that has the same name as the object which the script is connected to? Feel free to rewrite my method if you have another way or if I am doing something wrong.

This is for the streaming terrain technique I am working on. I can use this code pretty effectively as is, but I would have to define the path manually for each object, which is what I am trying to avoid. I have over 800 blends to load this way and i hope to find a way to use a single script to manage them all.


Why don’t you load the blends from the one you go to?I really don’t get what your trying to do.I love the idea of storing a randomly generated invironment in memory until i beat the game.Meaning the places you have been.Then it would randomly generate the whole game when you restart the game.You could randomly select from the 800 blends.Then have a script to remember the blends
it used.So that the game would not use them again in the areas you have not been.If you could make something like that it would be good.

This system loads a pre-modeled section of the terrain, with each section being represented by an empty placeholder. Each placeholder loads and unloads its own section as needed, via a near sensor. The idea here is for the player to be able to go anywhere on the planet with out having to “load” into a new area.

perhaps a second objective could be to find another human? it would be kind of lonely otherwise…

This script from pgi solves this problem;

import bge
owner = bge.logic.getCurrentController().owner
relativePath = "//" + owner.name + ".blend"
hasBeenLoaded = owner.get("Loaded", False)
if hasBeenLoaded == False:
    owner["Loaded"] = True     
    bge.logic.LibLoad(relativePath, "Scene", async=True,load_actions=True)

import bge
own = bge.logic.getCurrentController().owner
relativePath = "//" + own.name + ".blend"
libraryName = bge.logic.expandPath(relativePath)
if libraryName in bge.logic.LibList():
    bge.logic.LibFree(libraryName)

When complete, this world will serve as the stage for several other projects. This project does not have any “human” NPC’s, but we will be implementing them in future projects based off this game.

Interesting. Really interesting what variaty of worlds blenderartists work on. :smiley:

The planet looks quite inviting, a lot of sea it seems, but that’s no bad.

Are you sure this is needed? I try to explain the problem I have with loading other Library files. Probably it’s a nooby question.

Blender or blenderplayer has Physics and Detour as well as Recast engines for navigation, right? So does it provide an API for Python, to finally build the structure, logic, AI you wish? Now to load a .blend file as a library makes me scared, because a blend file is Thor’s Hammer - it’s a superweapon. I’d like it much better, if it were possible to separate artistic work from the rest (Python Historic Simulation + Python BGE API).

Then one could use blender to model objects, create props, textures, all the artwork. Then I would like to export the Geometry of the object as the rest of the data in the .blend-file might be required for the modelling but would be clutter and problematic if we ever wished to change something in the model file that we used in our AI logic in main .blend where we develop the historically accurate simulation (full of sweet characters with natural variation in size and evolving by time. The AI controls the units that we don’t control, unless we have some power over them as they might well be our subordinates (e.g. in the military). I’ve filled pages and pages with those ideas and stories right behind the next asteroid in the wildfire forum.

But back to the problem: If the model were to be loaded into the main .blend, we had finally included in our project (fisher boat) a fish swarm including coral riff (all the data that is saved there, the UI settings, the nodes, the helper objects, the different physics settings, the vertex weight, …).

Maybe I simply have to get used to this practice - is its purpose to have the logic distributed and subdivided for each object. So an object’s blend-file has defined how the object behaves?

And this is my next problem with the BGE: using graphical logic bricks. Excuse my humble and limited mind: Do we really need use a GUI that changes with each blender version? Once compatibility is gone the blend won’t open anymore. You have to reopen an the file in an older version of blender, somehow generate/export Python Code from the logic and start up the new blender version again, paste the python there and generate a GUI logic bricks system from it.

I’m not sure if that were helpful for a project like we want to tackle. (haidme, the greatest master of our realm, also tried to declutter the project, not only having it tidied up but for having it moddable.)

I prefer having all Python files and all models and textures in a versioning system (mercurial because of binary files, e.g. to version blender model changes, texture changes, all without lag and to have the possiblity to wildly branch at constant cost in time and constant memory requirement…).
For what I envisage we need to separate all parts of the 3D model into several files or combine it all into a huge model_library.blend. (if blender will not lag then).

We then, for each 3D object we’d like to create, would start with high level (using both brilliance of BlendSwap and revolution of GrabCAD).
For me it looks important that we generate the low level models out of the higher detail models, we should even write a script to automate that whole process. (decimator modifier and if required a custom ultra-geometry-reducer so that our details come from the details). OSL (OpenShadingLanguage) or GLSL we either use exclusively and drop all textures. Or we go for textures only like haidme did to save the CPU (CentralProcessingUnit) from building chimneys.

Then each time we wish to change something we then change the original model. Without a single-source concept we will generate us heaps of trouble.

The good thing is, we have geometry files (e.g. .dae) and textures for each object. But the objects are not standalone objects - instead they are base models. Clothes will be separate. As will be hats and even the feathers from the hats are separate to make them exchangable via python and reusable by any other main object (no hierarchies for our object, we want them freed - not slaved).

In such a configuration we could change the AI without starting blender at all. The only thing we need it a reference of the Python BGE API that the current blender version provides, then we use it and of course can happily debug it by starting our chief’s (Ton’s) genious blender. It cares for the Detour and Recast, and Python cares for the coexistence of human and AI players in any count and any relation (tribes might join, split or fall into civil war, … another AI could decide to join our efforts and merge the tribes, we now having to keep up treacherous paths over high mountains, not to loose a way to our outskirts.).

Okay.I definitely write too much. and probably my point of view will look quite strange. Probably I simply don’t know the Blender Game Engine good enough. 0 A.D. is my first bet for getting my AI algorithms to work. It currently fits better into my concept though in blender I feel much more like I knew how to make it happen (physics missing completely in 0A.D…/pyrogenesis, but I think it’s too much computing power anyway? any thoughts?). Perhaps merge the two game engines?

I can see you are thinking 10-20 (maybe more) steps ahead in terms what any engine can currently do. Most of what you are asking for hasn’t been done to the degree you are visualizing, but that doesn’t mean it can’t be done. It would be great to combine the best aspects of multiple game engine’s, but that would probably take 10 times as long as it would to make the simulation you would use it for. My design philosophy is to create mechanics that make it easy to generate complete worlds from the ground up. It might take 10 times as long to create the mechanic, but once it is complete, it can be reused as often as needed to create assets for all projects. I call it modular design theory, and every aspect of this project adheres to it. Frankenstein’s game engine would follow the same theory, but would be more like 1000 times longer to create. My point is that we have to work with what we have now, while building toward what we want.

The LibLoad script is one of several methods I am trialing for managing content within the game, its primary focus is to manage the terrain in such a way that there will be no loading between between areas. It can be done asynchronously so it doesn’t freeze up the game as you play it.

Blender doesn’t have any preset AI, it all has to be created by the developer. The upside is that your AI is only limited by your imagination and skill. Simulating different aspects of a society can be done, but will require some major leg work to set up the necessary underlying mechanics of travel, trade, politics, government, etc. I have some ideas that I will be pursuing in future projects, but I try not to dwell on them as I have enough on my current plate.

I have completely revamped the LOD and streaming terrain. Check these screens for the latest progress of the first island group. This is what it looks like now.






It is looking good.

Thanks, here are a few more screens showing some progress on the terrain texturing. I am using a node set up to texture according to RGB vertex colors.

node set up


RGB vertex colors


texture splatting result


view from the ground


I updated the video showing the game engine running, excuse the low frame rate.

Blend file updated

Nobody can get the blend file.Your link is not working.

I just checked and it is currently working.

It would be cool if you had caves and pink geysers.I am just trying to be creative with that.Flying piranhas.Could be an alien creature.I tried flying to other island with the space bar.Looks good.Is he going have to eat?Is he going to get tired?

I appreciate the creative input, I really want this world to contain some unique plants and animals. I have a way of making really big caves, but I have not included it yet, simply to keep the demo simple. Sky piranhas could work, and would be really cool. Feel free to throw any ideas out there, it helps to keep the creative mind working.

I have not quite got the flying mechanic done, so at the moment you can only jump. It seems like flying because I have it set up for you to jump about 300 blender units straight up. I am working on retaining velocity during the jump so you can do running jumps, and eventually it will become press space to fly.

How about the mushroom on this planet having the only source of vitamin c.They are dark blue without fuzz.And their is a type of mushroom that is darkblue and is fuzzy that gives you a disease that causes chicken pocks.If you eat it.