Skip to content
yvt edited this page Dec 8, 2013 · 8 revisions

Internal Components

OpenSpades is made of several important components. Here's a partial list of them:

  • Core
  • [C++] Dispatch Queue - distributes given tasks to multiple CPU cores. Similar to OS X's Grand Central Dispatch.
  • [C++] Backtrace Tracker - traces function calls to provide activation records (backtrace) in case of an unexpected error.
  • [C++] <- AS Settings - manages configuration variables (aka cvars).
  • [C++] File Manager - manages resources.
  • Presentation Layer (interface between code and user)
  • [C++] <- AS Audio Device - receives audio commands and plays sound. An audio device might use the spatial structure of the game map for better auralization.
  • [C++] <- AS Renderer - receives renderer commands, draws everything needed, and shows the rendered off-screen image to the user. This is implemented using C++ code, though this is accessible by the script. Script needs a handle to the renderer to access.
  • [C++] Runner - creates renderer and audio device, and pass them to the initial view. A runner also handles input events that comes from the window system and converts them into the format that views accept.
  • Abstract User Interfaces
  • [C++] View - (new in 0.0.10) an abstract object that is responsible for receiving input events and managing operations that is required to do in each frame. A view might delegate some events to the subview. Note that although some views let script handle events, views are not accessible from script.
  • [AS] UI Framework - simple GUI toolkit designed to work on the renderer interface.
  • World Objects
  • [C++] <- AS Game Map - encapsulates the state of game map.

Legends: [C++] = implemented using C++, <- AS = accessible from script

What happens when I play this game?

0.0.9:

  1. Game executable is loaded by the operating system, initializing some data sections.
  2. List of script-visible objects is created using the constructor of ScriptRegistrar.
  3. Now we enters main function.
  4. FLTK is initialized.
  5. Starts

User Interfaces

  • Main Window - startup window that allows users to configure the graphics options and access server lists. This is implemented using FLTK, not through the renderer interface nor UI Framework.
  • Main Screen - new startup screen implemented in 0.0.10. As the main window, this also contains server lists and options, but configurable options are restricted because the renderer is already initialized when the main screen is loaded. This is implemented using UI Framework.
  • Setup - new quick config screen implemented in 0.0.10. This is implemented using UI Framework.
  • In-game Menu - new menu window implemented in 0.0.10. This is accessible by hitting ESC during the game. This is implemented using UI Framework.
  • Say Window - This used to be implemented using C++, however, in 0.0.10 this is implemented using UI Framework.
  • Scoreboard - implemented using C++
  • Limbo Screen - Weapon/team switcher implemented using C++.