Editing Zero-K:Developing
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 7: | Line 7: | ||
** Have responsibility for your changes/commit. Do not leave bugs that require other people to fix. | ** Have responsibility for your changes/commit. Do not leave bugs that require other people to fix. | ||
* "Readability & performance are equally important." | * "Readability & performance are equally important." | ||
− | ** Optimize code | + | ** Optimize code but not to the point of unreadability. [http://c2.com/cgi/wiki?RulesOfOptimization Remember the rules of optimization]: |
*** Don't. | *** Don't. | ||
*** Don't (yet). | *** Don't (yet). | ||
Line 28: | Line 28: | ||
** MapIconBuilder - unit map icon sources are here | ** MapIconBuilder - unit map icon sources are here | ||
* [https://github.com/ZeroK-RTS/Zero-K-Missions Zero-K-Missions] contains source files for official ZK missions | * [https://github.com/ZeroK-RTS/Zero-K-Missions Zero-K-Missions] contains source files for official ZK missions | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Getting sources == | == Getting sources == | ||
Line 55: | Line 36: | ||
* Log in to GitHub and [https://github.com/ZeroK-RTS Locate] the repository you want to edit. | * Log in to GitHub and [https://github.com/ZeroK-RTS Locate] the repository you want to edit. | ||
* Click the "Fork" button on the GitHub website to create your own copy on GitHub. | * Click the "Fork" button on the GitHub website to create your own copy on GitHub. | ||
− | [[File: | + | [[File:cloneZK.jpg]] |
− | * Locate your fork on GitHub and click " | + | * Locate your fork on GitHub and click "Clone or Download". |
* Copy the web URL to your clipboard. | * Copy the web URL to your clipboard. | ||
[[File:localCloneZK.jpg]] | [[File:localCloneZK.jpg]] | ||
Line 69: | Line 50: | ||
== Updating sources == | == Updating sources == | ||
− | Keep your sources up to date by periodically syncing your fork to the original repository (using 'compare', see: https://github.com/KirstieJane/STEMMRoleModels/wiki/Syncing-your-fork-to-the-original-repository-via-the-browser, then do "rebase and merge" instead of "merge") and doing TortoiseGit | + | Keep your sources up to date by periodically syncing your fork to the original repository (using 'compare', see: https://github.com/KirstieJane/STEMMRoleModels/wiki/Syncing-your-fork-to-the-original-repository-via-the-browser, then do "rebase and merge" instead of "merge") and doing TortoiseGit -> Pull on your repository folder to take the changes from GitHub to your local files. |
== Modifying the game == | == Modifying the game == | ||
:''For personal modding, see [[Mod Creation]]'' | :''For personal modding, see [[Mod Creation]]'' | ||
− | Follow the instructions in 'Getting sources' the download the Zero-K game sources. Feel free to inspect and edit the game files. Most developers using Windows edit lua files with [//notepad-plus-plus.org/download/ Notepad++]. | + | Follow the instructions in 'Getting sources' the download the Zero-K game sources. Feel free to inspect and edit the game files. Most developers using Windows edit lua files with [https://notepad-plus-plus.org/download/v7.6.6.html Notepad++]. |
To test your changes: | To test your changes: | ||
− | + | * Create an empty file named 'devmode.txt' in the same directory as Zero-K.exe. | |
− | * Create an empty | ||
* Launch Zero-K.exe. | * Launch Zero-K.exe. | ||
[[File:enableDevMode.jpg]] | [[File:enableDevMode.jpg]] | ||
− | * Select 'Zero-K Dev' in Settings | + | * Select 'Zero-K Dev' in Settings -> Developer -> Singleplayer (you may need to scroll down). |
[[File:startTest.jpg]] | [[File:startTest.jpg]] | ||
− | * From the main menu select Singleplayer | + | * From the main menu select Singleplayer -> Skirmish -> Advanced -> Start to launch a test game. Note that the game type should be automatically set to 'Zero-K $VERSION'. |
* In the game, press F8 to open debug console. It'll display errors and output to the log. | * In the game, press F8 to open debug console. It'll display errors and output to the log. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Modifying the lobby menu == | == Modifying the lobby menu == | ||
Line 110: | Line 83: | ||
* Right click on 'zk.sdd' and select 'Git Commit'. | * Right click on 'zk.sdd' and select 'Git Commit'. | ||
* Write a description of the changes and click 'Commit'. | * Write a description of the changes and click 'Commit'. | ||
− | * Right click on 'zk.sdd' and select TortiseGit | + | * Right click on 'zk.sdd' and select TortiseGit -> Push. |
* Enter your GitHub login and password when prompted. The changes should now appear on your fork in GitHub. | * Enter your GitHub login and password when prompted. The changes should now appear on your fork in GitHub. | ||
* Navigate to https://github.com/ZeroK-RTS/Zero-K/pulls and click "New Pull Request". | * Navigate to https://github.com/ZeroK-RTS/Zero-K/pulls and click "New Pull Request". | ||
Line 118: | Line 91: | ||
This creates a proposal to apply your changes to the main game. Be sure to check up on it and respond to comments. | This creates a proposal to apply your changes to the main game. Be sure to check up on it and respond to comments. | ||
− | A more advanced method involves creating branches locally with TortiseGit | + | A more advanced method involves creating branches locally with TortiseGit -> Create Branch and committing blocks of related changes to a single branch. You are then able to make pull requests from branches. This allows branches to be smaller and more focused, which is desirable when merging. |
Make sure to keep your repository up to date to make merges less difficult. | Make sure to keep your repository up to date to make merges less difficult. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
== Zero-K.exe launch flags == | == Zero-K.exe launch flags == | ||
Line 133: | Line 101: | ||
== Modifying infrastructure/tools == | == Modifying infrastructure/tools == | ||
* Install [https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx Visual Studio Community edition] | * Install [https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx Visual Studio Community edition] | ||
− | * Install | + | * Install [http://www.microsoft.com/en-us/server-cloud/products/sql-server-editions/sql-server-express.aspx SQL Server express] |
− | |||
* Clone to desktop [https://github.com/ZeroK-RTS/Zero-K-Infrastructure Zero-K infrastructure] | * Clone to desktop [https://github.com/ZeroK-RTS/Zero-K-Infrastructure Zero-K infrastructure] | ||
* Test by opening Zero-K.sln in Visual Studio | * Test by opening Zero-K.sln in Visual Studio | ||
− | |||
=== Initializing Website Database === | === Initializing Website Database === | ||
− | You may need to setup the database connection for the website. In order to do that: Open Visual Studio, open the Server Explorer panel (under the View menu), right click Data Connections | + | You may need to setup the database connection for the website. In order to do that: Open Visual Studio, open the Server Explorer panel (under the View menu), right click Data Connections -> Add Connection -> Sql Server. Enter <code>(localdb)\mssqllocaldb</code> in the Server Name field, after which zero-k_local will appear in the dropdown list of databases. |
(If zero-k_local does not appear, type it in the text box and press OK; Visual Studio will ask whether you would like to create the database. This may require you to have administrator rights on the computer.) | (If zero-k_local does not appear, type it in the text box and press OK; Visual Studio will ask whether you would like to create the database. This may require you to have administrator rights on the computer.) | ||
Line 148: | Line 114: | ||
=== Debugging infrastructure === | === Debugging infrastructure === | ||
* To run a project right click it, choose "set as startup project" and hit F5 to run using debugger. | * 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. [http://i.imgur.com/2mgizUJ.png Setup] |
* To run asp.net: | * To run asp.net: | ||
− | ** It's required that you install MS SQL | + | ** It's required that you install MS SQL Express on your local PC. |
− | *** You can get | + | *** You can get SQL Server 2017 (for Windows 8 and later) [https://www.microsoft.com/en-us/sql-server/sql-server-editions-express here] or SQL Server 2014 (for Windows 7) [https://www.microsoft.com/en-ie/download/details.aspx?id=42299 here]. For SQL Server 2014, 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. | |
− | ** Right click asp.net | + | ** 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 <code>ModeType.Local</code> in <code>GlobalConst.cs</code> (currently line 46) to say something like:<br/><code>Data Source=<hostname (usually your computer name)>\SQLEXPRESS</code> |
− | ** 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 <code>ModeType.Local</code> in <code>GlobalConst.cs</code> (currently line 46) to say something like:<br/><code>Data Source=<hostname (usually your computer name)>\ | ||
** To make things run smoothly the following changes might also be a good idea: In <code>Shared/PlasmaShared/GlobalConst.cs</code> (currently line 137) replace the DefaultEngineOverride with whatever engine version is current. Comment out lines 190 and 238-298 of <code>Zero-K.info/AppCode/PlasmaServer.cs</code> unless somebody can supply instructions on how to make the torrent errors go away. | ** To make things run smoothly the following changes might also be a good idea: In <code>Shared/PlasmaShared/GlobalConst.cs</code> (currently line 137) replace the DefaultEngineOverride with whatever engine version is current. Comment out lines 190 and 238-298 of <code>Zero-K.info/AppCode/PlasmaServer.cs</code> unless somebody can supply instructions on how to make the torrent errors go away. | ||
− | |||
− | TODO: add download links for sample database tables here. Users and clans are probably easier to make yourself for most purposes. For now, if you need this ask | + | TODO: add download links for sample database tables here. Users and clans are probably easier to make yourself for most purposes. For now, if you need this ask somebody in Coredev (other than GoogleFrog and maybe Sprung?). Aquanim has sample tables for maps and Planetwars structures, if that is all that you need. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Modifying The Database Structure === | === Modifying The Database Structure === | ||
− | * Modify the appropriate files in ./ZkData/Ef/... | + | * Modify the appropriate files in ./ZkData/Ef/... |
− | * | + | * Open Tools > NuGet Package Manager > Package Manager Console |
* At the top of the window which appears, there is a "Default project" dropdown box. Set this to ZkData. | * At the top of the window which appears, there is a "Default project" dropdown box. Set this to ZkData. | ||
* Type the command <code>Add-Migration [description-of-change-here]</code> into the package manager console. This should create some migration files with your description and a timestamp in the name in the Migrations folder of ZkData. | * Type the command <code>Add-Migration [description-of-change-here]</code> into the package manager console. This should create some migration files with your description and a timestamp in the name in the Migrations folder of ZkData. | ||
− | |||
* Type the command <code>Update-Database</code> into the package manager console. This should update the database structure. | * Type the command <code>Update-Database</code> into the package manager console. This should update the database structure. | ||
− | |||
== Artwork == | == Artwork == | ||
See [http://zero-k.info/Wiki/Development_Artwork Development Artwork] (outdated) | See [http://zero-k.info/Wiki/Development_Artwork Development Artwork] (outdated) | ||
− | |||
− | |||
== Missions == | == Missions == | ||
Line 203: | Line 157: | ||
See [[Editing Help]] | 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 | + | 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. |
== itch.io builds == | == itch.io builds == | ||
Line 221: | Line 174: | ||
== Engine == | == Engine == | ||
See [https://springrts.com/wiki/Development:Getting_Started Spring Engine Development] | See [https://springrts.com/wiki/Development:Getting_Started Spring Engine Development] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Development]] | [[Category:Development]] |