This is an old revision of the document!
EasyRPG supports running games directly inside your web browser.
Web request are asynchronous. This means that all assets like pictures and music must be fetched asynchronously. When the Player wants to display a new graphic it will appear on the desktop versions (Windows, Linux, Android, …) immediately but on the web it will be invisible while the file is downloaded. Once the downloaded finishes it is replaced with the real image.
In contrast to images and music some files are important to continue execution. When a map file is pending the Player will halt until the file is downloaded. The first halt is while the Logo is displayed on startup, it downloads the database and the maptree here. Download of map files is blocking, too. But this is usually not noticeable because the download is executed while the fade out animation plays (it will stay black when the map downloading takes longer then this).
Hosting your own games is quite simple. Just follow these three steps.
Download this archive and extract it on your server.
Your server needs support for PHP (most servers support this).
You will get the following files:
Because of current player for the web is not supporting MP3 playback properly in browser yet (there are resampling and buffering issues in SDL_mixer) you should convert
MP3 audio files to Ogg Vorbis. Also, EasyRPG Player supports existing WAV files but Ogg Vorbis is a lot smaller and worth for the web. Do the same following process for both
Sound folders and remove unneeded MP3 and WAV files after the conversion.
lameand decode all MP3 to WAV:
for song in *.mp3; do lame --decode "$song"; done
vorbis-toolsand encode all WAV to Ogg Vorbis.
oggenc -q-1 *.wav
The following only apply when you use our
Your games are expected in subdirectories of the
games directory. The default game executed is the one in
games/default. You can create further games by just putting them in subdirectories of the
games directory. Because of security considerations (directory traversal) your directory name may not contain
games directory is not writable for PHP create a
cache folder in
games and give it write permissions. You can skip this step if
games is writable. You can revoke read permission on this folder for world/others.
games/?update once. You have to run this each time you change files of the game. For other games different than default, use
Now open the
index.html file and your default game should start. To play a different game pass
?game=folder_name to your index file.
index.php works as a file finder which allows case-insensitive lookup of files.
Depending on the requested
file it either returns
404 or a
Location-header to the file on the server.
This is required because Windows is case-insensitive (and original RPG2k was for Windows) and because the file extensions are not stored.
Charset/Hero1 could be
Hero1.png, hero1.bmp or
HeRo1.xyz, depending on which file exists.
System/System1 is requested. The server returns
Location: games/default/System/System1.png. The same result is expected for file
Our file finder is stored under
src/platform/easyrpg-filefinder.php. In case you want to replace the file finder you only have to fulfill a very simple API.
The directory struture of the
games folder is not part of the API contract. The player only expects that accessing
games/ invokes the file finder.
The only GET arguments that must be supported are
game is the name of the game that is executed.
file is the name of the file the game requests.
file is requested it must return a downloadable representation of the file. How doesn't matter, it can be an
octet-stream or a redirect via
Location-header. If the file is not found
404 must be returned.