designing a stable system is alot of trial and error. its like a big problem solving game, which is why i love it.
Lol okay man i’ll give it a try then… Don’t you have any scripts for the saving variable so that i can maybe save it in to the logic.globalDict ?
When you have a separate “vehicle selection” scene there is no need to access the objects from that scene. The objects in the level scene have a complete different purpose (e.g. you can drive them) as the objects in the selection scene.
When you want to share the “presentation object”/meshes you can link them. The objects will be complete different object within the according scenes. As said, you do not need the logic to drive them (but the logic to select them).
All you need to transfer is enough information that you know what level car to create for driving. This can be simply a name.
Okay thanks Monster you made it clear enough ,Maybe i’ll link the blend file first then showcase the models and then
i’ll prepare them for spawning in the Main Game scene. It gives me ideas but its the How to do thats killin me over here
man so i’ll do my best to even try to put this system. And if i can’t i’ll have to look for alternative ways of doing this…
Ahh don’t you atleast have a blend file for me to use as a template?
when selecting (e.g. via point and click or whatever) -> you send a message with the name of the car to span
obviously the level scene should exist within the next frame otherwise the message would not reach the recipient. YOu can do that either by having the level scene as background scene already running or you add it while sending the message or you swtch to that scene while sending the message.
At the level scene you need one or more car builder. It is listening to a specific message. When receiving the message it adds the according driveable car.
Please note, this is just one solution, not the only one.
Hey ah Monster everytime i open your file it says file format is not supported in file so i can’t open up your blend file on my blender 2.76
Could you try fixing it or re uploading a much more caompatible blend file…(this seems to be an unusual error which is quite never common.
Daedalus_MDW thank you so much bro ive checked out your Demo its pretty sick i like it ,however i see that there is almost no Logic brics being used and yet your demo works so well. i see that your well versed with python ,and im not any better at it i can only edit and
adjust python codes so it looks like i need to learn a bit more of it. I saw that for your controllers under the Logic Editor you used Module And usually when i use Module instead of Py scripts my things don’t work at all. Surly your PY scripts will teach me something !!!
Yet its a basic system but it runs so well (Python no Logic bricks impressive)
Okay well it looks like iam going to have to actually sit down and Study your Gui.blend
just remember to always save the “lib.blend” in an empty layer.
I was able to see that you saved your assets in Layer 6. I will also do it bro…
Okay so in yr folder i was able to see that there’s a PY large folder where : - base.py & gui.py is and
So basically i think that your system that you’ve designed runs only on those py files (Scripts) pls explain on how you did this because im stuck over here … Does this system work well if one has alot of assets. (or in my case Cars )
Okay so the 1st part im fine its only how to get to the point where im only using the .py files instead of logic bricks.
Oh and please please don’t forget to explain on how you did the gui.bgeconf… I need to know how you did that please !!!
like always, feel free to dissect and modify my stuff to your hearts content. modifying and reverse engineering code is just how i learned python and a little C.
you should be able to have as much stuff as you can fit into a blend, but it may be best to have one for cars, one for scenery etc, so you can only load whats needed.
i hate logic bricks, so sloppy and high maintenance. modules, the ‘def’ things, can be called from your python brick. the game engine ‘imports’ the py file containing that ‘def’ module. when that happens, all code not in a ‘def’ runs only ONCE, no matter how many times you call it. if you look in the console, will see how the printed comments happen once. this is great for runtimes and startups. using the ‘import’ works the same way, making it easy to snap on any py file.
modules can also be called from your code to reduce redundancy. to call a module in code, just put the name of the ‘def’ block in. to call module from an imported file use the name of the imported file, dot, name of the ‘def’ block.
the weird looking bgeconf thing is the logic.globalDict being saved into a file. this is how save games and settings work. my demo file uses it to remember the last character played. notice the line “logic.saveGlobalDict()”, this is what magically makes that file appear.
i like using TABS and not spaces for my code indents, so make a note of that. the python book of standards says to use 4 spaces and not tabs, but to hell with that. ill only put up with that madness if im posting code here in CODE blocks since tabs dont work, boo.
You may know enough for now, but if you really want to know what you’re doing you should look outside BGE and read a good book. It’s just an advice.
modules can also be called from your code to reduce redundancy. to call a module in code, just put the name of the ‘def’ block in. to call module from an imported file use the name of the imported file, dot, name of the ‘def’ block.
Actually that’s a feature of any good programming language, not just Python and certainly not just BGE. And now the real useful thing, organizing modules in folders using packages.
the weird looking bgeconf thing is the logic.globalDict being saved into a file. this is how save games and settings work. my demo file uses it to remember the last character played. notice the line “logic.saveGlobalDict()”, this is what magically makes that file appear.
That’s good and all but it could be better. First, you may want to have multiple save files instead of one big file, so that players can copy a specific save or share it on the internet. Second, and most important actually, most users store their games on C:/Program Files/CompanyName/Game, that won’t work with bgeconf, since that directory needs permission to write (and you don’t have it when running the game), hence you in that case you should save on the documents folder of the user. My addon does that with core.utils.getLocalDirectory(), you can check the code on github.
i like using TABS and not spaces for my code indents, so make a note of that. the python book of standards says to use 4 spaces and not tabs, but to hell with that. ill only put up with that madness if im posting code here in CODE blocks since tabs dont work, boo.
I hate spaces too. Being able to do a replace all with " " on the second argument is godsend in most code editors. (Notepad++ for example)
like the python documentation? now that was a good read, had me on the edge of my seat till the very end.
i hope i didnt imply that these features are exclusive to python.
simplicity is the key here, we can cross that bridge when it comes. unless you have an installer, simply mentioning the write access limits in program files is good enough since we all know that bge is TOTALLY a AAA engine and everything. i personally havent looked too deep into writing files, as i havent needed it yet. good point though.
i apologize for my fairly sarcastic tone, i dont mean anything by it.
Well yes that’s the very least. But you won’t learn about file reading, compression lists, lambdas, height order functions, exception handling or threads there, you’ll probably need a book or a lot of stack overflow for that. And that’s only for Python features, GLSL and C/C++ have different features for which you will also need a book, stack overflow, or both. And finally there are also the agnostic features, like creating documentation (sphinx, doxygen), using build tools (cmake, makefile), RegEx, using version control systems, etc.
So basically, my advise is still that you’ll have to look outside BGE to really know what you’re doing. Though with that said, you seem to already do this.