Using GWT to go from Java to Java Script

I’ve recently been having a play with GWT. I’ve wanted to try it out for a while and Legends of Yore seems like a big enough project to really test it (if not for performance). So, after a short bit of hacking I’ve ported my engine on to the canvas/context stuff from GWT. Here’s what came out:

http://www.legendsofyore.com/js

I’m pretty impressed with both performance and ease of use from GWT. I’m not sure if I’ll go this way properly but it was certainly an interesting experiment. With all the hoo-hah about java in browsers at the moment it might give us another option.

Has anyone else tried this and got any results with more action based games - it looks to me like it’d be pretty possible.

Cheers,

Kev

Yes. Action games work now. The performance depends on people having a new browser though.

You would be surprised how many people have 2 year old browsers that are still very slow for games.

Oh wow! This runs beautifully on Chrome Dev!

It runs very well in Firefox, but the screen is a little small.

If you increase the canvas size using CSS, but keep the width/height attributes, then it is scaled dynamically by the browser. This would allow you to make it fullscreen, but you would have to do this dynamically, so that the size ratio of the canvas is correct (perhaps with black bars filling in any empty space). You will also have to account for the scaling when getting the mouse location.

worked great for me

So that’s what you were working on :wink: Loads fine on my iPhone 4 I didn’t play it any though. How long did it take you to get LoY from Java to GWT/JavaScript?

EDIT: Played around with it on my iPhone and the touch controls are a little wonky, but there’s an iOS app so I assume the web version isn’t targeted towards iOS.

Z :point:

Runs great on Chrome. I even zoomed in and played it fullscreen! Pixels the size of my thumb!
There does seem to be a “problem” with loot generation though… At level 7 I bought the treasure map from the farmer and found the treasure which contained 1000 gold and a level 73 Gold Ring. Uh… It has awesome stats, but I won’t be able to use it for days of playing. >_>

Yeah, it’s sometimes a bit random, but thats ok - you can sell the ring for lots of cash :slight_smile:

Kev

Hi

It works fine on Firefox 3.6.13.

let me get this straight, would u need the JRE in order to run the game then? cause if not then this would be rather convenient…

Nope, no JRE.

Kev

Hi,
It work fine in Google Chrome 14.0.835.187 m
How long take porting Legends Of Yore(Engine/Game)?

Very impressive Kev!!

I think we should stop crying about the java plug in and applet and work toward using GWT. Will probably check it myself in a near future.

@vyh The game was unchanged. The engine took two evenings to port to it’s current state.

Thanks for the feedback all :slight_smile:

Kev

There’s already a game framework that uses GWT for JS (among other target platforms), it’s the one used by Rovio to make Angry Birds for the Chrome store, and aparently is being used by Three Rings as well (samskivert is a commiter): PlayN

Yep, it used to be called forplay - couldn’t get it to work for legends tho.

Kev

:smiley: Very cute, Kev.

I did a project at work with GWT, CRUD app… I was surprised you can do animations and stuff with GWT. It’s pretty cool if you don’t mind getting your hands dirty and testing a bunch of features.

How much of this is running client-side and how much server-side? I guess you just load media assets from the server in the beginning and the game basically runs totally client-side?

Works fine in Chrome. Crashes in IE9 on startup:

[quote]SCRIPT5022: DOM Exception: INDEX_SIZE_ERR (1)
D82088EF1E55AEB3B6794A569DFCDE29.cache.html, line 1 character 1
[/quote]

It’s all client side, just resource pre-load at the start.

IE9 is a worry tho.

Kev

You could always use Chrome Frame if IE really doesn’t like it.