Soulfu Working (Almost, Need Help)


Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,527
Location
Detroit, Michigan
Website
Visit site
I finished the conversion of soulfu to opengles and it works great, but I have one problem i cant get the player character to move right, it will only move left or up. right and down always move left.
The desktop version works right. Ive been looking and i just cant find the specific problem. The key area to look is in character_local_player_control.

Code:
                    // Generate gotoxy, based on camera rotation...  Map_side_xy shouldn't have gotten corrupted
                    // by window cameras...
                    x = *((float*) (character_data));
                    y = *((float*) (character_data+4));
                    x+= (player_device_xy[i][X]*map_side_xy[X] - player_device_xy[i][Y]*map_side_xy[Y])*10.0f;
                    y+= (player_device_xy[i][X]*map_side_xy[Y] + player_device_xy[i][Y]*map_side_xy[X])*10.0f;
                    *((float*) (character_data+12)) = x;
                    *((float*) (character_data+16)) = y;

the final x and y seem ok compared to the desktop, but the initial x and y are not.
This would be a nice game to have on pandora and im hoping more eyes might spot the problem.


pickle.gp2x.de/source/soulfu_pandora.zip
 
Good news!
Unfortunately I can't help here :( Hope somebody can though.
 
"Soulfu"? :huh:

*googlegoogle...*

Hey, looks pretty nice. :) A 3D RPG, exactly what the Pandora needs. ^^ It seems to be from the same guy who currently do this amazing Sandbox Game thingy "Lords of Uberdark", also something I want to see on the Pandora. ( http://www.kickstarter.com/projects/901026204/lords-of-uberdark-3d-voxel-based-mining-building-g )
Give that Man a Pandora! :D
 
hm i just looked over the sources, i can't spot the problem either.

first i thought it has something todo with struct packing thought character_data is some struct and not just a byte array.
really weird implementation :)

just guessing

- maybe the compiler goes a little crazy here? tried turning off compiler optimizations?
- it could also be some variable type differencies? some type treated as unsigned though it should actually be signed?
 
Wow that's some nasty piece of code in that game, especially that main_character_data array. The author has never seen C structures or something.

Anyway I smell an alignment issue here, try sticking __attribute__((aligned(4))) to main_* structures in object.c like this:
Code:
unsigned char main_character_data[MAX_CHARACTER][CHARACTER_SIZE] __attribute__((aligned(4)));
unsigned char main_particle_data[MAX_PARTICLE][PARTICLE_SIZE] __attribute__((aligned(4)));
unsigned char main_window_data[MAX_WINDOW][WINDOW_SIZE] __attribute__((aligned(4)));
 
crow_riot ive tried with and without any opto flags and im also using -fsigned-char. But i dont think it would matter as the code has the signed/unsigned keywords.

notaz I and others have also talked about this. The only thing that has me doubting this is that I remembered I had a svn of some modified soulfu sources, in which the author has switched the byte array into a structure. The same bad control behavior is there also. But I will give your idea a try and see whats happens.

Im actually wondering if the problem lies within the script system.
 
Could you contact the author? Maybe he has an idea whats wrong.
 
another idea, well something with overflows again. but now in the input code:

it's near line 546 (there are actually 2 occurences)
Code:
joystick_position_xy[event.jaxis.which][event.jaxis.axis] = (event.jaxis.value+JOY_TOLERANCE)/(32768.0f-JOY_TOLERANCE);

i'd just cast to float to be really sure:
Code:
joystick_position_xy[event.jaxis.which][event.jaxis.axis] = (float)((event.jaxis.value+JOY_TOLERANCE))/(32768.0f-JOY_TOLERANCE);


dunno ... seems an odd fix, but i guesswork FTW ;)

how about logging the joystick_position_xy values? if something moves correct to the left side, i think there's something wrong a sign.
 
mcobit said:
Could you contact the author? Maybe he has an idea whats wrong.

I have and the only feedback was to look at the function i mentioned int he op.

crow_riot : joysticks are are not being used, i even went as far to not let it enable them.
 
Last edited by a moderator:
Pickle said:
crow_riot : joysticks are are not being used, i even went as far to not let it enable them.

Did you test if the joysticks work? In this case it should be a problem in the keyboardinputcode.
 
Last edited by a moderator:
mcobit said:
Pickle said:
crow_riot : joysticks are are not being used, i even went as far to not let it enable them.

Did you test if the joysticks work? In this case it should be a problem in the keyboardinputcode.

I traced the joystick input into this function and each direction is registered correctly. The only thing ive seen wrong is the x,y position coordinates coming into this function. The gotoxy seem correct, so i expect there might be an issue moving the character from x,y to the gotoxy.
 
Last edited by a moderator:
I noticed that you actually can walk up and to the right by pressing up and right on the dpad.
But it's hard to trace values when the character keeps flying into the air along with all the other objects, does this happen for you as well pickle?

I put a printf to check the values of x and y every frame (between lines 2585 and 2586)
Code:
                    y+= (player_device_xy[i][X]*map_side_xy[Y] + player_device_xy[i][Y]*map_side_xy[X])*10.0f;
                    printf("x: %f  y: %f\n",x,y);
                    *((float*) (character_data+12)) = x;

and the strange thing is that just walking downwards yields the approximate same initial results (x increases keeps on slightly, y goes to -9,97)
However, on the panda y stays the same while on my comp it keeps decreasing, I have no idea why.

As far as I can tell (just to be sure)
character_data/+4 is current xy, while character_data +12/+16 is gotoxy?

some other points of interest for ppl browsing the code;

1448 in charact.c is the character turning code.
1634 in charact.c is according to the comments, where the actual movement is updated (after all collision checking and such).
 
Dimacus said:
But it's hard to trace values when the character keeps flying into the air along with all the other objects, does this happen for you as well pickle?

If i get to close to walls the character will fly up.

Also i have access to the svn, i moved most of the code over, although i redid some and have some new gfx bugs. I will be making a branch for testing.
 
Last edited by a moderator:
When i start it, the character and barrels start a fair height over the ground, and then after a couple of seconds they shoot straight up, and after a while starts to descend, then they shoot up again, and so on and so on.
If you fixed the movement problem, may I ask what it was?
 
Dimacus said:
When i start it, the character and barrels start a fair height over the ground, and then after a couple of seconds they shoot straight up, and after a while starts to descend, then they shoot up again, and so on and so on.
If you fixed the movement problem, may I ask what it was?

I havnt fixed it, i only had a hack on the xy position so i could force the movement. I dont think i have seen the behavior you describe at least at the beginning.
 
Last edited by a moderator:
Would anyone be interested in making a new version of SoulFu with lots of new features and stuff?
 
Back
Top