Saturday, June 2, 2012

World of worlds

After talking with the developer of jPCT-AE, he gave me some ideas of how to fix my frame rate issue. The model now has less objects needing to send to the gpu for processing (25 instead of 37), and I'm using a beta version of the engine which has brought the game up to 16 fps. MEGA UPS!!

Although I should be working on game play issues, I'm stuck on a menu issue. 2 days ago (I didn't work on it today), I thought about the idea of action a faction to the menu system. So if the user moved too much in one direction, it would stop accepting inputs from the other direction till the user lifts their finger. A sort of x/y faction system.
I don't know why, but it's causing weird glitches. If the user moved their finger down left at a 45*-ish angle, the game would choose a faction (as expected), allow movement of that chosen faction...but it wouldn't reset the other faction's movements.


= Movement faction code
dta[0] = dx / 14;
dta[1] = dy / 8;

if(faction < 0)
{
    float div = 1/4f;
    facTest[0] = Math.abs(menuMovement[0]) / (hcycle * div);
    facTest[1] = Math.abs(menuMovement[1]) / (vcycle * div);
   
    Log.d(TAG + " -Fac", "FacX: " + Round(facTest[0], 4) + ", FacY: " + Round(facTest[1], 4));
   
    if(facTest[0] >= 1 && facTest[0] > facTest[1])
    {// dx wins
        reel.iSpin(menuMovement[1]);// un-rotate the previous spool
        menuMovement[1] = 0;
        dta[1] = 0;
        faction = 0;
    }
   
    if(facTest[1] >= 1 && facTest[1] > facTest[0])
    {// dy wins
        cam.moveX(menuMovement[0]);
        menuMovement[0] = 0;
        dta[0] = 0;
        faction = 1;
    }
} else
{
    Log.d(TAG + " -Fac", "Faction: " + faction);
   
    if(faction == 0)
        dta[1] = 0;
   
    if(faction == 1)
        dta[0] = 0;
}

I'm doing the action to reset the movement of the other faction....and nothing. So, I'm just gonna disable it. It'll make the menu look weird and unconstrained, but I have more important problems now, like MAKING A GAME.

After I disable this code, I'm gonna work on making a game play class (like the menu has it's own class, so it doesn't clutter the renderer class). I have a few ideas of how to make the game class and how to transition from the classes. Currently, the game has one 'world". Each frame, the world is given data to where to render data to, and then eventually the framebuffer renders that data.
So, my idea, each class will have it's own world to enable the option to disable all rendering on another part of the game. But, like all things, it needs testing and possible many failures till I get it right.

= Todo =
- Same as the last blog

1 comment:

  1. I just disabled the faction code and everything relating to it...and the problem still exists :-/.

    Which means I'm in a deeper problem, because the game play will have this problem too. And on a second though, the game play will need faction code too, or at least a larger deadzone to identify which way the user is scrolling.

    Either way, I need more thoughts and testing on this before I say anything else.

    ReplyDelete