SimViewer - NGGameSim/NGGameSim GitHub Wiki
SimViewer Documentation
Summary
The SimViewer executable and solution contains, for all intents and purposes, the client(s) for the entire project. This executable and source code handles the following tasks:
-
Interpreting and intercepting the packets sent from SimManager from the IPC.
-
Rendering entity positions from those intercepted packets. Showing real-time positions of tanks, missiles, and UAVs.
-
Providing camera controls to manipulate the rendered simulation instance(s).
-
Providing real-time feedback from the SimManager. An example is displaying which team a tank has been hit with a missile.
File Descriptions
Content Folder
Holds all model, sprite, and texture files for rendering. This is controlled by the MonoGame content project and related pipeline. Changing any content information must be done outside of Visual Studio.
Graphics Folder
Holds all necessary camera code as well as rendering code for the view radius and view cone models. Cameras are split into camera types, which control how a camera can be used, and camera behaviors, which implement how cameras update.
Input Folder
Holds all code for handling input from the user. These are just wrappers around MonoGame's input classes with some additional utility functionality.
Network
Holds the Client.cs file that controls and maintains the connection to the server. The client is the wrapper around the Lidgren client, which manages packet routing.
Program.cs
Loads the startup window and the main SimViewer GUI as well as initiates the client connection to the server.
SimViewer.cs
Initializes the Graphics, Client, and SimManager instances. Handles initiation of the simulation rendering on the client side.
SimViewerStartupWindow.cs
Creates a window for entering the team ID and IP address.
SimViewerWindow.cs
Controls the layout and functionality of the SimViewer (client side) window. Only launches after the SimViewerStartupWindow has been closed.
StateInfoTextArea.cs
Controls the state information displayed in the client GUI.
SimulationManager.cs
The main workhorse behind rendering on the client side. Relevant methods are described below
-
CheckLogin()
: Checks the value of what is entered in the team ID of the SimViewerStartupWindow. This will set an integer value accordingly which will determine what is displayed to the user. -
SimulationManager()
: Initiates and loads all models as well as initiating an instance of the simulation. -
TranslateEntityPacket()
: Translates the packet sent from the SimManger (server) side. Used to render accurate information in the client. -
TranslateMissilePacket()
: Same as above, but for the missile entity. -
Render()
: Renders all entities and sets the active camera and follow behavior.