[ Login | Register ]

The Shining Source

« previous next »
Pages: [1] 2 3 Print
Networking   (Read 153083 times)
Old Post August 01, 2005, 02:29:59 am
#1
Job
Shining Light *

Posts: 230

Logged
Networking
I've just realized something that makes client/client connections problematic. I had this timeline:
Code:
. User A starts the application. 
     - Application creates a server service listening on port X.
     - Application connects to a web server and:
           > Obtains a list of waiting users.
           > Registers User A as a waiting user.
     - User A selects an opponent, User B, from the list of waiting users.
     - Application starts the client service and:
           > Connects to the server running on User B
           > Sends a message telling User B to connect to User A. PROBLEM
              BECAUSE A MAY NOT HAVE A GLOBALLY ADDRESSABLE IP
              ADDRESS.
     - At this moment User A and User B are officially connected and can
       communicate with therespective client services.


It may not always be possible to get an ip address for the client machine. Suppose you're behind a router, which you probably are, and want to play a multiplayer game, then you likely have a local (internal) IP address (like 192.168.x.x) assigned to you by your router. The router is the one who has the external IP address. In this case if i wanted to connect directly to your computer, from my computer, i can only use the external IP address (the internal address is useless), and so i can only reach your router. Most routers are not set up to forward incoming requests onto the machines in the local network, let alone forward the correct port.
What this means is that it may not be possible for a client to connect to another client via IP addressing, hence there must always be a server in the middle. My plan is to use a server as a dispatcher.
With this approach, both clients, A and B, connect to the server. Then, since a client can't directly talk to the other client, whenever A wants to send a message to B it sends the message to the server and the server is the one who actually sends the message to client B.
This, i hope, won't really load the server up since it will only forward the messages, which involves minimum computation.
Any thoughts on this?


Old Post August 01, 2005, 02:19:01 am
#2
Administrator Shining Spammer *

Posts: 1,129

Logged
Networking
Yeah that's the right way to build something that will be easy for people to install and start playing right away.

Creating a direct connection would be an easy way to test out the game between the likes of ourselves - but if you feel you're capable of making something better (like that), then by all means do Smiley

~Elvenfyre


Old Post August 01, 2005, 02:34:57 am
#3
Job
Shining Light *

Posts: 230

Logged
Networking
I'm just thinking about the other guys, Ty & Co, who may not have a server available (a web host will probably not do it since you need to run your own server software and connect to ports other than the http port). You can use my server if you want, as long as your software doesn't crash it Tongue. I'm actually very much considering getting a new server to devote completely as a web host, that one you can crash all you want.


Old Post August 01, 2005, 10:21:24 pm
#4
Ty
Administrator
Shining Sideburns *

Posts: 837

Logged
Networking
I think I'll use a peer to peer model to begin with, as that means anyone with the game can act as a server. The main problem is preventing cheats, so I'll have to look at that.


Old Post August 02, 2005, 03:07:23 am
#5
Job
Shining Light *

Posts: 230

Logged
Networking
A great advantage of Java is how easy it is to use multi-threading which significantly improves server performance.


Old Post August 02, 2005, 11:32:49 am
#6
Administrator Shining Spammer *

Posts: 1,129

Logged
Networking
Job, Devlyn has said if we keep it open source we could use BABS for the battle engine.
??

~Elvenfyre


Old Post August 02, 2005, 01:29:10 pm
#7
Administrator
Shining Spammer *

Posts: 1,208

Logged
Networking
Yup, you are free to edit or use parts of the BABS code wherever you like. I would appreciate it of course if you'd put me somewhere in the credits, but I guess that's only logical Wink.

Devlyn

Great news for Shining fangame developers! Wink

Correcting your non-working <img> tags since 1982 Wink


Old Post August 02, 2005, 04:12:50 pm
#8
Job
Shining Light *

Posts: 230

Logged
Networking
Thanks Dev, i'll need the source code for BABS once i'm finished with this. I made a simple server and a simple client. As it is, after i start the server and connect a few client instances it's easy for the clients to communicate with the server and i can even broadcast messages from the server to the clients.
However i just found out about the JXTA protocol, a P2P protocol which is supported by Java and is implemented like the Java Sockets that i'm using right now.
The purpose of the JXTA protocol is to allow client-client connections between computers that are unaddressable (either because of a firewall, NAT, etc) so i'm back to the original timeline.
Like Ty i'm also going P2P.


