Hacker News new | past | comments | ask | show | jobs | submit login
Old school RPG style map in HTML5 canvas using websockets.
62 points by JimmyRuska on Oct 6, 2010 | hide | past | favorite | 42 comments
Works in firefox or chrome, chrome only for websockets. Flickers bad in firefox. http://rp.eliteskills.com/html5.php



Comment at top of code:

/* User beware. I don't know javascript. I read mozillas / / reintroduction to javascript, being somewhat familiar with / / actionscript 3, god knows how it ended up working. This code / / is run by tears, wishes and luck. */



Teleport:

javascript:void(you.y=1);

javascript:void(you.x=1);

(enter into browser addressbar)


Any serious (read: MMO) application of this would be continuously reporting position regardless, so it wouldn't that big of a step to validate them server-side and prevent such hijinks.


This is great. I would love to see a fully functioning old-school RPG created in HTML5 that I don't have to download/purchase CD, can just play in any browser, on my desktop/laptop/iPhone/iPad, with save games instantly available.

One day ..


Here's source http://github.com/jimmyrcom/websockets-RPG-map-thing

Gotta fix the flooding issues, there's still something that can make it crash too.


Yeah, that's me.

var a = 1; function d() { $('#say').val(a); say(); a++; } setInterval("d();", 100);

Not exactly hard.


It does have a flood filter, your thing just spams so it gets in the post every chance. I can only make the flood count longer. That's the problem with javascript, kinda hard to prevent people from screwing around and editing it in-place.


I'm not 100% sure how WebSockets work, but I assume it's going through your server and then sent to everyone else? Could you not do a rate limit of 5 per 30 seconds, or require at least one comment in between yours? Not sure what the best approach would be best.


> That's the problem with javascript, kinda hard to prevent people from screwing around and editing it in-place.

Not if you use a module pattern with private methods.

But the real problem you should be addressing, and one which applies to any internet app, is people directly sending data to the server. Whether it's initiated by JS or flash or anything is not relevant - sure it's sometimes easier to hack about with JS apps, but if you fix people being about to open telnet and spoof the raw data, then you fix all those holes at the server, and that leaves you free to entirely change the way your code works in the future, instead of having to re-code misguided security fixes.


Just kick of the flooders. Btw you could try node.js, then run the same game code on the server too, so there will be no cheating in the game when finished.


better:

javascript:var a=prompt('message to spam');setInterval(function(){$('#say').val(a); say();},100);


Should be fairly straightforward. Simply 'save' the last time this user has posted a message. Then the next time they attempt to post a message check if the alloted time has passed and process accordingly.

I see you are using dict, so just add a record with that info and you should be set.


I do do that. "LastMessage" var of the tuple in the dict. It's not enough if they make multiple windows all spamming in a loop. Some of the messages get through


Ah ok, perhaps if you add microsecond information?


Hey that's pretty cool, is the source open? I might have some time tonight, found an error. I can fix it and pop it on github?


Just view source, it's not obfuscated. If there's interest I can post the erlang code for the server on github.


Would love to see the source for this on the server side - really slick!


Please do.


It doesn't 'flicker' in firefox at all, it just shows a steady image with a message that I should use chrome.


Did you draw the sprites yourself? Or is there a open collection somewhere?


The main character sprite was ripped directly from Chrono Trigger[1], a SNES game. A lot of gamers I know consider it to be one of the best RPGs ever made.

The tiles are very familiar but I can't for the life of me remember which commercial game they are from. They're used a lot in indie games. A lot of sprites from the SNES era are. :)

[1] http://en.wikipedia.org/wiki/Chrono_Trigger


Tiles are from secret of mana 3 if I remember correctly. Chrono used just because of the sprite availability, it was one of my favorite games as a kid


I know that the main char is from CT, I was just wondering if someone had a free rendering of him, or it was simply a SNES rip.


Great work ! Do you plan to expand it to a full MMORPG ? There are some great opportunities in HTML5 browser-based games, considering the ease to port to mobile devices.


Here I was expecting some hexes and cryptic symbols...

Neat. Good job. :)


Pretty cool, reminds me of Landstalker (but not isometric) on Sega megadrive. But I could not go past the first screen ?


It's ChronoTrigger from SNES (and later PSONE).


Works fine in newest Minefield.


this is awesome! would love to see it on github :)

edit: oh and FYI works great in Safari too


Sorry for being slow, how is websockets being used here?


For the chat and transmitting player movements.


Ahh I wasn't seeing anything under Chrome 6 or nightly WebKit.


No XSS checking on say. Amazing though I love it.


Very cool, "Webmaster". Thanks.


Interesting options for this form of overhead graphics.

I was catching up on an old post and I came across your HN comment: "Choice isn't (necessarily) beauty. It's one more engineering tradeoff among others, with its own upsides and its own downsides. Giving up choice in favor of the benefits gained from doing so can be pragmatic, rational, and lead to more beautiful results.

I guess I'm just saying: don't fetishize choice. Assign it a value like the one parameter among hundreds which it actually is." from http://news.ycombinator.com/item?id=1108018

Your brief comment turned into a post for me months later."Choice is an Optional Feature" http://www.victusspiritus.com/2010/04/09/choice-is-an-option...

Just wanted to say thanks for your input.


Hey thanks, I appreciate it.


this looks really cool, history repeats itself in the future :)


Chrono <3


Great work!


Cool, and powered by Erlang too. Neat.

I've been working on my own MMORPG using Erlang (http://developingthedream.blogspot.com/) but I'm waiting for the dust to settle in the HTML5/Flash/Capuccino/etc field to choose the editor/game engine to use for the web frontend.

Bookmarked, keep up the good work.


You'll be waiting a pretty long time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: