Starting the Engine

The development version of GameStudio's engine - acknex.dll - is located in the GameStudio folder. There's also a small starter program, acknex.exe, that activates the engine and passes the command line to it. It can be used to start the engine directly with a level, model, movie or script, by giving the following command:

c:\program files\gstudio7\acknex.exe filename [options]

Normally, the file name is the name of your game script (c or wdl). The engine will change the current directory to the folder where the script is located, compile it, and start the game. If no file name is given, the engine will change the current directory to its own folder. For quick starting without SED or WED, create a windows shortcut and assign that command line to it.

Alternatively, you can directly start up a resource file (wrs), a level (wmb), a model (mdl), a sprite or sky image (bmp, tga, pcx, dds), or a movie (avi, mpg, wmv). In this case the engine will act as a viewer for that file. When using the engine as model viewer, the model is now set to the player pointer. This way entity properties can be changed, and entity functions can be called after pressing Tab.

The engine can be started multiple times on the same PC in window mode. Different parameters can be passed to every engine instance by the -d command line option (see below). They can be used to open engine windows at different positions of the desktop. Each engine instance can communicate with each other over multiplayer commands. Thus, having several engine instances running on the same PC is very useful for testing a multiplayer configuration. Another possibility is using a multi monitor system for a flight or vehicle simulation with several monitors representing different views. Every view can be rendered by an engine instance that opens a borderless window at a desktop position that covers a single monitor. Because the engine makes no difference at all between several instances running on the same PC, or several instances running on several PCs on a network, the single PC can be replaced by a PC network with almost no changes of the script.

On startup, the engine scans for plugin DLLs in the PLUGINDIR folder. This can lead to a slow start when this folder contains lots of DLLs that are no engine plugins - for instance, when the engine is used as a screensaver and started from the Windows folder. If a DLL crashes on opening, the engine crashes also. Thus make sure that PLUGINDIR is set to a folder that only contains engine plugin DLLs.

Acknex.exe and acknex.dll are part of the development system and must not be given away or copied elsewhere. For distribution of a game, the WED and SED PUBLISH function will create a distribution version of the engine, named after the application.

Command line options

Various engine modes can be activated through command line options. User defined command line options can be evaluated by the engine through the command_str string. Options can be automatically set in the startup window  P . The following command line options are used by the engine:

-exe  LC 

Compiles an .exe file from the .c code ( not supported by the free version). Exe files don't need to be compiled and thus start faster than .c files. For running stand alone in Pure Mode, the exe file must be compiled by the Publish process in order to create an engine DLL. In Legacy mode the exe file does not require the engine DLL and is ready to run stand alone.

-black

 A6  Sets the startup window to a red text on black background. Otherwise it's a black text on white background. If an acknex.wdf file is found in the game folder, the window definition in this file overrides the option.

-nwnd  P 

Suppresses the startup window and the start delay. Useful if the engine is started by another program.

-nc  P 

Prevents the engine from checking itself for possible virus or hacker tampering at game start. This way, the EXE can be 'wrapped' into another program for using the registration or unlock feature of some distribution channels. 

-cc

Prevents the engine from executing the script. Only the syntax is checked and possible errors are indicated. Often used in combination with -exe for compiling an executable without executing it.

-d name[=value]

Under C-Script, defines the given name for further evaluation in the script through ifdef. This has the same effect as giving define name; or define name,value; within the script. Under lite-C, sets the variable name to 1 or to the given value (if any) at start of the script, ignoring the predefined value of the variable. This way, arbitrary game options, like starting screen resolution, difficulty grade etc., can be set via the command line. Note that there must be just a '=' and not any spaces between name and value in the command line.

-diag

Outputs diagnostic messages into a file in the current folder. In server mode (-sv ) the filename is acklog_sv.txt; in client mode (-cl ) the filename is acklog_cl.txt; otherwise it's acklog.txt. When starting in dedicated server mode (-sv), the -diag output is additionally printed into the server console window. This way it's possible to observe on the server which clients connect or leave, and what's happening in the game.

-dir name

Gives the folder defined for saving games and screenshots; will override any SAVEDIR name defined in the project file.

-emu

