Which Frontend Technology for an Online Game of Risk? SVG Maps?

M

Mariano Kamp

Hi,

I am currently *thinking* about implementing a Risk, the boardgame,
clone. It should work in a browser and I wonder what would be the best
approach to implement the frontend?

I guess I could go for image maps, which would work in many browsers,
but then the game would lack interactivity.

A Java Applet would be another alternative, but Java is not ubiquitous
and more importantly it cannot talk to the embedding webpage. At least
afaik?

I am thinking along the lines of XHTML/Javascript and SVG. I might be
wrong, but after playing with this combination for a short time it seems
to me, that SVG is scriptable and it plays well with the embedding page.
Of course SVG is even less wide spread then Java, but one can always
hope for the future.
I would start with the Firefox 1.5 implementation and probably use the
Adobe SVG Viewer as an alternative.

On a related note. How would you start to build/gather the SVG maps? I
had a look at the ones returned by google, but the maps were usually
hugh (talking multiple megabytes here -
http://upload.wikimedia.org/wikipedia/commons/4/4d/BlankMap-World.svg)
and also lack containers that a) identify which country they describe
inside the complete SVG and b) don't seem to be scriptable. I can't put
onmouseover etc. on a path, can I?

Any comments would be highly appreciated.

Cheers,
Mariano
 
R

Richard Lyman

Look into the Flex 2 sdk. It's free, and with Apollo scheduled for
release next year, your browser game could move to a desktop app.
While Adobe hasn't released the v.9 Flash player for linux yet it's
trivial to get Firefox running under Wine with the v9 plugin.

As for a map to use in Flex, I haven't tried it, but you could look at:

http://backspace.com/mapapp/

Since you mentioned Javascript:

http://backspace.com/mapapp/javascript.html
 
G

grrr

Hi,

I am currently *thinking* about implementing a Risk, the boardgame,
clone. It should work in a browser and I wonder what would be the best
approach to implement the frontend?

SVG is a very good choice with Ruby, since Ruby has a very nice SVG class
implementation http://raa.ruby-lang.org/project/ruby-svg - Thank you Yuya!

Let me know how it goes, I'm practicing my ruby-generated SVG moves.

SVG can be animated much like flash, too...

Grrr
 
M

Mariano Kamp

Well, yes, I forgot to state another constraint ... I don't know flash
and emotionally ;-) I don't want to go there ... ;-)

I am still wondering how to kickstart the maps. I haven't found any
simple svg maps to reuse and am not sure how to draw some myself.

How does one start out to draw a map? By transforming geographical
data? Which data? Or by putting a real map below a canvas in a drawing
program?

Regarding ruby-svg... Did you use it? My japanese is not that good ;-(
It was created/last updated in 2002/2003? Do you know if it is still
maintained?

I was more thinking along the lines of using an ordinary xml builder.
I am not so sure what a library could add on top of that?

Mariano
 
R

Richard Conroy

A colleague pointed me to a real nice open-source vector graphics
package: InkScape.

I am still wondering how to kickstart the maps. I haven't found any
simple svg maps to reuse and am not sure how to draw some myself.

How does one start out to draw a map? By transforming geographical
data? Which data? Or by putting a real map below a canvas in a drawing
program?

In InkScape I believe there is a feature where you can import a standard
graphic and *vector-ize* it, which would solve your map-drawing problem.
 
P

Phrogz

Mariano said:
I am still wondering how to kickstart the maps. I haven't found any
simple svg maps to reuse and am not sure how to draw some myself.

If you have Adobe Illustrator and can find free maps in any vector
format (eps, ai, pdf, etc.) you can open them in Illustrator and save
them as SVG files.

I was more thinking along the lines of using an ordinary xml builder.
I am not so sure what a library could add on top of that?

Having used the ruby svg library only a little bit, a while ago, my
impression is that it adds convenient classes for common shapes and svg
entities. For example, the <circle .../> element legally has cx, cy,
and r properties in SVG; the SVG library provides convenient accessor
methods for those properties, implicitly preventing you from adding
attributes that are not included in the schema. Using REXML directly
would give you no such nice framework.

It's not a terribly robust SVG library, IMO. For example, it makes no
attempt to provide convenient interface for describing a complex path,
instead providing only raw access to the 'd' attribute. Still, it's a
little better than nothing. (Personally, I wish its classes inherited
from REXML element, providing all the rich flexibility of REXML for
managing the document as may be needed.
 
D

David Vallner

Mariano said:
Well, yes, I forgot to state another constraint ... I don't know flash
and emotionally ;-) I don't want to go there ... ;-)

If you look past the bad rap and the reputedly Notte Very Neat API,
Flash is still, by far, the most reliable way to get a contained
rich-client -ish application to run in a webbrowser. Especially if it
involves any form of multimedia. I'd go there if you don't absolutely
need to talk to the surrounding webpage. (iSketch is one of the most
addictive in-webbrowser games I ever played for example, and I honestly
have no idea just how you could do that using only AJAX without severe lag.)

Animated SVG to me seems to have pretty much the same potential to
create obnoxious ads as Flash does, comparatively little actual
functionality you could use, except it's probably larger to download and
more CPU intensive to process (being XML-based and all). Except it's W3C
approved, therefore Good and Holy, and more likely to have various
fanboys ranting for than against it.

Bottom line: use what will work. A *lot* of people have Flash installed.
Probably more so than have a SVG-enabled web browser - cf. the still
majority of IE6 users. And as was already mentioned, the lagging Linux
support can be worked around, and that's something anyone that wants to
play any games on Linuxen has to be used to by now anyway.

David Vallner
 
R

Richard Lyman

Just to clarify - don't use Flash - use Flex. Yes, they both produce
SWFs, yes they are both 'controlled' by Adobe - but if you haven't
looked into it you should. Flex is nothing like Flash. ActionScript 3
is nothing like ActionScript 2.

Well.. you know what I mean by 'nothing like'... ;-)

-Rich
 
M

Mariano Kamp

Well, actually the huge svg maps I was looking at seem to have been
generated/converted by inkscape. The problem is that they don't
contain any semantics. Every path and line looks the same, whereby I
was looking for a single polyline, that describes Germany ;-) So that
I can manipulate the appearance of Germany in the context of the game.

So yes, I could display a map with SVG generated by inkscape, but it
wouldn't help me more than the original bitmap.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top