Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > interesting thin-client problem

Reply
Thread Tools

interesting thin-client problem

 
 
steve
Guest
Posts: n/a
 
      12-13-2004
Hi, I'll pose my problem and the best solution I can think of.
Perhaps there is a better way?

Problem: I am developing a thin-client web application (strategy game)
that needs a map of a very large geographical area divided into
hexagons, called a 'hexmap'. The map typically will be larger than a
single screen, and will consist of hundreds or even thousands of
hexagons.

The user will be able to click on a particular hex to go to a screen
showing more detailed information about that region, and also use the
map to process unit commands (move a unit from this hex to that hex)

Solution: the best I can come up with is to make the map an image map
within a frame. I believe when a server-side image map is used, the
coordinates of the click will be sent as parameters to the server, so
I can programatically work out which hex was clicked, and act
appropriately.

For the game itself, I propose to use sun studio creator and java
server faces. I dont know much about html or jsp and I dont want to
know! Im not sure if JSF can help me with this problem or not...

Can anyone come up with a better solution?
 
Reply With Quote
 
 
 
 
dingo
Guest
Posts: n/a
 
      12-13-2004
You need a GIS solution
www.geotools.org or geoserver

"steve" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi, I'll pose my problem and the best solution I can think of.
> Perhaps there is a better way?
>
> Problem: I am developing a thin-client web application (strategy game)
> that needs a map of a very large geographical area divided into
> hexagons, called a 'hexmap'. The map typically will be larger than a
> single screen, and will consist of hundreds or even thousands of
> hexagons.
>
> The user will be able to click on a particular hex to go to a screen
> showing more detailed information about that region, and also use the
> map to process unit commands (move a unit from this hex to that hex)
>
> Solution: the best I can come up with is to make the map an image map
> within a frame. I believe when a server-side image map is used, the
> coordinates of the click will be sent as parameters to the server, so
> I can programatically work out which hex was clicked, and act
> appropriately.
>
> For the game itself, I propose to use sun studio creator and java
> server faces. I dont know much about html or jsp and I dont want to
> know! Im not sure if JSF can help me with this problem or not...
>
> Can anyone come up with a better solution?



 
Reply With Quote
 
 
 
 
xterm
Guest
Posts: n/a
 
      12-13-2004
Your server side implementation should consits of an abstract
implementation of Graphics2D objects which are each bound to a custom
created class let's call it Bar

so basically after you send the coordinates of the click, you will go
as follows:
getHexagon(int x,int y){
while(SomeCollection.nextBar())){
foo=SomeCollection.currentBar();
if(foo.getGraphics2DObject().contains(x,y)){
return foo;
}}
return null;
}

something like that...

Good luck.

 
Reply With Quote
 
Michael Borgwardt
Guest
Posts: n/a
 
      12-13-2004
steve wrote:
> Solution: the best I can come up with is to make the map an image map
> within a frame. I believe when a server-side image map is used, the
> coordinates of the click will be sent as parameters to the server, so
> I can programatically work out which hex was clicked, and act
> appropriately.


Yup.

> For the game itself, I propose to use sun studio creator and java
> server faces. I dont know much about html or jsp and I dont want to
> know! Im not sure if JSF can help me with this problem or not...


No, it can't. Without knowing HTML and JSP, you can forget about your
"thin client" idea. Using an IDE is just going to postpone that
relization and make you waste time meanwhile.

An applet would be a better solution if you want to do it all in Java.
 
Reply With Quote
 
xterm
Guest
Posts: n/a
 
      12-13-2004
a thin client doesn't have to be implemented using html. A thin client
refers to an application that does not perform heavy logic within
itself, the logic would be implemented in the server.

 
Reply With Quote
 
Scott Ellsworth
Guest
Posts: n/a
 
      12-13-2004
In article <(E-Mail Removed) .com>,
"xterm" <(E-Mail Removed)> wrote:

> a thin client doesn't have to be implemented using html. A thin client
> refers to an application that does not perform heavy logic within
> itself, the logic would be implemented in the server.


Dollars to donuts, though, when someone says they want a thin client,
and then says that they do not now much jsp/html, then they intend to
deploy to a web browser via html. Other options might include a flash
front end sending data to the backend over XML, or some kind of SVG
magic, but in the main, this question usually means they want html.

That said, I would punt, write a somewhat thicker client in Java that
draws hexes, and use Java Web Start to get the client to the user
machine. You can then keep all the serious processing on the server,
but let the client do hit testing, redraws, updates, and the like. It
is going to be a LOT faster than imagemaps, for a reasonably sized
hexfield.

Scott
 
