Sunday, September 24, 2006
Current best practice revolves around using the stencil buffer and projecting a flattened model onto surrounding geometry, creating the illusion of a shadow. The technique often referred to as a shadow volume algorithm.
A different algorithm, with different tradeoffs, is the shadow mapping algorithm. There is even hardware support available for implementing this technique.
I'd like to implement shadow mapping in QGL, as it is likely to be much faster than a shadow volume technique. To do this, I need to get a hold of the ARB_shadow extension, which PyOpenGL doesn't (yet?) provide. I'll probably have to use ctypes, and talk to the libGL dll directly.
Thursday, September 21, 2006
* A ParticleEmitter lead node.
* All leaf nodes moved into qgl.scene.state namespace.
The particle emitter leaf node generates a bunch of particles within an arc and with a velocity range. You then call the .tick method of the ParticleEmitter, which animates the particles. It uses numpy, so it's reasonably fast. It could use a few more features, but I'll need to use it for a while to find out what they might be. :-)
Wednesday, September 20, 2006
I think it's time I stopped thinking about threads, and started thinking about concurrency.
One idea I'm considering is the use of a Linda style system which is designed to provide a tuple-space on a local machine only. For performance reasons, access to the tuple-space would need to be implemented via some kind of shared memory facility.
The tuple-space approach could be ideal for game development processes. For example, the main process could push scene information into the tuple-space, where it is read by a second process which performs culling operations on the scene, and pushes the viewable set of scene nodes back into the tuple space. Meanwhile, the main process could be running the physics simulation, processing sound etc. This approach would require writing a separate program which works cooperatively and concurrently with the main program. No forking, and no threading.
Friday, September 15, 2006
Something like this:
CORE_COUNT = 2 #This is how many CPUs or cores we have to play with.
def xmap(fn, seq):
Run a function over a sequence, and return the results.
The workload is split over multiple threads.
def __init__(self, fn, seq):
Thread.__init__(self, target=self.map, args=(fn,seq))
def map(self, fn, seq):
self.results = map(fn, seq)
newseq = 
n = len(seq) / CORE_COUNT
r = len(seq) % CORE_COUNT
b,e = 0, n + min(1, r)
for i in xrange(CORE_COUNT):
r = max(0, r-1)
b,e = e, e + n + min(1, r)
results = 
for thread in [Mapper(fn,s) for s in newseq]:
This function takes care of starting, joining and collecting results from threads. It lets the programmer map a function over a sequence, and have the work done in parallel. Of course, this won't work in CPython, but it might prove useful in PyPy, or IronPython. Parallel processing in this style would be very useful for applications that work with large data sets, ie Games!
A game could be written to take advantage of the xmap function whenever possible. It would only make sense to use it when iterating over large data sets or using long running functions.
Wednesday, September 13, 2006
The second core on my new notebook will not be available for my Python games. Python used to be my secret weapon, when it came to game development.
I don't want to get left behind in the coming multi-core revolution. Maybe it's time to move on.
Monday, September 11, 2006
I've just uploaded QGL-8 to the python cheeseshop. This version contains the new shader funtionality, plus a very useful Static Node, which compiles all it's children into a single display list. The attached screenshot shows the new Material leaf class being used in a neat particle demo (contributed).
Wednesday, September 06, 2006
Perhaps next time.
So, you've created a car prefab using WheelCollider components, and now you can apply a motorTorque to make the whole thing move along. ...
When you start working with threads in your Unity3D project, you will discover that many things need to be done in the main loop. For exampl...
Possibly slightly more correct lighting. The rim light is now only applied in the direction of the sun, rather than being purely based on v...
Thank to Adrian Boeing I was inspired this morning to hack together a ripple shader for Unity3D. Thanks for the math Adrian. You can see t...
If you call gameObject.GetComponent , and there is no Collider on that gameObject, null is returned, but you will also see a memory allocati...
import csv open("output.tsv", "w").write("\n".join("\t".join(e.strip() for e in i) for i in csv.rea...
Often, when building a game, you need to test if objects are colliding. The objects could be spaceships, rocks, mouse pointers, laser beams....
Working with multiple threads is often a necessary evil. This is how I do it safely inside a Unity3D component. There are only certain time...
UniWeb now includes a tiny embedded web server which you can use to do crazy things. That is all.
I've just seen and used a brilliant ssh option. The command: sudo ssh -D localport user@externalhost will set up a local SOCKS proxy l...