FBA The Creator

The True Multiplatform PC / PocketPC Opensource Development Tool - Read Only Mode - Kept only for historical purposes - Thank you all ;)
It is currently Thu Jun 04, 2026 2:42 am

All times are UTC




Post new topic  Reply to topic  [ 12 posts ]  Go to page 1 2 Next
Author Message
PostPosted: Fri Jan 01, 2010 9:07 pm 
Offline

Joined: Fri Jan 01, 2010 6:39 pm
Posts: 19
hello! :)

i try to create multiplayer game. the single-player mode is totally ready and working, 9 of 10 players controls by poor AI.

please, can you make the code, which connect two ppc (local web ia already exist) and then ppc's can translate strings each other.

thanks!

and more - can you give me a pice of advice - how to organize one server and many clients at the multipleer game? (i understand it some "cloudly"...)


Top
   
PostPosted: Sun Jan 03, 2010 9:04 am 
Offline

Joined: Fri Jan 01, 2010 6:39 pm
Posts: 19
and more...
____________________________________
sock:send("GET /downloads/misc/tutorial_file.php HTTP/1.0\r\n")
sock:send("Host: www.fbacreator.com\r\n\r\n")
____________________________________
can you comment this two lines? especialy bold letters? and give us "tutorial_file.php" sources?

thanks!


Top
   
PostPosted: Sun Jan 03, 2010 12:08 pm 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
Actually it's just an HTTP GET request. I could post php sources,
but I doubt it will be useful, it's just a php page which increments a counter on a mysql table ;)


Top
   
PostPosted: Sun Jan 03, 2010 1:00 pm 
Offline

Joined: Fri Jan 01, 2010 6:39 pm
Posts: 19
thanks for answer!

it's important for my HOW php page send messages back to client. So, please, post it. :)

and what about first post?


Top
   
PostPosted: Sun Jan 03, 2010 11:08 pm 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
<?
require_once("../../includes/db_connection.php");

$db=connectDB();

$oldhits=increment_visits($db);
$oldts=update_timestamp($db);

echo "Page hits: $oldhits - Last Hit: $oldts\r\n";

disconnectDB($db);
?>


Top
   
PostPosted: Mon Jan 04, 2010 8:33 am 
Offline

Joined: Fri Jan 01, 2010 6:39 pm
Posts: 19
just an "echo"... ok, it explain many things...

evilmaio, i dont wont to be bothering, but... the first post, pleeease) about two ppc and tcp connection :)


Top
   
PostPosted: Mon Jan 04, 2010 8:36 am 
Offline

Joined: Fri Jan 01, 2010 6:39 pm
Posts: 19
...and
____________________________________
sock:send("GET /downloads/misc/tutorial_file.php HTTP/1.0\r\n")
sock:send("Host: http://www.fbacreator.com\r\n\r\n")
____________________________________
can you comment bold letters?

thank you very match! :)


Top
   
PostPosted: Mon Jan 04, 2010 7:01 pm 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
shaber wrote:
...and
____________________________________
sock:send("GET /downloads/misc/tutorial_file.php HTTP/1.0\r\n")
sock:send("Host: http://www.fbacreator.com\r\n\r\n")
____________________________________
can you comment bold letters?

thank you very match! :)


This simulates just an HTTP request, it's not multiplayer related.
http://www.faqs.org/rfcs/rfc2616.html

You can try by yourself with telnet on a website, for example:
from command prompt:
telnet www.fbacreator.com 80
then typing
GET /downloads/misc/tutorial_file.php HTTP/1.0 <return><return>

Multiplayer is a large argument and cannot be covered by a single post.
Basically in a client-to-client connection, like your pocketpc game, one of your players acts like a "server" (a listening socket), the other players will connect to the server player.
The way the clients communicate each others, is up to you. You should define which messages you send to your clients and how they should react when they receive them.
So:
- prepare in your game a section where your player can start a server section, then you bind a listening socket on FBA, which will do the server part (the client could be now in "pause" until all players are connected..but this is your decision..)
- prepare in your game a section where other players can connect to a server player. You ask user to enter destination IP and port, then try the connection.

When all needed players are connected, you just send and receive string messages. Define your own protocol and commands, etc

Remember, if you're using a wifi connection through a wifi router to connect your pocketpc on the internet (most common case), even if you open a listening socket, it won't be visible by other ppc connecting from external networks, until you nat your ports on your router.

Bluetooth networking could be better, but it's not directly supported by FBA. (see previous posts..)

Other option could be creating an external listening server (using any language you prefer...java,c++) running on a public machine (provided you can have one). In this case you'll have just "clients" pocketpc connecting on this machine.

As I said before...it's a VERY large argument.. :)

Regards.


Top
   
PostPosted: Tue Jan 05, 2010 4:09 pm 
Offline

Joined: Fri Jan 01, 2010 6:39 pm
Posts: 19
thank you for a lot! :)

i understand all hardness of multiplee'sr tasks...
ok, let's move slowly. Can i organize the program, which send string to the self-one?

this is an elements of my code:

Code:
sock:settimeout(1)
sock:connect("localhost", 990)
sock2:settimeout(1)
sock2:connect("localhost", 990)
local host2,port2 = sock2:getpeername()
local host,port = sock:getpeername()
...
print(10,30,"CONNECTED TO " .. host .. " ON PORT " .. port,0,255,0)
print(10,40,"CONNECTED TO " .. host2 .. " ON PORT " .. port2,0,255,0)

-- both of this strings printing correctly! its 127.0.0.1 and 990

sock2:send("my_string")
data,err = sock:receive()
  if data~=nil then
    debug(data)
  end


"my string" is never debuging. why? how can i make this?


Top
   
PostPosted: Tue Jan 19, 2010 3:00 pm 
Offline

Joined: Fri Jan 01, 2010 6:39 pm
Posts: 19
thank you very match :D

i have learned this question samself and sucsessfully solved the problem...


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 12 posts ]  Go to page 1 2 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited