R
Robin Johnson
Hi,
I've written an engine in Javascript for running text adventure games
on a web page:
http://www.robinjohnson.f9.co.uk/adventure/hamlet.html (That's the
only game I've written with it so far, and a version of the engine
that is slightly less sophisticated than my development copy, which
has cleaner code and a more authentic Infocom-style scrolling display,
but I digress.)
There is essentially only one function each for input (take_command())
and output (say()) so the user-interface code is nice and seperate
from the muscle.
I'd like to be able to produce a download-and-run version of the game
with, crucially, the ability to do some simple file I/O for saving
games (the web version does that with cookies, which work sometimes,
and tend to screw things up if they get too big.) So I know I'll have
to take it outside Javascript, but I'd like to carry on with the code
I've already written.
I did a bit of googling and found Rhino, so I'm guessing I can use
that, and write new user interface and file i/o methods in Java, to
work around the existing code. I'm not very familiar with Java but
maybe this is my chance to learn. (And hopefully there won't be much
complicated stuff to be done anyway; I only want a console-window
app.)
I wondered if anyone here has experience of doing something similar -
basically, of converting a web application to a standalone one - and
might care to shave some advice (or, on the offchance, existing
code...) before I reinvent the wheel.
Thanks
I've written an engine in Javascript for running text adventure games
on a web page:
http://www.robinjohnson.f9.co.uk/adventure/hamlet.html (That's the
only game I've written with it so far, and a version of the engine
that is slightly less sophisticated than my development copy, which
has cleaner code and a more authentic Infocom-style scrolling display,
but I digress.)
There is essentially only one function each for input (take_command())
and output (say()) so the user-interface code is nice and seperate
from the muscle.
I'd like to be able to produce a download-and-run version of the game
with, crucially, the ability to do some simple file I/O for saving
games (the web version does that with cookies, which work sometimes,
and tend to screw things up if they get too big.) So I know I'll have
to take it outside Javascript, but I'd like to carry on with the code
I've already written.
I did a bit of googling and found Rhino, so I'm guessing I can use
that, and write new user interface and file i/o methods in Java, to
work around the existing code. I'm not very familiar with Java but
maybe this is my chance to learn. (And hopefully there won't be much
complicated stuff to be done anyway; I only want a console-window
app.)
I wondered if anyone here has experience of doing something similar -
basically, of converting a web application to a standalone one - and
might care to shave some advice (or, on the offchance, existing
code...) before I reinvent the wheel.
Thanks