|Version 20 (modified by ImG, 2 years ago) (diff)|
Table of Contents
- Starting the Game
- Playing a Match
- NB! Below is not yet (2nd October 2010) updated for the latest …
- Developer Features
This tutorial will introduce you to 0 A.D. in its current state, including how to play the game, how to use the tools, and how to use various cool developer features. It is written for both programmers and artists.
This is written for the Windows version of the game. On Linux and OS X, everything should work basically the same with a few tweaks (e.g. the executables don't end with .exe).
Starting the Game
So, you've gotten the game by downloading a release version or checking out the game from SVN. The next step is to try it out :D. If using a pre-compiled release version you should have a shortcut in your start menu (or Linux equivalent), just click it and the game will start. If you've compiled it yourself after checking out the game from SVN or using the source files in the latest release you'll have to start the game manually. To do this, go to the folder binaries\system in the folder where you checked out the game, and double-click pyrogenesis.exe. The game will take several minutes to start up the first few times, because it is building compressed data files so it can start faster in the future. Eventually, the startup time will go down to ~5 seconds. If you're having trouble with for example sound you can double-click 'Quickstart.bat' in the 'binaries\system folder which will start the game without some things enabled, like sound for example. If you're on another operating system, or prefer to do things another way - like adding a shortcut to the binary from the Desktop - the same can be achieved by using the argument -quickstart when you run the game. (If you have commit access another command line switch that can be good to know is -publicFilesOnly which will make it possible to test how things work using only the public files, which is everything except some of the Art which is kept internal until later, an example would be to test if a public map contains files in the internal mod) For other command line options see the Readme.txt file in binaries\system.
This is also a good place to mention how to quit the game. You can exit 0 A.D. at any time by pressing Esc, pressing it once will bring up a confirmation box and when you've clicked ok on that you're taken to the main screen, press Esc again and 0 A.D. is shut down completely after you click ok on that confirmation. You can also quit using the GUI buttons, when playing a game press the Menu button followed by the Quit button. From the main button you can press the Quit GUI button as well as using the Alt+F4 keys on your keyboard, you'll get a confirmation box when using the GUI button, but not when using the Alt+F4 keyboard shortcut.
To switch between Windowed and Fullscreen mode press Alt+Enter. Various graphic settings are in the file binaries\data\config\default.cfg. To change a setting, create a new file, on Windows, create: %appdata%/0ad/config/local.cfg, on Linux/OS X, create: ~/.config/0ad/config/local.cfg. Open both these files in Notepad, and copy any lines you want to change from default.cfg into the new local.cfg. Here are the main ones you might be interested in changing:
- Render path: If you have any problems with graphics due to an older graphics card, add the line renderpath=fixed to make sure 0 A.D. uses no shaders. If this fixes the problems, please report it as a bug to us.
- Fancy water: Again, if you have an older graphics card, or just don't want all the fancy effects, you can disable pixel-shaded water by adding fancywater=false. Note that it's also possible to toggle fancy water while the game is running however, if you only want to check how things look temporarily or just want to use it occasionally. You do that by clicking on Menu, then Settings, and there check/uncheck the Enable Water Reflections checkbox.
Playing a Match
You now have the choice of either playing single-player or multi-player, at the moment the AI isn't implemented, so unless you just want to test something out it's recommended that you play against a human player. To do so click on Multiplayer in the game menu and choose either Join Game (if someone else is already hosting) or Host Game (if you are going to host the game).
Hosting a game
In the first screen you can choose a player name and a name for your server (unless you really want to change them just accept the defaults). Then click Continue. For other players to be able to connect to your game you need to tell them your IP number, if you don't know how to find out what your IP is you can go tohttp://whatismyip.org/ (currently seems to be offline, you can use http://www.whatismyip.com/ instead)and just copy the number there. In the next dialog choose what map you want to play on by clicking on it's name in the list, and select which slot you want each player to be in (currently you have to know which player is which civilization and where on the map each player starts). You can chat with other players who have connected to your game, as well as see who's connected. When you've chosen which map to play etc click the Start game! button and the map loads.
Joining a game
You may enter a name you want to be displayed to other players here, as well as the IP from the host (see above), then click Continue. You can see a list of available maps etc, but it's only the host who can change what map you will play on. You can however chat and there suggest a map if you have a favorite. When the host clicks the Start game! button the game will start.
You start a singleplayer sandbox game by choosing Single Player in the main menu, in the next dialog choose which map you want to play on as well as which position you want to start in (Player 1 to Player 8). Then click Start game! The rest is the same for both Singleplayer and Multiplayer games (apart from the fact that the enemy won't do anything in a singleplayer game, not yet, when the AI is implemented the enemy will attack you though. And individual units will attack you already, so if there are enemies on the map, don't be surprised if you may lose a few units).
Moving the Camera
The camera controls in 0 A.D. are similar to other RTS games. Here is an overview of what you can do:
- Scrolling: Move the mouse to a side of the screen, use the W, A, S, D keys or use the arrow keys.
- Rotating: Use Ctrl + left and right arrow keys, use the scroll wheel on your mouse together with the Shift key, use the Q or E keys or use Ctrl + A and D keys.
- Pitching: Use Ctrl + up and down arrow keys.
- Zooming: Use the mouse wheel or the "+" and "-" keys.
- Reset camera view: Press the H key (resets both rotation and zoom).
- Other controls: Drag the middle mouse button to scroll the view.
There is also a minimap in the lower left of the screen. You can click on it to immediately change view to any place in the world.
Try moving around the map a little bit and then returning to your original view.
Click one of your soldiers to select him. Right-click on the ground to task him. You can also select multiple units by dragging a box with the left mouse button.
NB! Below is not yet (2nd October 2010) updated for the latest version, so the information may be inaccurate!
Try this now with your cavalry swordsman (Hippikon). Explore West to find water, or East to find cliffs and forests.
Note that each unit has a green bar above it. This shows its health. Part of it becomes red when the unit is damaged. Health can slowly regenerate when the unit is not in combat.
You can also make your units run by double-rightclicking instead of rightclicking. This depletes the unit's "stamina", represented by the blue bar above its head. Stamina slowly regenerates when the unit is idle. For military units, the first attack after running at an enemy is considered a charge attack and does more damage.
There are four types of resources in 0 A.D: Food, wood, metal and stone. Your current amount of each resource is listed at the top of the screen. In addition, there is a fifth "resource": housing space. This is provided by civic buildings such as houses and Civil Centres. The last counter at the top of the screen shows your current population over your current housing capacity. Note that some units, such as cavalry, take two population slots.
Unlike most real-time strategy games, 0 A.D. follows the concept of citizen soldiers, meaning that your military units double as economic units. Therefore, your infantry are your main workers. Cavalry can also perform some tasks, such as hunting. You also have one unit that is only economic: the Female Citizen. She can gather food and wood at decent rates, but another advantage is that she has an aura (represented by a circle) around her that causes male citizens within it to work faster. This aura does not stack if you put multiple females together.
To task a unit to gather, click him and rightclick a resource object, such as a tree, stone mine, metal mine or berry bush. You should have all of these within range of you Civil Centre.
Finally, you can only gather resources if they are in range of a dropsite building. This includes a Civil Centre or a Mill. In a real game, you will want to find a spot with several types of resources beside it and build a Mill there as you expand your civilization. The current GUI does not tell you about this fact - you just won't be able to click resources if there is no dropsite beside them.
Note also that units will automatically go to nearby resource objects of the same type when they finish chopping down a tree, etc.
Your infantry and female citizens can build new buildings. To do this, select a unit, and hover the mouse over the leftmost tab above the unit portrait at the left of the screen. This will open up a tab of available buildings. You can leftclick on one to select it, and leftclick somewhere on the map to place the new building. To cancel the building placement cursor, rightclick. Note, however, that the GUI currently won't give you an error message you when a building cannot be built due to insufficient resources (except in the Console - see below). In that case, the mouse pointer simply won't switch to the new building, so you won't be able to place it. If you want to try building something now, try either a House or a Mill. You can also gather more wood and stone to make other buildings.
Structures can only built within your Territories. More on this below. If you try building one outside, it will not be possible to place it.
One special type of structure is a Civil Centre. Civil Centres are used for claiming Territories, and they must be placed on the Settlement object in the centre of each Territory. More on this later.
Note that multiple units can help build a building, which makes it happen faster. Simply task more of them to the unbuilt foundation by rightclicking it.
Also, if you place multiple buildings, units that are finished building one of them will automatically look for work nearby and help build the others. Furthermore, if you build a Mill, the units who built it will automatically begin gathering resources nearby.
Units can also repair damaged buildings. This is done by rightclicking as well.
Some of your buildings can train new units. For example, click your Civil Centre, and hover the mouse over the leftmost tab above the building's portrait, with a helmet on it. This will open up a list of things you can train. Click one to begin producing it. It will finish in several seconds and appear beside the Civil Center. You may also click multiple units or click the same unit multiple times to queue them. Note that if you don't have enough resources or population space for the unit, the GUI won't tell you (it will just ignore your command), but you can see a message about this in the console.
The other structures that can train units are the Barracks and Fortress. The Dock will also eventually train ships.
Some buildings also have a second tab with a wheel on it, that lets them research technologies. Like with units, hover over the tab and then click a button to start researching the technology. Technologies go into the same queue as unit production and will finish in a few seconds.
Technologies are set up in a pair-based hierarchy. For example, when you are given the option of techs 1A and 1B and you choose 1A to research, 1B is no longer available. Some of the techs that are higher up on the tech ladder will require that tech 1A is done, while others will require tech 1B. This adds a level of strategy and 'randomness' to picking your techs, as availability of higher level techs will depend on your choices earlier in the game. Tech pairs are also phase specific - when your civilization's settlement is in the village phase you will have different techs available to you then when you are at the town or city phase. And lastly, most tech pairs are self-balancing. If a tech is self-balancing it will not only have it's own effect but will incorporate it's pair tech in a negative way. E.g., tech 2A raises mêlée unit hitpoints and 2B lowers mêlée unit food creation cost. When you research tech 2A, it will raise your hitpoints but also raise your mêlée food creation cost.
(Todo: Write about an example technology here.)
The key to expanding your civilization in 0 A.D. is conquering territories. Each map is divided into a number of territories (usually 3x the number of players). Each territory is centered around an object called a Settlement, which looks like a little well with a fence around it. It is shaped like a polygon around this Settlement (it contains all the points that are nearer to this Settlement than to any other). These polygons are showed on both the minimap and the game world. On the minimap, the lines are gray and the territory is shaded depending on its owner. In the game world, each territory boundary is drawn as two lines, each of which is coloured based on who owns that territory.
Players claim a territory by building a Civil Centre on this Settlement. If another player's Civil Centre is there, you can of course destroy it to place your own ;). Note that when someone's Civil Centre dies, that territory still remains there until a new Civil Centre is built.
Owning a territory gives you several benefits:
- You can only build structures within your own territories.
- Consequently, you can only gather resources near your own territories, since you need a dropsite.
- Eventually, there will be a limit on the number of buildings of some types in each Territory.
- There will also be a limit on total houses you can build, so the extra population space from additional Civil Centres will be necessary if you want to field a large army.
On latium_generated, you can find a Settlement by walking directly South from your Civil Centre. Make sure you bring an infantry unit there to actually be able to build on it (cavalry can't build).
Finally, the reason for all this buildup: To slay some enemies :D! Combat in 0 A.D. works similarly to other real-time strategy games. You make your soldiers attack by rightclicking on a target. If you want to try this out on latium_generated, walk either North or East until you find an enemy town. Feel free to pillage at will :).
There are a few special combat system features that should be noted:
Running and Charging
As described earlier, double-rightclick to make a unit run, which makes them move faster but requires stamina.
A melee unit that attacks off a run (when you double-rightclick an enemy) will begin with a Charge attack, which generally does 2x damage.
In addition, some cavalry units can trample enemies while running. The area in which the trample damage happens is shown in red around the cavalry unit. Simply run the cavalry around to trample enemies, or double-rightclick an enemy to charge and trample. (When the cavalry stops running in order to attack, the trample effect will continue for about 5 seconds, so this can be more efficient than just running around.)
Archers and javelinists in 0 A.D. have a minimum range. They will automatically back up out of this range when they are trying to attack something too close to them.
Projectiles in 0 A.D. do area damage and hurt friendly units as well.
Each unit can be in one of four stances that controls its AI. These can be set from the Stance List tab, which normally has three daggers drawn on it. They include:
- Aggress: The default. Causes the unit to automatically attack and pursue any enemies it sees.
- Defend: The unit will attack and pursue enemies, but it will not pursue them beyond its line-of-sight away from the position where it was stationed.
- Stand: The unit will stand at its position but still attack units that come in range (if it is a ranged unit).
- Hold: The unit will stand still and hold all fire (unless manually told to attack).
There is also an Avoid stance that is not currently implemented.
Units regenerate health slowly when they have not been in combat for a certain amount of time. They also regenerates stamina when idle.
Damage in 0 A.D. comes in three types: hack, pierce and crush. Units have different armour for each type. In addition, unit attacks may be of multiple types simultaneously (e.g. a Hoplite does both pierce and hack damage). Therefore, you may see some units do different amounts of damage to different enemies.
Certain enemy objects can be captured. The main one is Female Citizens - if they are outside the range of their own soldiers but inside the range of your soldiers for a sufficiently long time, they will change ownership to you. Later, damaged buildings are planned to be capturable as well. One final capturable object is herd animals such as sheep, which are a movable food source.
As soldiers in 0 A.D. gain experience by killing enemies, they advance in rank. All units begin at Basic rank, and they can upgrade to Advanced and then Elite. Higher ranks give a unit more attack, armour and health, but reduce its economic effectiveness.
Other Game Features
Pausing the Game
You can pause the game by pressing the Pause key on your keyboard (at the top right). Unpause it using the same key. The game will also be paused if you switch to another window.
Quitting a Match
You can quit a match and return to the main menu at any time by pressing Alt-X (For fast quiting), or pressing ESCAPE key. This will ask you for confirmation, if you click yes you will return to the main menu.
To open or close the console, press F9 or ~ (the tilde key at the top left of the keyboard).
The console also has history functionality. You can press the up and down arrow keys to navigate through the past hundred lines you have typed. You can also begin typing a command, and press the up arrow key after a few characters to navigate through commands that started with the same thing. For example, typing :se and pressing <up> will give you the last command you typed that started with se.
The rest of this section will show you specific commands you can give with the console that should be useful for any kind of testing. It is targeted at both programmers and artists. The last section, Further Reference, lists more resources for programmers.
You can place objects through the startPlacing command if you know their template name (the name of their XML file in binaries/data/mods/public/entities/. For example, the following places a Hoplite:
Note that when you place buildings (such as "hele_house"), only the foundation will be placed.
To kill the currently selected unit, use:
You can also press the SUPR or DEL key to kill a selected unit.
You can modify a variety of traits on the selected units. For example, to give the currently selected unit 100 melee damage, use:
:selection.actions.attack.melee.damage = 100
You can also modify entity templates for each player, which affects all units of the given type owned by that player. For example, to give 100 attack to all Hoplites owned by player 1, use
:getEntityTemplate("hele_infantry_spearman_b", 1).actions.attack.melee.damage = 100
Giving Yourself Resources
You can access your own resource values through players.resources. For example, to add 1000 food to your stockpile, use:
:players.resources.food += 1000
The other resources are called wood, metal, stone and housing.
Setting Graphics Options
Various graphics options can be enabled or disabled through the renderer object. For example:
:renderer.fancyWater = true
Using the Console from your code
You can print anything to the console by using the console.write() method. This can be useful for debuging your scripts. If you are printing an entire object and not a variable be sure that the object can be printed and contains the toString() method.
Some useful global objects and functions include: * selection: An array containing the currently selected objects. * players: An array containing the players. * renderer: The renderer object. * getGuiGlobal(): The GUI globals object (which contains a bunch of GUI-related functions). * getEntityTemplate(unitName, playerNum): Get the entity template for a given unit, which instances of each type of unit inherit from. (Affects properties of all units at once.)
0 A.D. includes a built-in low-overhead profiler which can help you figure out bottlenecks. You can access it by pressing F11. The first view shows render stats. If you press F11 again, you will be taken to a second view, which shows time per frame (in milliseconds) and breaks it down into different areas. Each area has a number in front of it (1, 2, 3, etc) that you can press to go deeper into it to explore how its time is divided up. You can also press 0 to go up one level in this "tree" of time usage. Finally, press F11 a third time to close the profiler overlay.
For information on how to use the profiler in your own code, take a look at Profile.h. It's pretty straight-forward (mostly involves calling macros to start/stop a new subsection of the tree).
(Todo. Please see debug.h for now. The main thing to watch out for is that you must use debug_printf, not printf or cout, to print output so that it can be seen in the Visual C++ output window.)
Atlas - The Map Editor
Run Atlas using the file binaries/system/Atlas.bat, or on non-Windows platforms use ./pyrogenesis_dbg -editor in binaries/system/.
See the Atlas User's Guide for more info on how to use Atlas.
Run the Actor Viewer through binaries/system/ActorViewer.bat.
Run the Actor Editor through binaries/system/ActorEditor.exe.