GTA-Syled Game: Making the Vehicle Wrapper See Double

A Grand Theft Auto-styled game is an often sought-after (let’s not forget, ambitious) concept. I’ve seen many people construct really rather impressive demos regarding the subject, but they all dance around one of the core concepts: having more than one vehicle on the screen at a time.
Unless I’m mistaken (and I cannot rule that out), vehicle wrapper vehicles can be spawned, and worked with, but spawning two of the same vehicle with the same wrapper at one time will result in one wheelless, useless object. Even spawning more wheels will result in at least one model without a propulsion system. It is possible to give each vehicle a property that causes spawning points to spawn different vehicles with different vehicle wrappers, but that would take some time and doing.
I suppose, then, that the only other answers would involve modifying the current, name-based vehicle wrapper, or finding a suitable alternative. Just curious; can it be done?

Of course it can be done.

Just to be sure, this isn’t some problem that only I have faced? I’m slightly paranoid that I may be rambling on about problems that no one can relate to.

Thanks. Very, very much. I’d been using the Clark Thames version from The name-based system was a bit more stable, but killed some of its potential in the name-based designation system. Like putting a rocket on a leash, really rather limited. In a matter of hours, I’ve already excitedly adapted the system to my '74 Checker. Awesome.

Just use the Visual VehicleWrapper
It does not depend on naming.

It works with parenting and properties and you do not even need to code one line of Python.

It works like a charm when adding cars.

Be aware if you end a wheel the BGE will crash (2.49 and 2.5x). That means if you want to get rid of a car, you could hide it, or you have to reload the scene.
I hope it helps

Monster, you are a genius. An absolute genius. However, genius can only compensate for so much of a program’s limitations, albeit, its few limitations. I have only a few things to say: 1. Hiding wheels sounds like a good option, but how much processing power will keeping invisible wheels around in a scene rob (if any). The second thing is a little more long-winded. When I first started spawning vehicles, it worked fine, but when the spawn point was moved or rotated, the vehicle’s wheels would fail to turn correctly. I have more than a subtle suspicion that it has something to do with the steering center object. I can make the car initially spawn in the center of the scene, then set its position to the spawn point, but rotation is no factor, and it would add a lot of logic. Do you know of any other fixes for this problem? One way or the other, still fun.

I will check that. I have to say, I always created the car’s at (0,0,0). So it looks like a bug in my code. I’m going to get the fly flap ähh bug flap…

The bug is dead!!! long live the bug flap.

Check out the above thread for the latest version. It contains a demonstration too, how to use it in a group, which might come handy ;). But this is an option not a must.


I just found something else, something more… discouraging. For some reason, the vehicle wrapper will not function in the runtimes I’m trying to make. I keep getting the message “,Python module not found - controller “VW.buildVehicle#CONTR#1.”” It also says a similar thing about the steer section of the script. Any ideas?

I tried with 2.49b it is perfect.
I tried with 2.57-RC2 it crashes:

Error initializing quicktime
Detected GL_ARB_texture_env_combine
Detected GL_ARB_texture_cube_map
Detected GL_ARB_multitexture
Detected GL_ARB_shader_objects
Detected GL_ARB_vertex_shader
Detected GL_ARB_fragment_shader
Detected GL_ARB_vertex_program
Detected GL_ARB_depth_texture
Detected GL_EXT_separate_specular_color
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "C:\blender-2.57-RC2-r36007-windows32\lib\", line 60, in <

I can’t tell what it is. Especially the file does not explicitly use module

“VW.buildVehicle#CONTR#1” is the name of the controller. There seems to be something wired with the runtime of 2.57b.


I created som other runtimes:

Started in separate folder: crash as descibed
Started in Blender’s folder: works
And now the VehicleDemo works too! the same one that didn’t worked before.

Another version of the vehicle Demo crashs without telling why.

It seems the 2.57b runtime is instable

So the runtime version for 2.49 works, and the version for 2.57 doesn’t? That’s strange… I used 2.49. Repeatedly.

Monster: I have done it! Not that most of it wasn’t small amounts of troubleshooting, or that I shouldn’t have thought of it sooner, but nevertheless, I have fixed some of the problems. 1. The problem with the spawning point location/rotation was killed by eliminating the turning center and using the MaxLeftSteer/MaxRightSteer properties of the object’s wheels. 2. I got the runtime working as well. As it turns out, the vehicle wrapper’s python file and/or compiled python file need to be in the same folder as the runtime, not exclusively in blender’s folder. Like I said though, this is with 2.49. Or is that what you’d said?

If you have the python file external, yes it must be somewhere in the python search path ;).
I tried with internal text files only.
This weekend I discovered that you need the file beside all *.dlls from the Blender folder. Otherwise Python does not work in the exe.

The problem with the turningCenter is solved in version 1.3. Finally it just calculates values for the MaxLeftSteer/MaxRightSteer properties. So your solution is fine.