interesting thin-client problem

Discussion in 'Java' started by steve, Dec 13, 2004.

  1. steve

    steve Guest

    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?
     
    steve, Dec 13, 2004
    #1
    1. Advertising

  2. steve

    dingo Guest

    You need a GIS solution
    www.geotools.org or geoserver

    "steve" <> wrote in message
    news:...
    > 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?
     
    dingo, Dec 13, 2004
    #2
    1. Advertising

  3. steve

    xterm Guest

    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.
     
    xterm, Dec 13, 2004
    #3
  4. 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.
     
    Michael Borgwardt, Dec 13, 2004
    #4
  5. steve

    xterm Guest

    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.
     
    xterm, Dec 13, 2004
    #5
  6. In article <>,
    "xterm" <> 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
     
    Scott Ellsworth, Dec 13, 2004
    #6
  7. steve

    stefoid Guest

    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?
     
    stefoid, Dec 13, 2004
    #7
  8. steve

    stefoid Guest

    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...
     
    stefoid, Dec 14, 2004
    #8
  9. steve

    Alex Kizub Guest

    > 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.
     
    Alex Kizub, Dec 14, 2004
    #9
  10. steve

    Mark Murphy Guest

    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
     
    Mark Murphy, Dec 14, 2004
    #10
  11. steve

    stefoid Guest

    An applet is certainly the easiest way to implement the map component
    from my point of view, however I wonder if an applet can be made to fit
    the JSF framework - like can an applet be wrapped up as a JSF
    component?

    Anyway, it seems I have a few options -

    a) a straight server-side image map
    b) a custom JSF component that does a bit of client-side processing
    with javascript

    c) an applet


    thanks all

    Mark Murphy wrote:
    > 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
     
    stefoid, Dec 14, 2004
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Russ
    Replies:
    1
    Views:
    569
    =?Utf-8?B?Q2hhcmxlcyBDaGVu?=
    Nov 29, 2004
  2. terry

    Thin client

    terry, Aug 2, 2003, in forum: Java
    Replies:
    5
    Views:
    489
    Chris Smith
    Aug 10, 2003
  3. John

    thin client requirement

    John, Sep 17, 2003, in forum: Java
    Replies:
    1
    Views:
    377
    Mark Voorberg
    Sep 18, 2003
  4. Adam Lipscombe
    Replies:
    5
    Views:
    733
    Richard Corfield
    Apr 24, 2004
  5. =?Utf-8?B?Sm9obiBBdXN0aW4=?=

    Problem with Focus method with iehp.exe on thin client

    =?Utf-8?B?Sm9obiBBdXN0aW4=?=, Apr 10, 2007, in forum: ASP .Net
    Replies:
    6
    Views:
    553
    Steven Cheng[MSFT]
    Apr 16, 2007
Loading...

Share This Page