| View previous topic :: View next topic |
| Author |
Message |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Sun Jun 11, 2006 8:47 pm Post subject: WLAN Multiplayer? |
|
|
I made a little game, with multiplayer, by using irda,
but if I could use WLAN it would be much better...
so, if anyone could tell how the WLAN works, or even better, make something like the irda sample but WLAN based, I would be really happy.
Does anyone have enough sparetime to help me out?
thanx, Kakolukia |
|
| Back to top |
|
 |
Altair
Joined: 20 May 2006 Posts: 76 Location: The Netherlands
|
Posted: Mon Jun 12, 2006 1:08 am Post subject: |
|
|
| There is a WLAN example in the "Application" folder of LUAplayer itself. And there is no ad-hoc wlan yet for LUAplayer. |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Mon Jun 12, 2006 3:47 am Post subject: |
|
|
well, i read this thread:
http://forums.ps2dev.org/viewtopic.php?t=2471
but i don't fully understand how to get 2 psps connecting to eachother.
what do I need te set as settings in the infrastructuremode?
and how can i get lua to send codes like the irda codes using wifi?
maybe i totally misunderstood it, and is it impossible, but if anyone could help me out... |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Mon Jun 12, 2006 10:08 am Post subject: Re: WLAN Multiplayer? |
|
|
| Kakolukia wrote: | I made a little game, with multiplayer, by using irda,
but if I could use WLAN it would be much better...
so, if anyone could tell how the WLAN works, or even better, make something like the irda sample but WLAN based, I would be really happy.
Does anyone have enough sparetime to help me out?
thanx, Kakolukia |
i started making what you are talking about, but it is very hard to do without adhoc support. so i am making a makeshift adhoc sample for you.
so far it is looking kind of good, um, it uses irda and wifi.
It's weird when you start the app you connect to a to a router(sorry had to use it) then you continue on to get your ip address and the ip address is sent to the other psp using irda(this is only done at the beginning of the app so that each psp knows the others ip). so this sample sets up a server and client at the same time. it is based off of the irda sample, you press x to send the "X" character to the other psp using a server/client method and vice-versa, sorry i can't post it today, but it will be up tomorrow, it's been hard sorting out the bugs and such... it should be useful to someone. _________________ - be2003
blog |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Mon Jun 12, 2006 5:16 pm Post subject: |
|
|
wow, thats just great, thanx a lot!
wanna hug you for that ;)
But isnt it possible to set the ip manually instead of getting it from a router?
Cause not everywhere I go a router is available for me...
But thank you very much for your time and effort, I really appreciate it. |
|
| Back to top |
|
 |
