Source Code

From BotF2-Wiki
Revision as of 04:08, 14 February 2016 by KennethOfBorg (Talk | contribs)

Jump to: navigation, search

Source Code

http://guganeshan.com/blog/setting-up-git-and-tortoisegit-with-bitbucket-step-by-step.html

official

  • last source code https://bitbucket.org/mstrobel/supremacy/overview (it's in C#, also named CSharp. #Visual Studio is used for coding.)
    • Mike's Post: build in VS2010 with .NET 4.0. You may need the C# Async CTP. http://bote2.square7.ch/forum/viewtopic.php?p=70790#p70790
    • http://bote2.square7.ch/forum/viewtopic.php?p=70781#p70781
      • Supremacy.Game.GameEngine is where you'll find most of the game logic. That's where most of the turn processing happens.
      • The SupremacyCore project is where you'll find the foundation of the game.
      • SupremacyService is just the game server (all the important bits it interacts with are in SupremacyCore).
      • SupremacyClientComponents is UI infrastructure.
      • SupremacyUI and SupremacyWPF are older UI infrastructure stuff, much of which has been phased out and replaced by newer and better stuff in SupremacyClientComponents. The most interesting stuff in SupremacyUI is GalaxyGridPanel, which draws the galactic map. It also has the spinning planet views.
      • Supremacy.Xna is where the XNA/3D stuff is located--it's not used heavily yet, but it has some effects for the invasion screen, a newer star renderer, a 3D spinning ship renderer, etc.
      • Supremacy.Scripting is an expression language parser/compiler.
      • SupremacyClient is the main graphical client and has most of the game screen implementations.

ClientContext vs AppContext

taken from https://bitbucket.org/kflanagan/supremacydev/commits/0d562ce676425cd5da19cfdbcf1b6c18c7d0d135

  • IClientContext is used by SupremacyCore to interface clients participating on a game, both local and over network. The IClientContext further includes an interface to IGameContext which gives access to the game data itself inside the SupremacyClient app
  • However there should be an option to also include local properties not known to the Core, which is why this is done alternatively another context would have to be introduced for local data, but then still all the client code would have to be updated to make use of it

Bitbucket

Changes

see here or https://bitbucket.org/mstrobel/supremacy/commits/branch/default

2016

XAML

  • January 2016 [Planned]: Hope to get Major Race specific UI build through use of generic XAML files.

Looking at SystemScreen.xaml, Global.xaml and ClientModules.cs in Themes/SupremacyClient See also generic.xaml in SupremacyClientComponents/Themes/InfoCard Theme.xaml Default.xaml Icons.xaml ClientApp.xaml.cs SystemScreen.xaml


1/17/16: Found that Mikes code in ClientApp.xaml.cs will already select for Major race. Need new folders for each major race in SupremacyClient/themes/(major race), edit paths to Resources in the .xaml files found in each races set of .xaml files. File names in SupremacyClient/themes/(major race) are not unique but content in Resources is. Now you can edit files in Resources for unique UI.

2/13/16:

<Polygon

   Points="300,200 400,125 400,275 300,200"
   Stroke="Purple"
   StrokeThickness="2">
   <Polygon.Fill>
      <SolidColorBrush Color="Blue" Opacity="0.4"/>
   </Polygon.Fill>

</Polygon>

Makes a left pointing triangle, purple outline and blue body

2015

  • Animation.cs (animation of opening screen): This is where we can set the number of images, frames, and the rate they play at, currently all images in 30 seconds. We may want that to run faster. The images you will make for the ship de-cloaking will be located in Resources / Images / Animation.
  • \supremacyclient\ClientModule.cs:
    • Found a place to add the right mouse click instructions for the Panel Access Menu. A thing called the statusWindow held the text "loading" while you wait for a game to load. Added the information there for new players
  • FMOD is partly replace by AudioEngine.cs and others - just find it out

2014

some code

for Theme and UI see >> Theme

miscellaneous

  • Mainline\SupremacyClient\GameContextMenu.cs
  • \Mainline\SupremacyUI\SystemProductionPanel.cs
  • \Mainline\SupremacyCore\Orbitals\FleetOrders.cs -> all items inside a sector
  • Mainline\SupremacyClient\GameContextMenu.cs (Access Popup Menu - or use F1 to F5)
  • \Mainline\SupremacyClientComponents\Controls\InfoCard\InfoCard.cs (-> Tooltips ??)
    • \Mainline\SupremacyClient\themes\Federation\InfoCard.xaml -> <Setter Property="Width" Value="500" /> (BEFORE: 250)


  • \Mainline\SupremacyClient\Views\ColonyScreen\ColonyPlanetaryBuildQueueView.xaml - Colonies Screen Content
  • \Mainline\SupremacyCore\Universe\Colony.cs
  • \Mainline\SupremacyClient\Views\ColonyScreen\ColonyStructureListView.xaml
    • Size of this area: 720 x 240


  • \Mainline\SupremacyClient\Views\GalaxyScreen\TaskForceListView.xaml

Ships

  • \Fleets.cs
  • \FleetOrder.cs (without a "s" - beware of it)
  • \FleetOrders.cs
  • \mainline\supremacyclientcomponents\views\galaxyscreen\galaxyscreenpresenter.cs TaskForcesList


