How to make your website multiplayer with DimensioneX
KB Article n. 019
This article explains how to enhance any web site with a multiplayer game powered by DimensioneX.
One of the most interesting fetures of DimensioneX version 5.3.6 and up is that it can run inside any webpage by using an IFRAME structure. Italy's leading game portal, www.gamesclan.it has incorporated into their home page the online RPG game Underworld so that it can be played within their site - while keeping all the site controls, banners and ads visible.
This is a unique opportunity for webmasters to attract traffic by offering free multiplayer games on their sites, instead of the well-known, single-player games developed as Java or Flash applets.
Step 1 - Get the URL of the game
Each game developed with DimensioneX has an url to be accessed, of the following structure:
So one good idea is to go to our online games page, start the game you wish to include in your site, and then find out the game's URL. The best method is probably to right-click on the browser's toolbar, activate the address bar and then copy the URL. Also clicking in a free space of the game page and choosing "Properties" from the pop-up menu can bring you the URL.
Note2: parameters specified on the url after the question mark are always optional - they can pre-define the user's screen size preferences. For the moment, cut off everything including the question mark and after.
By following the above instruction, you should have obtained that - for example - the URL for the game "The Beach" is the following:
Step 2 - Insert an IFRAME into your page
Next step is to design a webpage for your site (with your ordinary banners and menus) which includes, in some part, an IFRAME structure. For those who don't know, let's say IFRAME is a sort of browser window inside a browser window, if you get what I mean.
Here's the HTML tag you should insert in your web page:
Please replace the URL in the SRC tag above with the actual URL of your desired game.
Test the page, it should work, already.
Step 3 - Auto resizing the IFRAME
Insert these tags somewhere in your web page (the best place is within the HEAD section):
Note: The above functions WidthSize( ) and Resolution( ) will not be used in this tutorial
Now modify the IFRAME tag by inserting an onLoad parameter (code in bold below), so that the HeightSize function is called to determine IFRAME's perfect height.
Now try the page out.
It is possible that the height of the IFRAME is still not perfect. In that case, simply adjust the number in I wrote in bold (140) appearing in the HeightSize function code. Make that number equal to the size of the upper part of your own web page. Adjusting it by means of a brief trial-and-error process will give you the perfect result.
See our finished demo page here.
Please remind that incorporating a multiplayer game in your own web site is using a third-party resource for your own puroposes.
On the other hand, by doing this you will bring more traffic to the game itself so it will be a good trade for both.
In conclusion, you should always contact the owner of the game you are about to incorporate in your site and ask for permission. This way, you will also avoid the event that the game is moved or shut down without you being aware of it (in that case, typically, your site visitors will find out the game isn't working days before you do).
We hope this article was useful to you, webmasters out there.
If you need help in the porting process or have questions/doubts always feel free to post on the Developers' Pub forum.