Fix lag = earn 20 dollars

Hi guys, i am currently making a game, and as it starts to get bigger so does the lagging…
i really tryed everything (within my knowledge) of decreasing the lagging, and read every forum that i could find of what the problem could be.
and i still have two Scenes that is lagging.
So i if i upload the Scene here, i will pay whoever is able to remove the lag from the scenes and explain to me exactly what they did. 20 dollars.

Althought, i will only transfer thru Paypall… so im just gonna need your e-mail… you can send it privatly to me in case you dont wanna post it here…

And of obviously i am only gonna pay the first one to solve my issue.

Here is the two scenes:

I’m taking a look.
You’ve got far too many mouse over sensors. For each sensor the game casts a ray to check the intersection. Instead, use one sensor and a python script.
e.g




from bge import logic, types


def poll(cont):
    mice = (s for s in cont.sensors if isinstance(s, types.KX_MouseFocusSensor))
    try:
        mouse = next(mice)
    except StopIteration:
        return
    
    if not mouse.positive:
        return 
    
    hitObject = mouse.hitObject
    
    if hitObject is None:
        return
    
    logic.sendMessage("mouse_over", "", hitObject.name)

Add a mouse_over any sensor, set it to true pulse and connect it to this script in module mode:
Controller: Python, mode: Module, module name: mouse.poll
Create a script called “mouse.py”
I used this script to change it automatically:

import bpy

for obj in bpy.data.objects:
    changed = []
    for sens in obj.game.sensors:
        if sens.type == "MOUSE" and sens.mouse_event == "MOUSEOVER":
            sens.type = "MESSAGE"
            changed.append(sens.name)
            
    for sens in obj.game.sensors:
        if not sens.name in changed:
            continue
         
        sens.subject = "mouse_over"

I’m investigating the render now.

You need to apply your modifiers. Unapplied modifiers really slow down the framerate in the case of SubSurf and others. You shouldn’t be using subsurf at all in the GE to be honest.

Attachments

faster.blend (486 KB)

Dude! thats and awesome idea, now that you mention it i just started notice how the lag increases incredibly much when something with that mouse over sensor is visible… i never thought of that myself actually and now i totally see it !

Can you attach an example of how you would make a version of the enemy in my game, that will work with 2.49b, with those script that you are mentioning?
cause it cant seem to make it work, i think im doing something wrong when i am trying…

Firstly, I’d really advise you to use 2.6. It makes it incredibly hard to debug and fix issues because some of them are already fixed in the newer game engine releases, and others require you to port scripts to the older API.

It’s not your fault in this context; the scripts are designed for 2.5.

Please, I implore you, download the latest Blender release. It is easier for everyone (yourself included!) to use.


import GameTypes as types
import GameLogic as logic


def poll(cont):
    mice = (s for s in cont.sensors if isinstance(s, types.KX_MouseFocusSensor))
    try:
        mouse = next(mice)
    except StopIteration:
        return
    
    if not mouse.positive:
        return 
    
    hitObject = mouse.hitObject
    
    if hitObject is None:
        return
    
    logic.sendMessage("mouse_over", "", hitObject.name)

This should work for 2.49b (I think). For the other script it would be easier for you to manually change each sensor because I’m not familiar with the older version API.

Hey I have a way better fix please messege me then I will tell you exactly how to fix it