|
Programming in Solar Vengeance 5 You can custom program Scenarios and Brains to extend Solar Vengeance 5. You program these items as new classes in the C# programming language. Scenarios are classes that derive from a base class called "Scenario" and Brains are classes that derive from the "Brain" class. The base classes provide properties and methods that you leverage to develop the custom Scenarios, and the logic for how the Brain opponent plays the game. The specific APIs of the Scenario and Brain classes will be covered in detail in their own topics, but this topic will focus on the general setup for programming in Solar Vengeance 5. How Solar Vengeance Loads Scenarios and Brains Solar Vengeance looks for Scenarios in the "Scenarios" folder under its primary install folder, and Brains in the "Brains" folder. It looks for files with a ".cs" extension, which indicated C# source code. When you create a Scenario or Brain, just move or copy the source code file to the appropriate folder. The next time SV5 starts up it will load your file and attempt to compile it on-the-fly for inclusion in the game. Creating Source Code Files Although you can use any text editor to create the source code file, such as Notepad, you can gain the most benefit by using a .NET development environment. Using a development environment will allow you to compile the source code to check for errors, and provides valuable time saving tools like Intellisense to make the job of programming a Scenario or Brain painless. If you have access to Microsoft Visual Studio, you can use this environment to develop your new Scenarios and Brains. An alternative is the SharpDevelop freeware development environment for .NET. Which .NET Framework? Solar Vengeance 5 is currently build under version 2.0 of the Microsoft .NET Framework. You should develop your Scenarios and Brains using C# language features of .NET 2.0. Visual Studio 2005 and 2008 both allow you to target the .NET Framework 2.0. Adding a Reference To build a Scenario or Brain in a development environment, you will need to add a reference to the Solar Vengeance engine in your project. Be sure to add the reference to the SCG.SolarVegneance.Engine assembly in your project. This .NET assembly contains the definition of the Scenario and the Brain classes that you need to access. |