African themed game progress (WIP downloadable .blend added)

Oh, think my previous post is somehow not posted.

  • Disable Compiz
  • Use Blender 2.49
  • Update your graphics driver

Thanks for the tips Donas. I didn’t know that compiz affects the bge. I’m downloading 2.49 tonight and I’ll see how that goes.

it looks fantastic. The only problem I’m having is with the mouse and lag. The mouse movements are very hard for me to control, and so is the character in general. I also can’t pick any weapons up, which results in me getting beat up by the gorillas.

What fps do you get when you play it?
For the inventory and weapon picking to work you must have both layer 1 and layer 9 turned on. However when you turn on the inventory layer (9) the fps reduce significantly:(
Otherwise you can still kill the gorillas using kicks (R mouse button).
(NB only the swords and bow and arrow work at the moment and the pot like thingy in the water restores your health)

I’m trying to find ways of making the game run faster. I think that should resolve the lag problem. I’m not sure how to achieve this exactly but I’m trying to rationalise the logic and reduce the poly count of the scene.

You could also optimize some Python code. (Didn’t test them, just some silly examples of how to optimize Python code).
For example SetWeapon.py


G = GameLogic    
C = GameLogic.getCurrentController()
#get Sensors#
over=C.getSensor("over")

if over.isPositive():
    pick=C.getSensor("pick")
    if pick.isPositive():
        own = pick.getOwner()
        msh = own.getMesh().getName()[2:][:3]
        if msh == "arr":
            add = C.getActuator("arr")
            back = GameLogic.back
            back.setMesh(mesh)
            G.addActiveActuator(back, True)
            G.addActiveActuator(add, True)
        else:
            right = GameLogic.right
            right.setMesh(mesh)
            G.addActiveActuator(right, True)
            wtype = GameLogic.wtype
            if msh == "swo":
                wtype.setValue("1")
            elif msh == "ham":
                wtype.setValue("2")
            elif msh == "bow":
                wtype.setValue("3")
                left = GameLogic.left
                left.setMesh("Cube.005")
                G.addActiveActuator(left, True)
            elif msh == "sti":
                wtype.setValue("4")
            elif msh == "sto":
                wtype.setValue("5")
            G.addActiveActuator(wtype, True)


and MouseLook.py


import Rasterizer as r

c=GameLogic.getCurrentController()

 lmotion=c.getActuator("leftright")
wmotion=c.getActuator("updown")
P0=c.getSensor("P0")

if P0.isPositive():
    o=c.getOwner()
    mouse=c.getSensor("mouse") 
    if mouse.isPositive():
        posx=(r.getWindowWidth()/2-mouse.getXPosition())*0.0015  
        if hasattr(o, 'x')==0:
            posy=(r.getWindowHeight()/2-mouse.getYPosition())*0.002
            o.x=posy
        elif not((o.x<=-.8 and posy<0) or (o.x>=.5 and  posy>0)):
            posy=(r.getWindowHeight()/2-mouse.getYPosition())*0.0020
            o.x+=posy
        else:
            posy=0.0


        lmotion.setDRot(0,0,posx,1)
        wmotion.setDRot(posy,0,0,1)
    r.setMousePosition(r.getWindowWidth()/2,r.getWindowHeight()/2)
else:
    lmotion.setDRot(0,0,0,1)
    wmotion.setDRot(0,0,0,1)
    
GameLogic.addActiveActuator(wmotion,1)
GameLogic.addActiveActuator(lmotion,1)

Great!! Thanks Donas! I will test these out. I’ll have to go through them to understand the changes; hopefully I can optimize the other scripts as well!!

I am working on a few new character meshes and will post some screenshots soon!

Don’t know whether they work though. I’ve Blender 2.49 and the standard conversion script has a syntax bug in it (“except ConversionError as e:”).

Hi Donas,
what does the ‘return’ function in line 21 do? My version (2.48a) doesn’t seem to like it it says

Syntax error: ‘return’ outside function
do I need to use 2.49 for this to work?

Changed it now. Again, it is not tested, only to show how to optimize/cleanup some code.

Thanks :eyebrowlift: will see if I can implement the cleaning up!