Altair
Joined: 20 May 2006 Posts: 76 Location: The Netherlands
|
Posted: Mon Jun 12, 2006 10:47 pm Post subject: |
|
|
| Yes you can set the ip manually. You can do that in the network settings menu. The part where you make a new connection (or edit one). Instead of automatic use Manual i think. |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Tue Jun 13, 2006 12:10 am Post subject: |
|
|
| Altair wrote: | | Yes you can set the ip manually. You can do that in the network settings menu. The part where you make a new connection (or edit one). Instead of automatic use Manual i think. |
I know that, but be2003 said:
| Quote: | | It's weird when you start the app you connect to a to a router(sorry had to use it) then you continue on to get your ip address and the ip address is sent to the other psp |
But if the ip can be set manually (for example by using the manual settings option you mentioned), it doesnt have to use a router... |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Tue Jun 13, 2006 3:21 am Post subject: |
|
|
good point, but look at it this way, in network settings you can provide the information to give to the router. for example the ip i give to the router is 192.168.0.105, now that is different depending on how you set it up. another psp cant just send something directly to my psp without adhoc. it must be redirected through a router because only the router knows who 192.168.0.105 is, not the psp, because that number is used specifically for the router and nothing else. in my sample, a router is needed but not the internet so i suggest getting a car adapter for your router _________________ - be2003
blog |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Tue Jun 13, 2006 4:43 pm Post subject: |
|
|
interresting, when do you think your code is ready?
I really want to know how you worked it out, and use it...
thanx a lot for your time and effort! |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Wed Jun 14, 2006 3:08 am Post subject: |
|
|
well it is done...i just have have to work out some bugs, mostly screen printing stuff, i dont usually print to the screen, it should be easy. then i will upload it to my angelfire site around 4-5 pm us pacific time _________________ - be2003
blog |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Wed Jun 14, 2006 4:47 am Post subject: done |
|
|
the file is here, just follow the on screen instructions. when it says to press O to echo. that is if you only have one psp the psp will communicate with itself. _________________ - be2003
blog |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Wed Jun 14, 2006 5:30 am Post subject: |
|
|
havn't tested it yet, i'm going to do this within a few mins (if everything goes right), thanx a lot!
edit: It hangs at stage 3, don't no why, i'm going to test my Wlan.getIPAddress() to see if thats the problem...
I'll tell you later...
btw, which program do you use to edit/make the lua programs ons your psp on the go? |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Wed Jun 14, 2006 6:08 am Post subject: |
|
|
psp pda(used to be psp notepad i think). with it i can write my lua apps while listening to music. edit: god i wish that danzeff had a return key, anyway psp-pda v1.2 is here. it has onscreen keyboard cuz psprint sucks. _________________ - be2003
blog
Last edited by be2003 on Wed Jun 14, 2006 6:23 am; edited 1 time in total |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Wed Jun 14, 2006 6:11 am Post subject: |
|
|
if you set up a static connection and defined your ip in network settings then it should only take a second. what version of luaplayer do you have? god i hope u are pressing x like the onscreen command tells u to _________________ - be2003
blog |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Wed Jun 14, 2006 6:37 am Post subject: |
|
|
| be2003 wrote: | | psp pda(used to be psp notepad i think). with it i can write my lua apps while listening to music. edit: god i wish that danzeff had a return key, anyway psp-pda v1.2 is here. it has onscreen keyboard cuz psprint sucks. |
i'm using that too, but as far as I know there is no way to directly test the lua from there. |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Wed Jun 14, 2006 7:00 am Post subject: |
|
|
| be2003 wrote: | | if you set up a static connection and defined your ip in network settings then it should only take a second. what version of luaplayer do you have? god i hope u are pressing x like the onscreen command tells u to |
I'm not that stupid, it just freezes, only the home button still works. which is more then in the WLAN app that comes with the luaplayer, I need the 10sec hard shutdown for that one...
I'm using luaplayer 0.20 |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Wed Jun 14, 2006 7:04 am Post subject: |
|
|
you are using manual setup right, what fw are u? _________________ - be2003
blog |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Wed Jun 14, 2006 7:07 am Post subject: |
|
|
you are using manual setup right, what fw are u? _________________ - be2003
blog |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Wed Jun 14, 2006 7:15 am Post subject: |
|
|
| be2003 wrote: | | you are using manual setup right, what fw are u? |
got it to work, I only set the ip manually in my emulated 2.50, I forgot my normal 1.50 in which I start the luaplayer. so, I'm not so stupid to nnt press the x, but I'm so stupid to forget to set the network settings correctly. |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Wed Jun 14, 2006 7:33 am Post subject: |
|
|
| thanx a lot for your help, i'm going to test it on 2 psps tomorrow, and tell you the results. |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Wed Jun 14, 2006 10:03 am Post subject: |
|
|
i am very interested, i only have one psp that is why i put in the echo option so i want to see how it works with 2, my friends couldnt find a 1.5 and they dont really like homebrew. _________________ - be2003
blog |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Wed Jun 14, 2006 6:39 pm Post subject: |
|
|
It does work (w0000000t)!
thanx for your help, I'm going to play woth this the rest of the day, and post my findings.
But 1 question:
why does the other cross/circle only blink? If I keep my cross pressed at psp1, the othercross at psp 2 doesnt stay white, it blits, so it works, but only for a milisec. (It does this also on the 1 psp echo way)
aaah, another question (it doesnt stay at 1, sorry):
If I want to send coördinates, what would be the best way to do this, cause it sends strings, but numbers would be easyer to use...
Thanx for your help, time and effort, its really helpfull to me!
p.s. I have a 1.50 and a 2.50 with GTA: LCS, both with luaplayer 0.20. |
|
| Back to top |
|
 |
