1.4 Developing a game

1.4.1      Recommended development environment

For developing a game, you need to set up a development environment composed of the following:

  • DimensioneX game engine working on your PC.
  • A good text editor, Textpad 4 (http://www.textpad.com is recommended)

1.4.2      Developing in local language (non-english)

DimensioneX is designed to support ALL languages and all charsets.

In the DimensioneX kit you will find already messages (XXXX_msgs.properties) files for several languages. These can be used with no effort from your part.

 

If your local language is not supported, then you just need to make a copy of the english messages, translate them, and configure the game engine to use your modified file. Please read this tutorial to have full details on how to do this:

http://www.dimensionex.net/en/docs/art012.htm

Be sure to read section 1.3.4 – Local Language files at page 24 first.

 

The most important thing when you develop a game using non-english characters is that DimensioneX expects, by default, to load text files encoded with the UTF-8 encoding (although ANSI ASCII is supported – read on).

 

Please note that most text editors will use the ANSI ASCII encoding by default. So:

 

  • Either you use a text editor capable of saving files in the UTF-8 format. Remember to choose UTF-8 when saving your game source files (DXW,DXL,TXT) the first time.
  • Or you use the standard ANSI ASCII text format (most text editors in Europe and S. will be using it by default) but you need to specify ENCODING ANSI in your WORLD definition.

 

If you don’t take care of this, non-english characters will not be displayed correctly.

 

European languages can be rendered both with ANSI and UTF-8. More complex charsets such as Chinese, Japanese, Russian, Arabian, etc. must be rendered by using UTF-8.

1.4.3      About game images and sounds

When collecting or preparing images for your game, you should make efforts to reduce image size and save bandwidth, while preserving the necessary image quality for your game to look good.

 

Tip: Modem users can get annoyed while waiting big images to load, so it is always a good idea to test play your game while using a standard dial-up modem. This way you can identify images which need to be reduced in size.

 

The following table, however, summarizes the current size recommendations for several file types.

 

Image type Typical size in pixels (WxH) File type/
Extension
Typical size in Kbytes
Scenes 400×300 JPG 10K to 20K
Icons 32×32 GIF (transp.) 1K
Item image 100×100 GIF (transp.) 5K to 10K
Character image 65×100 GIF (transp., animated) 5K to 15K
Icons to be used also as item images 48×48 GIF (transp.) 5K
Sound effects WAV 5K-10K
Background music MID up to 70K

 

Tip: For images, you will greatly benefit from using an image manipulation software to properly compress the images to the desired size. Paint Shop Pro for example (download a free trial version from: http://www.jasc.com ), has got some nice Export features (GIF optimizer, JPG optimizer, PNG optimizer) with which you can vary compression parameters and see the resulting file size, while assessing image quality:

jpeg optimizer

 

Tip: Sounds effects can be found on http://www.findsounds.com and you can easily adapt them for your game by reducing their size with the Windows Sound Recorder, which gives you the possibility to change the sample’s format. The smaller the quality, the smaller the file. Just click on the “Change…” button in the Save As dialog:

 

sound format

 

1.4.4      Developing multi-area games

Once your newly-created game becomes stable and begins to grow, you are tempted to make it bigger and bigger to attract new visitors.

The following rules will enable you to combine areas into a complex, composite game:

 

– Each area of your composite game is implemented as a DimensioneX WORLD. WORLD and area are treated as synonyms here.

– Each WORLD of the your composite game will belong to a same CLUSTER (see CLUSTER parameter in the WORLD definition, section 2.2). The big, composite game is a CLUSTER.

– Each WORLD of the same CLUSTER should share the same code for managing common objects. It is a good idea to use shareed code libraries that you Include (see the Include directive in section 3.4) in all areas of the same cluster.

– During the game, objects can be moved from an area to another of the same cluster by properly using the MoveOutside instruction. Please see section 3.12.14 – MoveOutside what, areaid for details.

– During normal game server operation, it is webmaster’s responsability to ensure that all areas of the same cluster are loaded in memory. In future versions this will be ensured by the system automatically.

– Saved game profiles are stored in a common file, shared by all worlds belonging to the same cluster. The player may login back in whatever area within the cluster: he will be automatically brought to the area in which he/she saved the game.

 

1.4.5      The Administrator’s page

Most of the game developer’s tasks can be carried out via the Administrator’s page. This page is called by explicitly requesting the “admin” view to the DimensioneX game engine on the URL, like this:

 

http://your-game-url-here&view=admin

 

Example, for game in slot 1:

 

http://localhost:8080/dimx/servlet/multiplayer?game=1&view=admin

 

The Administration page will pop up:

admin-panel

 

Note: When calling the Administration page, if you omit the game=# specification the Admin page will refer to the game you have accessed most lately.

1.4.5.1     Functionalities

  • Engine version, World name and version, Availability of DB connection, number of players connected. Displayed for your reference.
  • Restart Select this one to re-loads settings and world file. All game situation is lost.
  • Snapshot Select this one to get a snapshot of the game at the moment. Useful to inspect the current world, see where objects are, status of internal variables, etc.
  • Optimizer stats Provides info about how your script code is actually performing. Number of calls, consumed CPU time, percentage, runtime errors. The highest names in the list might need optimisation.
  • Show log Prints the contents of the current world’s log. Even thoug you have set logging to ‘none’ it may contain useful about occurred errors (if any).
  • Clear log Select this one to clear current world log.
  • Enter Script. Type some Function/Sub/EVENT in the text area below, and use this command to add this code to the running game. If the Funcion Id matches an existing one, this one will be overwritten.
  • Execute command. Type a valid command in the text area, and use this function to make the game engine to execute it. For example, to broadcast a message to all the players in the game:

Speak SYS,$WORLD,”NOTICE TO PLAYERS: The game will be restarted in 5 minutes”

  • Password Type here your admin password (this one should have been set in the worldnav#.properties file)
  • Back to game Reverts back to normal game view.
  • Maintenance Leads to the maintenance panel, which allows you to perform other admin tasks.
  • DimensioneX web site, FAQ, Documentation, Forum Quick links to programming aids.

 

1.4.5.2     Optimizer statistics

Provides info about how your script code is actually performing.

The page will look like this:

optimizer

 

Here is the meaning of the provided information:

 

  • Engine version, World name and version. Displayed for your reference.
  • Event/Function/Sub Your scripts, sorted from the most time-consuming to the less time-consuming. The software displays the file name where the script has been read, and the line number at which the script begins. The name of the function/Sub/Event is not displayed, to see it, open the specified file at the specified line.
  • CPU time Consumed time, in milliseconds (1000 milliseconds = 1 second).
  • CPU percent Percentage of the total execution time. This is another way to express the CPU time information, referred to the total consumed time (displayed at the bottom).
  • Calls Number of times that the Sub/Function has been called.
  • column. Average running time per each call, in milliseconds.
  • Total consumption: Consumed time, total
  • Total calls: Total number of calls
  • Runtime errors: Number of runtime errors occurred since the start. All these errors have been logged on the debug#.log file.

 

If you look for good performance, since the list is sorted by relevance, items on top are the best candidate for inspection and optimisation.

Consider that inner calls to other subroutines do sum up in the caller routine consumed time. Take this into account and don’t be surprised if the most time-consuming sub is one that just calls other scripts.

 

1.4.6      The Maintenance page

 

The maintenance page is called from the Administrator’s page and from here you can perform other tasks at server level. You might need to know one or more admin passwords to perform the desired operations.

The page looks like this:

 

maintenance page

 

1.4.6.1     Functionalities

 

  • Game server instance drop-down list. Decides on which world the chosen command will act on.
  • Admin password field: Type here the administrator’s password for the chosen command to work on the selected world/game. The password must be the one of the selected slot, OR the server’s admin password.
  • Set up this game command: Select this one and write a value in the text field to set up a game in the chosen slot. A correct value can either be a file name (if the DXW resides on the server’s system folder) or a complete URL (if the DXW file resides elsewhere, such as an external web site)
  • Select game profiles command: Selects and possibly erases saved games profiles from the game’s database. This command only acts on the filesystem-based database (.SAV file). Just select the command and complete the remaining part of the line (all/date before…/version less than…), the command has a further confirmation screen.
  • Check DB Connection / Initialize. Displays currently configured database driver and connection string being used. Connects to the DB, prints the status. If the database has not been initialized, it creates the necessary tables for their future use.
  • Game profiles – store SAV file into DB. Copies all contents of the .SAV file into the mySQL database (valid connection needed)
  • Game profiles – export DB à SAV file. Does the converse, that is, copies all contents of the mySQL database of game profiles (valid connection needed) into the text-based SAV file on the local filesystem.

 

No password is needed for the following functions:

  • Go to game’s Admin console Brings you back to the Admin command for the selected game.
  • Go to game Brings you back to the selected game.
2.0 DXW Reference - WORLD structure and attributes
1.3 DimensioneX Configuration

Leave a Reply

Your email address will not be published. Required fields are marked *