Building Ships

  • Cancelling -> Breakpoint at Line 185 at OnShipyardBuildProjectsChanged() \Mainline\SupremacyClientComponents\Views\ColonyScreen\ColonyScreenPresentationModel.cs

Sounds

  • \Mainline\SupremacyClient\AudioEngine.cs (for Music), for Sounds >> SoundPlayerAction is used (search for \Resources\UI\Federation\SoundsButtonClick.wav)
  • and in \Mainline\SupremacyClientComponents\Views\SystemAssaultScreen\SystemAssaultScreenViewModel.cs -> Uri is used (e.g. CombatLaser.wav)


Galaxy Generator

  • \Mainline\SupremacyCore\Universe\GalaxyGenerator.cs


Values

  • CivID: 0 = Federation...

older list

where Folder File Function Date Description Custom1 Custom2


S-Core Game GameContext.cs

initialising game

S-Core Game GameEngine.cs DoProduction(GameContext game)

Raw Materials, Deuterium, Dilithium is collected cross over all colonies and used by all colonies

S-Core Game GameEngine.cs DoShipProduction(GameContext game)
S-Core Combat InvasionArena.cs

SystemAssault

S-Core Orbital Shipyard.cs GetBuildOutput(int slot) 2014-01-15

just selects output (active?) and bonus (BonusType.PercentShipBuilding), since 2014-01-15 also case PopulationRatio or IndustryRatio

S-Core Universe Colony.cs GetProductionOutput(ProductionCategory category)

see last line, too !

  • Food: minimum 10
  • Research:
                       float moraleMod = _morale.CurrentValue / (0.5f * MoraleHelper.MaxValue);
                       baseOutput = (int)(moraleMod * baseOutput);
  • Industry: minimum 10 !
                       float moraleMod = _morale.CurrentValue / (0.5f * MoraleHelper.MaxValue);
                       baseOutput = (int)(moraleMod * baseOutput);
  • last line: return ((int)(baseOutput + (baseOutput * modifier.Efficiency)) + modifier.Bonus);
S-Core Universe Colony.cs planet.HasFoodBonus (OutputModifier)
                       if (planet.HasFoodBonus)
                       modifier.Efficiency += 0.15f;
S-Core Universe Colony.cs planet.HasEnergyBonus (OutputModifier)
                   if (planet.HasEnergyBonus)
                       modifier.Efficiency += 0.15f;
S-ClientComp Views\GalaxyScreen GalaxyScreenView.cs GalaxyScreenView() GalaxyView Hotkeys Definition (see Hotkeys)

Botf2-coding-practice



SourceTree

  • Tools: 3rd point: OPTIONS
  • SSH Client Configuration:
    • SSH Key: c:\....\ReginaldPutty.ppk
    • SSH Client: (IMPORTANT) PuTTY/Link (not SSH !!)
    • automatically start: yes

Visual Studio

It's possible (and standard) to compile the game with Visual Studio Expres. No further stuff of programs are needed. Mention that the compiled exe is then in \SupremacyClient\bin\Release.

VS2013

VS2015

so far we were not able to transfer the code running with VS2015 so we're still using VS2013 atm.

  • Visual Studio Community 2015 RC - to compile the code (ISO is recommend) ... still need to check if Supremacy code compiles with it, so instead we might need VS2013 https://www.visualstudio.com/downloads/visual-studio-2015-downloads-vs - you need the "Community" Version
    • IMPORTANT: As Microsoft no longer provides Visual C++ Library as standard installed component ...don't forget to select or install this manually! In VS 2015 you can recognize it if \Supremacy Native is unload (sign is greyed out a little bit)

old VS

Tools

Tips

Compiling

if you have an error with "Glyphs.xaml", than make sure you have copied \Resources MANUALLY into the output folders - this was changed in 2015. The output folder depends on compiling method "Debug" or "Release", it is

  • for DEBUG _: (YourRepositoryFolder)\Mainline\bin\Debug\Resources or
  • for RELEASE: (YourRepositoryFolder)\Mainline\bin\Release\Resources

Visual C#

build in Visual Studio

SunBurn

SunBurn is on hold for now. Kenneth was working sometimes with SunBurn...this might be a site for this http://channel9.msdn.com/coding4fun/blog/No-need-for-sunscreen-you-want-this-SunBurn-SunBurn-v2-RTMs-including-the-free-SunBurn-Framework-Edi

.Net

you should use latest .Net-version (2014: version 4.5.1)

XNA

"Could not load file or assembly 'Microsoft.Xna.Framework.dll' or one of its dependencies. The specified module could not be found."

  • suggestion by reg: go to \Resources\Models and rename the "Models"-folder to "Models-SetOffline" or something else (if building a ship no model is shown -as it is to most of the ships- but otherwise the game could work fine)


This suggests the problem is with your XNA installation. The game uses XNA to display the 3D ship models in the shipyard. There's no way to disable the models so XNA wouldn't be needed. So to be able to play the game, i'd advise to uninstall XNA, then install the latest version.

XNA 3.1 (this one you need in any case): http://www.microsoft.com/en-us/download/details.aspx?id=15163

XNA 4.0 Download link: http://www.microsoft.com/en-gb/download/details.aspx?id=20914