PySoy - 3D Game Engine and my contribution to it.

I have finished another task at the GHOP, this time a task involving OpenGL. Sounds like fun ? Of course it was fun. With a bit of coordinate geometry knowledge, one can very easily get things to animate using pysoy. My task involved defining 8 default materials covering a wide range of specular highlights, colors and shininess. I did it in 2 days. My work is now accepted and I am happy. I got to play with OpenGL and of course this brilliant gaming engine - PySoy. In PySoy, the camera ends up as a collision object (just like a sphere or a cube). This means that you don’t need to recreate meshes for every little thing. You can design objects in Blender ( a great tool !) and man this thing is just in beta2 ! Oh boy such a lot has already been incorporated in 3 months time ! kudos to these devs ! (Excuse the excitement, it is natural). Anyway, let me show you what I did.

Arc Riley (my mentor) told me about how stupid a platform Debian GNU/Linux was for devs. I realized what he meant when I tried to install PySoy. Debian’s repositories are a bit too outdated. I had to compile about 3 packages from source. Well anyway I am eager to get to the part that involved my work.

Pysoy makes it extremely easy to create spheres and cubes and impart to them a certain velocity or rotation. Superb work really. Since my task involved working with diffused light, ambient light and specular light, all I had to do was create a sphere and a cube and get them to rotate so that I could make out the defects in my imagination of diffused and ambient light and the specular highlights. Here is the code ( beautiful, a few lines and the job is done, superb stuff this PySoy thing ):

#!/usr/bin/python

import soy

sce = soy.Scene()

scr = soy.Screen()

win = soy.Window(scr, 'Mesh shape test', background=soy.colors.Black())

cam = soy.bodies.Camera(sce)

cam.position = (0.0, 0.0, 20.0)

lig = soy.bodies.lights.Light(sce)

lig.position = (-10.0,10.0,2.0)

pro = soy.widgets.Projector(win, camera=cam)

mat = soy.materials.Rhodonite()

key = soy.controllers.Keyboard(win)

key['q'] = soy.actions.Quit()

key[ 1 ] = soy.actions.Quit() # 9 = esc key

wcn = soy.controllers.Window(win)

wcn['close'] = soy.actions.Quit()

sha1 = soy.shapes.Box(1.5, 1.5, 1.5)

cube = soy.bodies.Body(scene=sce,mesh=soy.meshes.Shape(mat),shape=sha1)

cube.position = (2, 0, 0)

cube.rotation = (0.25, 0.25, 0.25)

sha2 = soy.shapes.Sphere(1.0)

spr = soy.bodies.Body(scene=sce,mesh=soy.meshes.Shape(mat),shape=sha2)

spr.position = (-2, 0 , 0)

spr.rotation = (0.5, 0.5, 0.5)

That bit of code creates a sphere and a cube and imparts rotation to them at a particular velocity. My work (involving the implementation of specularity, diffusion and ambience) can be seen in the svn.diff I have attached below.

Pics of the output can be seen at my new gallery installation

Oh by the way, here is the svn.diff

And this is what my mentor had to say:

Comment 6 by ArcRiley, Today (22 hours ago)
Verified.

Shriphani’s work shows an eye for detail and has done a fantastic job with this task.

Comment 7 by will.guaraldi, Today (3 hours ago)
Marking this as completed. w00t!

I have to thank Google for having given kids the opportunity to contribute to the open source world. At the GHOP, I have written docs and messed with OpenGL. I want to do another task, hopefully involving Django (not advocating its use but creating a site or something like that.).

0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment