[homebrew] Pong game Ad Hoc

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

[homebrew] Pong game Ad Hoc

Post by zydeoN »

Hi, im working in a pong game, that can be played via ad hoc against another player. The source is fine, but there is a problem: im sending two different data at the same time to another psp, that are the position of the ball and the position of the paddles. In result, the movement of the ball (in the psp that receives the data from the other) is some kind of slow and with "breaks".
If i deleted the one of the sending data, for example, the position of the paddles, the movement of the ball would be perfect, with no breaks. So i suppose that the problem is in sending two different data at the same time. How can i solve the problem? I´ve heard about threads, is it going to help me ?
Gefa
Posts: 11
Joined: Wed Aug 13, 2008 8:31 pm
Location: Italy
Contact:

Post by Gefa »

I guess you must send just a string, witch contains the coordinates of the balls and paddles, then you'll parse it obtaining the coordinates.
For my PSP project, visit my web site: www.gefa.altervista.org

PaintMIXER v2.6.0 released: http://www.neoflash.com/forum/index.php ... 253.0.html
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Post by zydeoN »

thats not so easy, because the Adhoc only accept strings and if i would pass the coordinates of each position i had to do:
If "x=0 and y = 13 " then
x = 0
y= 13

If " x == 0 and y == 14" then
x= 0
y = 14
.
.
.
and so on... I already made the homebrew, but the movement of the ball is not random xD Now, im making a prx that turns off psp when button is pressed, but i just cannot deal with it. if anyone can help me, please read the other topic i created :P
Gefa
Posts: 11
Joined: Wed Aug 13, 2008 8:31 pm
Location: Italy
Contact:

Post by Gefa »

Anyway you didn't understand... You have to send a string like:
12,34,45,32

Where the first two numbers are the coordinates of the first ball; instead, the two latest are the coordinates of the second ball.

Then, you must split that string by passing as argument of division the char ",", obteining in this way the 4 numbers. Sorry for my bad english, have you understood?
For my PSP project, visit my web site: www.gefa.altervista.org

PaintMIXER v2.6.0 released: http://www.neoflash.com/forum/index.php ... 253.0.html
imhotep
Posts: 41
Joined: Tue Dec 13, 2005 9:15 pm

Post by imhotep »

that's easy, just use strtok
create strings like for example for player 1:
100X50
then parse them with strtok with the delimiter 'X'
voilà
Post Reply