Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

interesting thin-client problem
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?

Report this thread to moderator Post Follow-up to this message
Old Post
steve
12-13-04 01:57 PM


Re: interesting thin-client problem
You need a GIS solution
www.geotools.org or geoserver

"steve" <spambucket666au@yahoo.com.au> wrote in message
news:433ffd38.0412122209.2713528a@posting.google.com...
> 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?



Report this thread to moderator Post Follow-up to this message
Old Post
dingo
12-13-04 01:57 PM


Re: interesting thin-client problem
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.


Report this thread to moderator Post Follow-up to this message
Old Post
xterm
12-13-04 01:57 PM


Re: interesting thin-client problem
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.

Report this thread to moderator Post Follow-up to this message
Old Post
Michael Borgwardt
12-13-04 01:57 PM


Re: interesting thin-client problem
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.


Report this thread to moderator Post Follow-up to this message
Old Post
xterm
12-14-04 01:59 AM


Re: interesting thin-client problem
In article <1102970371.209213.294370@z14g2000cwz.googlegroups.com>,
"xterm" <xterm@thisiscyberia.com> 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

Report this thread to moderator Post Follow-up to this message
Old Post
Scott Ellsworth
12-14-04 01:59 AM


Re: interesting thin-client problem
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?


Report this thread to moderator Post Follow-up to this message
Old Post
stefoid
12-14-04 01:59 AM


Re: interesting thin-client problem
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...


Report this thread to moderator Post Follow-up to this message
Old Post
stefoid
12-14-04 08:57 AM


Re: interesting thin-client problem
>  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.



Report this thread to moderator Post Follow-up to this message
Old Post
Alex Kizub
12-14-04 08:57 AM


Re: interesting thin-client problem
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

Report this thread to moderator Post Follow-up to this message
Old Post
Mark Murphy
12-14-04 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

Java Programmer archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:26 AM.

 

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.