Old Post August 03, 2005, 02:51:53 am
#9
Administrator Shining Spammer *

Posts: 1,129

Logged
Networking
Sounds great, can't wait to hear more : )

I'll keep working on balances and imbalances.
I've been thinking of ways to implement classic spells into combat.  So stuff like a guy who when he hits the opponent, their agility decreases, or he gains some % of health back and all sorts of stuff.  (and also how these would be implemented in a BABS sense)

One other thing that I thought of if it's PvP, is a time limit between moves.
You don't want to have to rush your move - but then again you don't want to be waiting 5 minutes for your opponent to make one move.

If you limit each move to a maximum of 60 seconds, I really feel this is enough(don't move in this time, you get a warning at 10 seconds left, and then you lose your turn) - because with 10 units on  your team, to move each unit once, that's 10 minutes.  10 minutes should be more than enough to check out your opponents units and so on.

~Elvenfyre


Old Post August 03, 2005, 05:37:49 am
#10
Job
Shining Light *

Posts: 230

Logged
Networking
It's probably going to take a while to figure this JXTA thing out. It took me most of today just to figure out how to install the open source libraries under Eclipse, but i ran some demos and they work.


Old Post August 03, 2005, 07:27:09 am
#11
Shining Something *

Posts: 142

Logged
Elvenfyre Please Read
Elvenfyre,

Have you received my e-mail , which I sent last monday ?  :?

Love is Grand , Divorce ..... a hundred Grand


Old Post August 03, 2005, 10:49:53 am
#12
Administrator Shining Spammer *

Posts: 1,129

Logged
Networking
Yeah I have Peter, sorry that I didn't reply!  I really should have.

Just had no time to play with the images and turn them into something yet.
Great work though!

How far are you on sprite models?

Would be a really awesome to create some menu backgrounds with screenshots of a couple of guys in one of the landscapes with swords crossed.. or an archer firing at a mage who has a spell ready kind of thing.

I'm just not so sure what to do with these images you've sent me, I'm sure I'll come up with something.

~Elvenfyre


Old Post August 04, 2005, 09:04:44 am
#13
Shining Something *

Posts: 142

Logged
Networking
Phew , I was worried there for a minute. I thought I made a typo in your e-mail adress  :lol:

Happy to know you like the screenies.  Cheesy

Sorry I can't give you an estimate of when my models are finished.
They are boned meshes for now and still need a lot of rigging.
I haven't begun texturing  Sad .

If you need more screenies, just let me know ok?  Smiley

Love is Grand , Divorce ..... a hundred Grand


Old Post August 05, 2005, 03:12:35 am
#14
Job
Shining Light *

Posts: 230

Logged
Networking
I made another client and server, this time using the JXTA protocol. Took me alot of work to understand how to work with JXTA but i finally got it.
The way it works is:
Server:
    . Creates a Peer Group named SFMP (if it doesn't exist).
    . Joins the group SFMP.
    . Creates a pipe (used in P2P connections) with a pipe id generated by a username.
    . Creates a JXTA server socket from the pipe above and listens for incoming connections.

Client:
    . Creates a Peer Group named SFMP (if it doesn't exist).
    . Joins the group SFMP.
    . Creates a pipe with a pipe id generated by the username corresponding to the user it wants to connect to.
    . Creates a JXTA client socket from the pipe above and connects to the server.
    . Sends 1824 messages each of size 66 Kb to the server, which comes to about 120Mb.

The client above takes between 1 and 2 minutes to send 120Mb to the server which is pretty fast even if i'm on DSL and sending from my computer to my computer.


Old Post August 05, 2005, 05:04:53 am
#15
Administrator Shining Spammer *

Posts: 1,129

Logged
Networking
That's awesome progress!
Wow man excellent.

I guess the next step is listing different clients waiting on the server and choosing which one to make a connection with, the (users)negotiation of the connection - and then the connection itself allowing the two people to let's say, chat to each other and end the session when they're ready.

:E

I dunno though, you tell me!

~Elvenfyre


Pages: [1] 2 3 Print 
« previous next »
Jump to:  

Powered by SMF 1.1.21 | SMF © 2013, Simple Machines