Enables vertex shader emulation on 3D cards without shader hardware, like GeForce1. Vertex shader emulation deactivates hardware vertex processing and thus can reduce the frame rate remarkably, even if no vertex shader is used. Some render or texture stage modes, like CameraSpaceReflectionVector, as well as pixel shaders are not available in vertex shader emulation mode and lead to an error message when used in effect scripts. Therefore vertex shader emulation is used mostly for testing purposes, and is normally not recommended for released games.

-nj

Disables joysticks and 3D navigation devices.

-nm

Disables the mouse.

-ns

Prevents playing sounds, and does not open the DirectSound device. No sound files will be loaded. Media files are still played.

-nv  C 

Prevents rendering and does not open the DirectX Graphics device.

-nx number

Size of the nexus in megabytes. The nexus is a memory area that the engine preallocates at startup for caching entity files and level textures and geometry. It speeds up level loading and prevents that the game suddenly aborts at runtime when memory is running too low. The nexus size depends on the size of the biggest level of the game. The bigger the nexus, the more complex scenes may be rendered - but the more virtual memory is used. If physical memory is not available, it's taken from the harddisk.

When you set the nexus in Map Properties, WED uses this command line option to transfer the nexus size to the engine. The default value for the nexus is 40 megabytes. The maximum value is limited by the Virtual Memory Setting in Windows/System, minus around 400 MB that should remain free for the operating system. The current nexus requirement is indicated in the statistics panel and can be read from the nexus variable. The recommended maximum nexus value for commercial games is 200. When setting higher values, you should be aware that several Windows subsystems - including DirectX - tend to crash without error message when the virtual memory is running low.

If the nexus size is exceeded, the  A7  engine will allocate additional memory from the PC's virtual memory pool. If the virtual memory is also used up, the application will issue an error message and terminate. The level_mark and level_free functions only work when the nexus is not exceeded. In engines older than A7, exceeding the nexus size will produce a "Nexus too small" error message. The engine must then be restarted with a nexus size higher than that you've used before (e.g. -nx 80 for 80 MB nexus size).

-ip name

The server name, the server's machine name, domain name or IP address when starting a client in multiplayer mode. Example:

acknex office.c -cl -ip 169.254.73.28

connects to the server with the given IP address on the network or internet. The given name or address is available during gameplay in the predefined server_name string. If this command line option is not given, the server will be searched on the local network.

-pl name

By this option an individual name can be given to each client in a multiplayer system (up to 16 characters). Otherwise the engine will generate a client name. During gameplay the name is available in the player_name string.

-port number

Through this command line option, a port address for TCP/IP client/server communication can be given. Valid ports are in the range 2300..2400. If no port is given, a default port address is assigned. A port address can only be given for the server - the client will connect to the right port automatically.

-sim  P 

Activates the NETWORKSIMULATOR_DP8SP_TCPIP service provider, and offers an interface to the DirectPlay simulator that comes with the DirectX9 SDK. DirectX 9 must be installed. Run the program 'DP8Simul.exe' before starting a multiplayer session. A panel will open for setting values for latency and packet loss. This allows to simulate bad online connections, like from a 56K modem, and test a multiplayer application under real internet conditions.
The simulator can also be used for testing clients and servers running on the same PC. Note that then the simulator generates bandwidth, latency and packet drop values that are much worse than the values indicated in the simulator panel, because every packet and every acknowledge message runs twice through the simulator. The real simulated latency is indicated in the first row of the Net column of the statistics panel.

-sn name

Through this command line option the session name can be given when starting a server or a client in multiplayer mode. The default session name is the name of the main script file without extension, e.g. "office" for starting the office.wdl. The given name or address is available during gameplay in the predefined session_name string.

-cl  C 

Joins to a multiplayer session in client mode. If no server or no session is found, the engine automatically starts in non-multiplayer mode.

-sv  C 

Starts a new multiplayer session in server mode. When used in combination with -cl, the server is a client at the same time. Stand alone server mode is only supported by the Professional Edition.

-w3d

Will enforce weak D3D mode without using the stencil buffer. This way old 3D cards without T&L or stencil support can be forced to run. The graphics quality is inferior in this mode.

-wnd

Will enforce window mode even if default fullscreen mode is defined. As long as you haven't redefined the on_enter function, you can always switch between window and fullscreen mode by [Alt-Enter].

► latest version online