Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (532)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3 ... 10
 1 
 on: 2014-07-24 22:25:22 
Started by Chumble - Last post by Chumble
Thanks for the reply. I'll have to look up this "Nettys", I'm sure there's a few threads around here.

 2 
 on: 2014-07-24 22:16:24 
Started by Chumble - Last post by tkausl
Right now, when the server gets an incoming connection from a client, I create a new Socket for that client and pass it to the listen thread. With this UDP example, it seems to just accept any traffic over a given port .. so all of my traffic would go towards a single DatagramSocket.receive running on the main server. I guess I can get the IP address from the message in order to determine what player it belongs to but it really makes the whole thread part useless if all the messages will come to the same exact place. Am I correct in thinking this way?
Yep, you are.

Possible UDP setup?:

Client
 * Attempt to communicate with server. If successful...
   * Creates a thread to listen for messages from server.
   * Processes client input, sends messages from server, interprets server response.

Server
 * Create Main listen thread
   * Main Listen thread gets ALL messages from ALL clients. As soon as a message comes in, it determines which client it belongs to and hands the message off to a client-specific thread (or creates one if this is the client's first time connecting)
      * Client Listen thread processes the message and passes the response back to the client.
 * Processes server input, sends messages to client, interprets client messages.
Well you could do this yourself this way but i think youre in better shape by using a Networking-lib. I think nettys udp works (for the programmer) almost the same way as tcp since netty creates "fake"-connections and handles the delegating (to which session/connection this packet belongs) itself.

 3 
 on: 2014-07-24 21:54:12 
Started by Chumble - Last post by Chumble
After many headaches, I have decided it is in my best interest to convert my client/server game to UDP from TCP. I am not interested in starting any TCP vs UDP discussion in this thread.


Currently, the setup is as follows (simplified)

Client
* Attempts connection to server. If success...
   * Creates a thread to listen for messages from server.
   * Processes client input, sends messages from server, interprets server response.

Server
* Waits for connection attempts. If a connection happens ...
   * Create a thread to listen for messages from client.
* Processes server input, sends messages to client, interprets client messages.

Pretty much the same on both sides except that there will be multiple threads generated by the server, one for each client.

I am having a fairly difficult time finding useful UDP examples to reference. I was using http://systembash.com/content/a-simple-java-udp-server-and-udp-client/ as a reference, but one main concern comes to mind.

Right now, when the server gets an incoming connection from a client, I create a new Socket for that client and pass it to the listen thread. With this UDP example, it seems to just accept any traffic over a given port .. so all of my traffic would go towards a single DatagramSocket.receive running on the main server. I guess I can get the IP address from the message in order to determine what player it belongs to but it really makes the whole thread part useless if all the messages will come to the same exact place. Am I correct in thinking this way?

Possible UDP setup?:

Client
 * Attempt to communicate with server. If successful...
   * Creates a thread to listen for messages from server.
   * Processes client input, sends messages from server, interprets server response.

Server
 * Create Main listen thread
   * Main Listen thread gets ALL messages from ALL clients. As soon as a message comes in, it determines which client it belongs to and hands the message off to a client-specific thread (or creates one if this is the client's first time connecting)
      * Client Listen thread processes the message and passes the response back to the client.
 * Processes server input, sends messages to client, interprets client messages.

 4 
 on: 2014-07-24 21:47:32 
Started by Orangy Tang - Last post by Catharsis
Technically what I've done is taking stock Java 5 language level features and inverting OOP on its head to make Java as functional like as possible without requiring taking the step of moving to a JVM based language to achieve this level of dynamic behavior. Runs everywhere including all versions of Android. The problem, having a large differentiated OOP SDK to deploy across the Android ecosystem, existed before the solution. It's nice that this direction also fully supports a fully dynamic CA based ES too without hard locking the API to one particular use case allowing dynamic optimization possibilities. I tried everything OOP (well except dependency injection; shudder / eh! We can at least agree DI reeks and is of the devil right?) under the sun to ease the pain before finding something that significantly eased the pain and brought joy to coding again. You too will have your pain eased in time.. ES4L!  Pointing ES 4 Life, Yo...  Cool

 5 
 on: 2014-07-24 21:39:30 
Started by TheFrog - Last post by TheFrog
Thanks ra4king,  I hadn't realized, I just moved it to a new server...



 6 
 on: 2014-07-24 21:28:21 
Started by theagentd - Last post by gouessej
Roquen, please can you elaborate?

 7 
 on: 2014-07-24 21:23:26 
Started by theagentd - Last post by basil_
All of this profile stuff is duct tape and super glue.
yea, it's like coding perl around java to get it to work.

 8 
 on: 2014-07-24 21:23:08 
Started by Orangy Tang - Last post by Roquen
Proebsting's Law: Compiler Advances Double Computing Power Every 18 Years.

Don't write a system to guess what you know.

 9 
 on: 2014-07-24 21:18:51 
Started by Orangy Tang - Last post by Catharsis
BAH!! You wouldn't believe what I've seen; beautiful accelerating heuristics dynamically unfolding through time.

 10 
 on: 2014-07-24 21:17:40 
Started by theagentd - Last post by Roquen
All of this profile stuff is duct tape and super glue.

Pages: [1] 2 3 ... 10
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (17 views)
2014-07-24 01:59:36

Riven (17 views)
2014-07-23 21:16:32

Riven (14 views)
2014-07-23 21:07:15

Riven (17 views)
2014-07-23 20:56:16

ctomni231 (45 views)
2014-07-18 06:55:21

Zero Volt (40 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (51 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!