Difference between revisions of "Developing"

From Zero-K
Jump to navigation Jump to search
(→‎Missions: Disambiguate campaign and ZKME missions)
(Wiki section; edit TOC ordering)
Line 1: Line 1:
= Before modifying source: =  
+
== Before modifying source==  
== ZK's Devving Philosophy (social rules) ==
+
'''ZK's Devving Philosophy (social rules)'''
 
* "War is anticommunication!"  
 
* "War is anticommunication!"  
 
** Communicate with other devs about your changes/fixes, let them understand the issue. Do not make 'random' changes.
 
** Communicate with other devs about your changes/fixes, let them understand the issue. Do not make 'random' changes.
Line 77: Line 77:
 
== Missions ==
 
== Missions ==
 
=== Campaign ===
 
=== Campaign ===
Campaign planets/missions are defined in [https://github.com/ZeroK-RTS/Chobby/tree/master/campaign/sample Chobby/campaign/sample]
+
Campaign planets/missions are defined in [//github.com/ZeroK-RTS/Chobby/tree/master/campaign/sample Chobby/campaign/sample]
  
 
=== Standalone missions ===
 
=== Standalone missions ===
 
See [[Mission Editor|Mission Editor start page]]
 
See [[Mission Editor|Mission Editor start page]]
  
= Using Zero-K to edit/create your own game =
+
== Wiki ==
 +
See [[Editing Help]]
 +
 
 +
=== Unit pages ===
 +
Part of each unit page is autogenerated by the [//github.com/ZeroK-RTS/SpringRTS-Tools/tree/master/unitguide Unit Guide tool], and uploaded by the [//github.com/ZeroK-RTS/Zero-K-Infrastructure/blob/master/Fixer/WikiPortingMW.cs Wiki bot].
 +
 
 +
Run <code>export_unit_templates.sh</code> to generate wiki templates for each unit (see <code>export_unit_templates.lua</code> for some configuration options), then have the bot read the generated text files and edit the unit pages accordingly (requires Visual Studio setup as detailed above). The text output can also be used to manually edit pages.
 +
 
 +
Unit buildicons and radar icons should be uploaded by FTP to manual.zero-k.info (<code>zero-k.info/zkmanual/www/unitpics</code> and <code>/icons</code> respectively). Contact Licho or Histidine for login details.
 +
 
 +
== Using Zero-K to edit/create your own game ==
  
 
This is a guide to create a running [https://springrts.com/wiki/SpringTutorialGame Spring Tutorial Game] development directory but can be used for any game.
 
This is a guide to create a running [https://springrts.com/wiki/SpringTutorialGame Spring Tutorial Game] development directory but can be used for any game.

Revision as of 04:09, 15 January 2018

Before modifying source

ZK's Devving Philosophy (social rules)

  • "War is anticommunication!"
    • Communicate with other devs about your changes/fixes, let them understand the issue. Do not make 'random' changes.
  • "Do not create work for other people."
    • Have responsibility for your changes/commit. Do not leave bugs that require other people to fix.
  • "Readability & performance are equally important."
  • "If it ain't broke, don't fix it."
    • Don't code fixes that nobody wants to problems that don't exist.

What is in source codes

  • Zero-K contains the game proper
    • units folder contains unit definition files
  • Zero-K-Infrastructure
    • Zero-K.info: Website sources
    • ZkLobbyServer: Lobby server (for MP)
    • ZkData: Website/server database structure
  • Chobby contains the lobby client
  • Zero-K-Artwork contains sources for 2D art, 3D art and sounds
  • SpringRTS-tools contains various dev tools
    • Upspring - required to edit the .3do and .s3o model files used in the game
    • MapIconBuilder - unit map icon sources are here
  • Zero-K-Missions contains source files for official ZK missions

Getting sources

  • Get a GitHub account and download GitHub Desktop
  • Locate the repository you want to edit and click the "Fork" button on the GitHub website to create your own copy on GitHub
  • Locate your fork and click the "Clone or download -> Open in Desktop" button on the GitHub website to create a local repository on your computer
  • Before you start modifying sources:
    • Use GitHub Desktop to create a new branch in your repository for the specific changes you want to make; create the new branch from the master branch in the original ZeroK-RTS repository
  • After you finish modifying sources:
    • Use GitHub Desktop to commit your changes to your local repository
    • Use GitHub Desktop to publish or sync your commits to your repository on GitHub
    • Submit your changes for review: Use GitHub Desktop or the GitHub website to create a Pull Request from your new branch in your fork (the "head fork") into the master branch in the original ZeroK-RTS repository (the "base fork")

Modifying the game

  • Fork the Zero-K game repository
  • Locate the folder where you installed the game.
    • This can be found through Help -> Report A Bug -> Local Data
    • Example: C:\Users\<username>\Documents\My Games\Zero-K
    • This folder will have subfolders such as games, engine, and maps
  • Clone your repository into the games subfolder. GitHub Desktop will create a new subfolder under games.
    • Example: C:\Users\<username>\Documents\My Games\Zero-K\games\Zero-K
  • Rename the folder that GitHub Desktop created to zk.sdd
    • Example: C:\Users\<username>\Documents\My Games\Zero-K\games\zk.sdd
    • This folder will have subfolders such as LuaUI, units, and the .git folder.
    • The zk.sdd folder contains the game source files you will modify.
  • To test your modifications:
    • Add the file devmode.txt to your install directory.
    • Launch the game lobby (Zero-K.exe, chobby.exe for older installs)
    • Go to Settings -> Developer and set Singleplayer to "Zero-K Dev". Scrolling may be required to find the setting.
    • Start a new game: Singleplayer -> Skirmish
    • The newly-started skirmish will use your modified source code

Modifying infrastructure/tools

Debugging infrastructure

  • To run a project right click it, choose "set as startup project" and hit F5 to run using debugger.
  • You can enable multiple startup projects to test entire infrastructure locally (game servers, lobby etc). Enable asp.net, springie and ZeroKLobby projects to test it all together. Setup
  • To run asp.net:
    • It's required that you install MS SQL Express on your local PC. Get one from here. The file you will need is called SQLEXPR_x64_ENU or SQLEXPR_x86_ENU. Make sure you install version that matches your version of Windows (i.e. x86 vs x64). During the installation leave all the parameters default except that I changed server name to SQLEXPRESS in one of the first steps of wizard.
    • Right click asp.net -> properties -> web -> check "Specific Page" and leave it blank. Otherwise you get errors when trying to host locally.
    • Make sure SQL Server is running (check the Sql Server Configuration Manager in the Start Menu). If you can't connect, edit the data source for ModeType.Local in GlobalConst.cs to say something like:
      Data Source=<hostname (usually your computer name)>\SQLEXPRESS

Artwork

See Development Artwork (outdated)

Missions

Campaign

Campaign planets/missions are defined in Chobby/campaign/sample

Standalone missions

See Mission Editor start page

Wiki

See Editing Help

Unit pages

Part of each unit page is autogenerated by the Unit Guide tool, and uploaded by the Wiki bot.

Run export_unit_templates.sh to generate wiki templates for each unit (see export_unit_templates.lua for some configuration options), then have the bot read the generated text files and edit the unit pages accordingly (requires Visual Studio setup as detailed above). The text output can also be used to manually edit pages.

Unit buildicons and radar icons should be uploaded by FTP to manual.zero-k.info (zero-k.info/zkmanual/www/unitpics and /icons respectively). Contact Licho or Histidine for login details.

Using Zero-K to edit/create your own game

This is a guide to create a running Spring Tutorial Game development directory but can be used for any game.

  • Locate the folder where you installed the game.
    • This can be found through Help -> Report A Bug -> Local Data
    • Example: C:\Users\<username>\Documents\My Games\Zero-K
    • This folder will have subfolders such as games, engine, and maps
  • Create the folder 'tutorialGame.sdd' in Zero-K\games.
  • Click "Clone or Download" on the Spring Tutorial Game github page and download a zip.
  • Unzip the zip in Zero-K\games\tutorialGame.sdd
    • Unzip such that you have the file path Zero-K\games\tutorialGame.sdd\modinfo.lua.
    • Zero-K\games\tutorialGame.sdd should contain the subfolders Units, Weapons, LuaUI etc..
  • Add the file devmode.txt to your install directory.
  • Launch the game lobby (Zero-K.exe, chobby.exe for older installs)
  • Go to Settings -> Developer and set Singleplayer to "Generic". Scrolling may be required to find the setting.
    • The top left heading should say "chobby" and the background should be black with a kitten.
  • Start a new game: Singleplayer -> Skirmish
  • A game selection menu will appear. Select 'Spring Tutorial Game 0.1'.
  • Add a 'NullAI 0.1' to Team 2 with the 'Add AI' button.
  • Click Start.