Fandom

Grobots Wiki

Source

54pages on
this wiki
Add New Page
Talk3 Share

You can get the latest source to Grobots by anonymous CVS from grobots.cvs.sourceforge.net. (Use CVSROOT=:pserver:anonymous@grobots.cvs.sourceforge.net:/cvsroot/grobots.) Or view the CVS tree with your browser. You can also download the source in a zipfile. The latest version that we've gotten around to uploading is that of 26 August 2012 . Grobots is free software, distributed under the GNU General Public License .

ArchitectureEdit

Grobots is built in four layers. The lowest, Support, provides some useful portable library. The second (in three parts: Sides, Simulation, and Brains) implements the game engine. The third, Views, provides most of the user interface portably. The top layer, UI, embeds the views and engine in a cross-platform application. Lower layers do not depend on higher ones. Most of the names below correspond to a .cpp file and a header file.

Quick startEdit

When viewing the source code with a browser click on the revision number to view the file, not the filename as one might expect (which shows CVS history).

Here are the most important source code files for use when tracking down something for the documentation:

  • Hardware cost and mass: sides/GBHardwareSpec.cpp
  • Hardware functionality: usually simulation/GBHardwareState.cpp; sometimes simulation/GBShot.cpp, GBRobot.cpp, or elsewhere
  • Language: brains/GBStackBrainPrimitives.cpp
  • Overall side file format: sides/GBSideReader.cpp
  • UI: ui/GBApplication.cpp and the code for the windows in the views/ folder

Most of the rules are in these files and in methods called from these files.

Support (utilities)Edit

General-purpose, lower-level code used by the rest of the system.

GBPlatform.hEdit

File for platform conditionalization.

GBNumberEdit

Fixed-point number class, used throughout the simulation and brains.

GBFinePointEdit

2-vector of GBNumbers, used for positions and velocities.

GBColorEdit

A more convenient representation of colors.

GBErrorsEdit

