Sunday, May 1, 2011

JavaScript Virtual Machine in GGS

In short: it works bitches!

Oh yeah, thanks to Mattias work this week we are able to use JavaScript as a programming language for our games now. There remains still a little bit of work but it does not hang when we try to get something into of from the database, check this out:

2> GameVm = ggs_gamevm:start_link("test_table").
<0.85.0>
2> ggs_gamevm:call_js(GameVm, "GGS.jeena.setItem('a','foo')").
undefined
3> ggs_gamevm:call_js(GameVm, "GGS.jeena.getItem('a')").     
"foo"

This is so awesome, I won't be able to sleep tonight :D I think I need beer or something :D

What needs to be done now is to adapt the code so the first client, who will act as kind of a host, is able to upload the server source code (JavaScript) at the beginning and then other clients shall be able to connect to this one table.

2 comments:

  1. Interesting,
    I am trying to use erlv8 myself for a game but found it horrible slow in many parts if I may ask how did you people worked around things like the single instance VM, or slow response when it comes to erl<>js borders?

    Regards,
    Heinz

    ReplyDelete
  2. We never did have problems with slow evaluation. We testet several thousend clients on the VM at the same time without problems. We added some data we measured into our report at http://jeena.net/t/GGS.pdf page 40pp.

    Node.js http://nodejs.org too uses V8 (without Erlang) and I've seen big online communities with thousends of concurrent users on one instance of the VM wit little or no problems.

    ReplyDelete