S
Starwynd
Greetings.
I'm currently working on programming a game in Java for fun. This is a
multi-player game with the interface done primarily in AWT, and I have
decided to use RMI for functionality over the network, a virtual
experience sort of thing, that includes weather, and other real-time
phenomenon.
Well, the algorithm to determine the current weather is all done on
the Server, currently. However, I have the weather set on a Swing
timer on the server, so that randomly once every 2-10 hours while
running, it makes a local server-side call to the weather method, and
determines the new weather, which clients can then read, and update
their own weather status.
The weather is expressed, on the client side, as a picture.
My problem is this:
Currently, the picture on the client side that denotes the weather is
set by a client-side method, which retrieves the current weather value
from the server, something to the tune of UpdateWeather().(it needs to
be there on the client to correctly display and process some of the
other GUI data).
The weather timer on the server fires off action events; one of which
is update the weather (and therefore the client's GUI image) whenever
it goes off. But how do I implement this? I can't find a way for the
server to initiate a call to every client to tell it to run its own
WeatherUpdate method to display the correct weather. I have a socket
chat running, so it's easy enough to determine the clients connected,
but I am unsure as to how I have the server initiate a call to each
client to tell it to run its own client-side method and update its own
GUI. Any help is much appreciated!
I'm currently working on programming a game in Java for fun. This is a
multi-player game with the interface done primarily in AWT, and I have
decided to use RMI for functionality over the network, a virtual
experience sort of thing, that includes weather, and other real-time
phenomenon.
Well, the algorithm to determine the current weather is all done on
the Server, currently. However, I have the weather set on a Swing
timer on the server, so that randomly once every 2-10 hours while
running, it makes a local server-side call to the weather method, and
determines the new weather, which clients can then read, and update
their own weather status.
The weather is expressed, on the client side, as a picture.
My problem is this:
Currently, the picture on the client side that denotes the weather is
set by a client-side method, which retrieves the current weather value
from the server, something to the tune of UpdateWeather().(it needs to
be there on the client to correctly display and process some of the
other GUI data).
The weather timer on the server fires off action events; one of which
is update the weather (and therefore the client's GUI image) whenever
it goes off. But how do I implement this? I can't find a way for the
server to initiate a call to every client to tell it to run its own
WeatherUpdate method to display the correct weather. I have a socket
chat running, so it's easy enough to determine the clients connected,
but I am unsure as to how I have the server initiate a call to each
client to tell it to run its own client-side method and update its own
GUI. Any help is much appreciated!