Most of the exception classes live here. (Maybe they shouldn't.)

GBTypes.hEdit

Header file defining a bunch of widely used types and synonyms.

GBLongNumberEdit

Extra-precision GBNumber, used for keeping scores.

GBSoundEdit

Some simple asynchronous sound functions.

GBDeletionReporterEdit

Mixins for classes whose instances tell their dependents when they're deleted, to get around the lack of garbage collection.

GBModelEdit

Mixin to keep a version number on an object, so views can tell when it's changed.

GBRandomStateEdit

A random-number generator.

GBstringUtilitiesEdit

Various string utilities.

GBGraphicsEdit

Three classes for portable graphics.

GBMillisecondsEdit

Portable timer function. (GBMilliseconds.h is the smallest file in Grobots.)

SidesEdit

This part describes sides. Some state is also here, but ought to be split out. Everything here should be portable.

GBSideEdit

Side spec class, equivalent to a side file.

GBRobotTypeEdit

Type spec class.

GBSideReaderEdit

Loads side files.

GBHardwareSpecEdit

A huge file describing the nature of hardware.

GBScoresEdit

Several classes for scores and statistics.

SimulationEdit

Everything here should be portable. GBObject and GBWorld are the heart of the engine.

GBObjectEdit

Abstract class for simulation objects (sprites).

GBObjectWorldEdit

Class that holds GBObjects and supports some operations on them.

GBWorldEdit

Subclass of GBObjectWorld, with more features and a roster. This is an important class.

Files containing subclasses of GBObject:Edit

GBDecorationsEdit

Purely decorative sprites that have no game effect, like smoke and sparks.

GBFoodEdit

Classes for food.

GBShotEdit

All shots, including syphons, force fields, and explosions.

GBSensorShotEdit

Sensors are implemented using a sensor shot, which sees things by colliding with them.

GBRobotEdit

Most of the actual work is in GBHardwareState.

Other files supporting GBRobot:Edit

GBHardwareStateEdit

Unwieldy file describing most of the behavior of hardware.

GBMessagesEdit

Most of the message-passing communications system.

BrainsEdit

All brain-related stuff (both spec and state) is here. Only one kind of brain is currently used, but there used to be others (for hardcoded sides), and there could be more in the future (to support other languages, for example).

GBBrainSpecEdit

Abstract class.

GBBrainEdit

Abstract class.

GBStackBrainSpecEdit

Spec for the usual kind of brain. Represents compiled code, mostly. Also contains part of the compiler.

GBStackBrain (including GBStackBrainPrimitives.cpp)Edit

Brain class: a simple stack-based virtual machine.

GBStackBrainOpcodesEdit

Names of stack brain primitives.

ViewsEdit

Each window displays a GBView.

GBViewEdit

Abstract view class, and a few useful subclasses.

GBListViewEdit

Parent class for RosterView, ScoresView, and any other views that are lists of something.

GBPortalEdit

The main view.

GBRosterViewEdit

GBMiniMapEdit

GBScoresViewEdit

GBRobotTypeViewEdit

GBTournamentViewEdit

GBDebuggerEdit

GBAboutBoxEdit

UIEdit

Top-level cross-platform user interface code. Nothing outside this part depends on anything in it.

GBApplicationEdit

GB-specific application-scope stuff.

GBViewsApplicationEdit

Non-Grobots-specific cross-platform application framework.

GBWindowEdit

Cross-platform wrapper class for a window containing a view.

GBMain.cppEdit

This is a boring file, containing main() and nothing else.

MacEdit

Mac Interface.rsrcEdit

Mac-specific resource file, containing menus and dialogs.

Grobots*.makeEdit

MPW makefiles.

Sounds.rsrcEdit

Resource file with sounds.

Carbon.rsrcEdit

Resource file with one resource needed for the Carbon build.

Grobots.xcodeprojEdit

Project for building with XCode.

info.plistEdit

Property list for OS X build.

Grobots_Prefix.pchEdit

Prefix header for XCode. (It's useless. How do I turn it off?)

WinEdit

Menus.rc, grobots.icoEdit

Windows-specific resource files.

WinGrobots.sln, WinGrobots.vcxproj, WinGrobotsHeadless.vcxprojEdit

Build files for Microsoft Visual C++.

Grobots.dsw, GrobotsWin.dsp, GrobotsHeadless.dspEdit

Build files for old versions of Microsoft Visual C++.

ProblemsEdit

  • Hardware has big files and poor modularity.
  • spec/state aren't distinguished for sides and types.
  • GBStackBrain has poor modularity. Adding an operator requires changes to three files.

Places we could use the standard libraryEdit

  • Collections in various places (roster, types)
  • Standard exception classes

PortingEdit

HeadlessEdit

To begin with, port headless mode, which should be entirely portable. The main problem will be compatibility with your compiler. Grobots uses some C++ features which are not universally supported, such as long long, dynamic_cast, and std::string. You may also need to define some missing parts in Support. Simulation, Sides, and Brains shouldn't require any changes.

GBPlatform.hEdit

Add an #if defined to identify your compiler and platform, if it's not there already.

GBMillisecondsEdit

Milliseconds() should return the current time (since startup or whenever) in milliseconds. It doesn't need to be very precise. Once you have headless mode working, start on the GUI.

Porting the GUIEdit

GBGraphicsEdit

Make these three graphics classes work on your platform. Some parts exist only for portability, so it's OK if they don't do anything on your platform. You can live without GBBitmap but you'll lose double buffering, trails, and the portal background.

GBErrorsEdit

There are two error-reporting functions in GBErrors.cpp that need porting. These should be easy.

GBSoundEdit

This is stubbed out by default, so don't worry about it.

GBWindowEdit

A way to make windows containing a GBView.

GBViewsApplication, and GBApplicationEdit

Make this framework work on your platform. This is the hard part, because GUI frameworks vary so much. Fortunately it's mostly independent from the rest of Grobots. Don't worry too much about sharing with the existing code; we can factor out the common stuff later. The Mac and Win folders should be replaced by an appropriately named one for your platform, containing makefiles and any other platform-specific files. Note that the interface may want to be structured differently on some platforms, e.g. panes instead of separate windows.

Sending PatchesEdit

If you've ported part of Grobots, fixed a bug, or added a feature, we want your changes. Send patches to Devon or to the mailing list. Patches should include enough context that they can be applied even if other changes have been made. diff -u is good. Or give the old and new versions of each function modified. Or just send us the changed files.

To-do listEdit

See the Wishlist. These lists are mostly for the benefit of the maintainers, but if you feel like implementing some of these, go ahead. They're in very rough order of priority - items at the tops of the lists are more pressing; ones at the bottom are unlikely to ever happen.

StatisticsEdit

There are automatically generated statistics at ohloh . (5 April 2003) I counted lines in the source, and was surprised to find it's over 16000 lines and a hundred files. I didn't count the makefile, which is mostly machine-generated, or the two resource files, which don't have lines.

Part Files Lines Median Mean
Support 26 2477 64

95

Sides 12 3177 205 265
Brains 11 2144 143 195
Simulation 21 3991 95 190
Views 24 2821 172 118
UI 7 1439 80 206
Total 101 16049 92 159

The largest (and smallest) files are:

File Part Lines
GBHardwareState.cpp Simulation 819
GBStackBrainSpec.cpp Brains 714
GBApplication.cpp UI 667
GBHardwareSpec.cpp Sides 648
GBScores.cpp Sides 572
GBSideReader.cpp Sides 569
GBStackBrainPrimitives.cpp Brains 475
GBObjectWorld.cpp Simulation 420
GBWorld.cpp Simulation 418
GBPortal.cpp Views 405
GBMIlliseconds.h Support 12

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.