Reply With Quote
 
stefoid
Guest
Posts: n/a
 
      12-13-2004
When I said thin-client, I meant browser-only web app - no client
download. The map is the only part of the game that is problematic for
a browser only front end.

Initially, I didnt want to deal with HTML and JSP at all, still dont, I
just want to concentrate on the game logic, but having a look at Sun
Creator Studio, it looks as though I can build a web page full of
simple widgets via the IDEs GUI, and bind these widgets to java classes
that hold their state and I just have to write event handlers when
button are pressed etc... that seems ideal to me.

But the map... usability would ne improved a lot by having some
functionality on the client. If it was implemented as an applet, or
maybe even a web page with javascript... I wonder if there is any way
to 'wrap' that up as a JSF component?

 
Reply With Quote
 
stefoid
Guest
Posts: n/a
 
      12-14-2004
hmm, I just realised that JSF components can be (usually are?) made
with JSP and javascript. so maybe I could create a 'hex map' JSF
component. Would kind of break my rule about @$@#$ around with JSP and
so on.

It would have to

1) generate a scrollable and zoomable hex map
2) display the players units/objects in the hexes they occupy
3) display some information about the hex and possible units on mouse
rollover
4) display detailed information when the hex is clicked on, possibly in
a popup window
5) allow a unit to be moved from its current hex to a destination hex


would all that be possible with javascript? Using this kind of client
side processing would mean the client would have to have a lot of data
about the map and its contents. Lets say the map was 100x100 hexes,
each with a name, a type, and optionally some containing a number of
units of possibly differing types. Even at only 50 bytes per hex,
thats half a meg of data. I cant see any way around the client having
to ask the server for specific information about each hex. hmmm...

 
Reply With Quote
 
Alex Kizub
Guest
Posts: n/a
 
      12-14-2004
> I cant see any way around the client having
> to ask the server for specific information about each hex.


Easy. For each request open another window which retrives data from url and
stores it in main window and dies.
JavaScript can do this.

Alex Kizub.


 
Reply With Quote
 
Mark Murphy
Guest
Posts: n/a
 
      12-14-2004
stefoid wrote:
> hmm, I just realised that JSF components can be (usually are?) made
> with JSP and javascript. so maybe I could create a 'hex map' JSF
> component. Would kind of break my rule about @$@#$ around with JSP and
> so on.
>
> It would have to
>
> 1) generate a scrollable and zoomable hex map
> 2) display the players units/objects in the hexes they occupy
> 3) display some information about the hex and possible units on mouse
> rollover
> 4) display detailed information when the hex is clicked on, possibly in
> a popup window
> 5) allow a unit to be moved from its current hex to a destination hex
>
>
> would all that be possible with javascript? Using this kind of client
> side processing would mean the client would have to have a lot of data
> about the map and its contents. Lets say the map was 100x100 hexes,
> each with a name, a type, and optionally some containing a number of
> units of possibly differing types. Even at only 50 bytes per hex,
> thats half a meg of data. I cant see any way around the client having
> to ask the server for specific information about each hex. hmmm...
>

I think you can do what you want with a Java applet.

I'm actually working on something similar to this designed more for a
D&D RPG type game. It's my first Java project. I always find working on
games make learning a new programming language more fun. Its fully a
Java application that I will convert to an applet when I'm done.

I started by developing my own animation panel for the map:
1)The map can scroll in either dimension just by moving close to the
edge of the screen.
2)The mouse location is continuously monitored, so hovering in one
location can trigger a popup image or text to be added in the frame.
3) A grid ( in my case rectangular) can be turned on or off at will.
4) Clicking in any location takes the Panel location -> map conversion
-> then the object in that location is notified it is clicked on. In my
case this notifies the Char that they are active and moves them to then
next location. In your case it sounds like you want to open a new image.

My server that I will post this on does not run Java servers, so I
handle all of the communication, move data, map updates with POSTs to
a PHP script that returns requested data.

I hope this gives you some ideas. Let me know if you want more details
of what I have going on.

Mark
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interesting nat problem G.G. Cisco 2 12-02-2005 09:22 PM
Interesting problem with NAT and VPN (not the usual question) Jim Westwood Cisco 6 10-15-2005 05:07 PM
Interesting ping problem Cpt_CAM Cisco 2 04-18-2005 08:51 AM
Interesting Ping Problem with Gigaman Circuits and Cisco 4006 Switches - Anyone? Cpt_Cam Cisco 7 10-05-2004 05:29 AM
BGP and NAT... interesting problem Gollum Cisco 3 12-17-2003 06:22 PM



Advertisments