Finally, after a long time spent working on other projects, i come back to play with Blender.
I thought: « Why do not use Game Engine as a Fast Prototiping tool? ».
Then I have temporary abbandoned Java coding and I have started to learn and test Blender GE.
I think that is more efficent trying to create a finished game, even if simple, rather than many unusefull tests.
FullPipe was an idea jumping in my brain from some time ago. The gioco is based on a race riding special vehicles, wich run inside a pipe track.
Risks are colliding other racers, loose velocity, crash against pipe walls (or floor?! ) or crash against obstacles placed along the track. But also preparing wrong to enter a curve .
The track is modelled with Dupliframes. I was not happy with the V subdivision. Today I discovered how to resolve that problem… i soon update the image with new track.
The first vehicle.
Wow, that vehicle looks pretty nice
Below you can see the new track mesh, with correct U subdivisions.
I have discovered that Nurbs Circle Surface nodes have different weights. They are placed along a square, in fact. This is good only for surface taken as it is, but for skinning of a regular cylinder or tube, that is not a good setup.
To resolve this problem I setted same weight on all nodes and placed them along an ottagon. That way when I skinned the copies of Dupliframes I got the right subdivision along U.
I reduced V subdivisions and used 12 subdivisions along U. I think they are enough for a game.
After some unsuccesfull tests with physic internal engines (Sumo and Bullet), I decided to try BLODEd or PyODE. With BLODEd I had some problem to load module, so I am going to try PyODE, after a successfull installation, using DarwinPorts for ODE library (I am using a Mac) and compiling PyODE against it with Python Dist Utils.
Reading PyODE documentation, and understanding its behavior, leaded me to do many conjectures. One of these is to find a way to initialize some variables out of loops of Logic Bricks.
The next file is the result of this idea. Of course, press P in the 3D View and than ESC. Than look at the output in Terminal/Command window.
Good news! My first test to call PyODE from Blender Game Engine was successfull.
I have no possibility to compile ODE e PyODE under different platforms other than Mac OS X, so for those interested to test it on your machine, here is some general instructions.
Download and install ODE (http://www.ode.org/download.html). Windows users can download installer. Mac and Linux users must compile it. For Mac users i suggest to use DarwinPorts (http://www.darwinports.org/), that semplify download, compilation and installation process a lot .
Mac users only, that used DarwinPorts. To compile PyODE, you need user-settings file from sources (DarwinPorts does not install it). user-settings can be found in the config directory, of ODE sources, placed with makefiles for the different platforms. You should save it here: /opt/local/var/db/dports/software/ode/0.5_0/opt/local/config/user-settings. Where config parent directory is the base directory of the ODE installation made by DarwinPorts. Here is a copy of my user-settings, taken directly from ODE source files and modified for Mac OS X:
# ODE user settings: the following variables must be set by the user
# (1) the platform to use. this name should have a corresponding
# makefile.PLATFORM file. currently supported platforms are:
# msvc microsoft visual C/C++
# msvc-dll microsoft visual C/C++, create a DLL
# mingw minimalist GNU for windows
# cygwin cygnus GNU for windows
# unix-gcc GNU gcc on unix
# unix-generic generic unix compiler. you may need to edit the CC
# variable in makefile.unix-generic
# osx Mac OS-X, with the gnu compiler.
# (2) the floating point precision to use (either "SINGLE" or "DOUBLE")
# (3) the library type to build (either "debug" if you are doing development,
# or "release" for the optimized library)
# (4) if you are using an old version of MS-Windows that has command line
# length limitations then you will need to set this to "1". otherwise,
# leave it at "0".
# (5) If you want to use the TriList (triangle mesh) geometry class, you must
# have the OPCODE library installed somewhere. If this is the case then
# uncomment the following variable and set it to point to the directory
# where OPCODE is installed (note that you must have already compiled
# OPCODE, ODE's build system will not do that for you).
# See http://www.codercorner.com/Opcode.htm for more information about
# OPCODE. A recent version of OPCODE is provided in the ODE distribution
# in the OPCODE subdirectory. This code was originally written for and
# compiled on windows, but it has been ported so that it should compile
# under unix/gcc too. Your mileage may vary.
I think that can be possible to get the same result modifiyng the setup.py file, placed in the PyODE source files directory. But, for me, this method worked, so I did not loose my time to verify if there are alternatives .
After a succesfull installation of ODE you should install PyODE, http://pyode.sourceforge.net/. Windows users can use installer. While Mac e Linux users should compile it using Python Dist Utils, as explained in the INSTALL text file, in the source files directory.
As the last thing to do, download my test, http://utenti.lycos.it/comx/download/pyode_test.blend, and see if it works.
Open it press P key, holding mouse pointer over 3D View, and than press H key to start the animation. You should see the cube moving a little along Y positive direction and than moving back, along negative direction, and disapear to the left side of the window.
If this is what you see than the experiment was successfull and you can press ESC key to interrupt Game Engine.
Cube moves along Y becouse of different system of axes used by Blender. Z and Y are inverted.
I have still not worked on this aspect becouse the test was aimed to call PyODE from Game Engine.
Further test will be aimed to resolve other things like swap Z and Y axes.
I would like 2 C a executable
Sorry but I work on a Macintosh, and just rarely on a PC.
So if you want a Mac executable, there is no problem. Anyway, with or without executable, you still need to install ODE and PyODE to successfully run the test.