Altair
Joined: 20 May 2006 Posts: 76 Location: The Netherlands
|
Posted: Wed Jun 14, 2006 9:29 pm Post subject: |
|
|
Cant you just use the strings as numbers with lua?
I have made something (which I cant test because it uses netlib and thats offline :( ) and that sends stuff from a table as strings and when it receives I use substrings to put it all back in a table. I think it should work, because Im not copying apprentices ("s) with the substrings. |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Thu Jun 15, 2006 12:27 am Post subject: |
|
|
| Altair wrote: | Cant you just use the strings as numbers with lua?
I have made something (which I cant test because it uses netlib and thats offline :( ) and that sends stuff from a table as strings and when it receives I use substrings to put it all back in a table. I think it should work, because Im not copying apprentices ("s) with the substrings. |
Well, ive been working around a bit with irda before a started this thread, and if I sended a number, the other psp received it as a string. If I used that string as a number luaplayer gave me an error...
so i translated all seperate numbers of the string to a new number, which isnt fun to do...
I do not fully understand what u mentioned, maybe it is the same as I did, maybe it is something different...
I'll post my piece of code soon, to show you how I solved it... |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Thu Jun 15, 2006 1:09 am Post subject: |
|
|
| Code: |
-- irda write:
irdax = Player.x
System.irdaWrite(irdax)
|
Player.x is the Player's x position (I shortend the code so only the necessary was left).
| Code: |
-- irda read
x = 0
command = System.irdaRead()
if string.len(command) >= 1 then
for i = 1, 1 do
char = string.sub(command, i, i)
if char == "0" then
x = x + 000
end
if char == "1" then
x = x + 100
end
if char == "2" then
x = x + 200
end
if char == "3" then
x = x + 300
end
if char == "4" then
x = x + 400
end
end
for i = 2, 2 do
char = string.sub(command, i, i)
if char == "0" then
x = x + 00
end
if char == "1" then
x = x + 10
end
if char == "2" then
x = x + 20
end
if char == "3" then
x = x + 30
end
if char == "4" then
x = x + 40
end
if char == "5" then
x = x + 50
end
if char == "6" then
x = x + 60
end
if char == "7" then
x = x + 70
end
if char == "8" then
x = x + 80
end
if char == "9" then
x = x + 90
end
end
for i = 3, 3 do
char = string.sub(command, i, i)
if char == "0" then
x = x + 0
end
if char == "1" then
x = x + 1
end
if char == "2" then
x = x + 2
end
if char == "3" then
x = x + 3
end
if char == "4" then
x = x + 4
end
if char == "5" then
x = x + 5
end
if char == "6" then
x = x + 6
end
if char == "7" then
x = x + 7
end
if char == "8" then
x = x + 8
end
if char == "9" then
x = x + 9
end
end
|
I know there is some unnessecary code in it, but that came into it by mistake... (dumb copy paste, and later only altering the highly necessary parts), also I could have used elseif's, but I was lazy or someting like that...
x is the opponent's x position.
Now I want to know how you did it, what that table stuff... |
|
| Back to top |
|
 |
SSpeare
Joined: 23 May 2006 Posts: 63
|
Posted: Thu Jun 15, 2006 1:59 am Post subject: |
|
|
Have you tried this?
| Code: |
command = System.irdaRead()
x = tonumber(command)
|
|
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Thu Jun 15, 2006 2:13 am Post subject: |
|
|
| SSpeare wrote: | Have you tried this?
| Code: |
command = System.irdaRead()
x = tonumber(command)
|
|
nope, I don't know the existance of that...
I'll try it.
thanx! |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Thu Jun 15, 2006 3:32 am Post subject: |
|
|
this is how u should set it up
first define the x
x = 5
then make it a string
sx = tostring(x)
then send it as string
System.irdaWrite(sx)
when other psp receives it, it should be...
command = System.irdaRead()
if string.len(command) > 0 then
opponentx = tonumber(command)
end _________________ - be2003
blog |
|
| Back to top |
|
 |
Kakolukia
Joined: 11 Jun 2006 Posts: 21
|
Posted: Thu Jun 15, 2006 4:07 am Post subject: |
|
|
| And it works almost the same for WLAN? |
|
| Back to top |
|
 |
Altair
Joined: 20 May 2006 Posts: 76 Location: The Netherlands
|
Posted: Thu Jun 15, 2006 11:17 am Post subject: |
|
|
Yes what you did is the same as what i did.
I didn't know the command tonumber existed. Thx for that! |
|
| Back to top |
|
 |
|