Logo
Spacer News Wiki Features F.A.Q. Team members Screenshots Download Messageboard Bug tracker Submit files
Top divider

AI:ABIC

Contents

[edit] ABI Compatibility layer ("ABIC"), and Abic++ C++ wrappers

[edit] What's an ABI compatibility layer and why could we need it?

Currently, the compiler used to compile Spring core dictates the possible compiler to use to compile global AIs.

The ABI compatibility layer aims to allow us to use any compiler to compile global AIs, regardless of the compiler used to compile spring.

In addition, ABIC binds at the function-level so:

  • Adding new functions to aicallback wont break older AIs
  • Adding new properties to unitdef wont break older AIs

[edit] Status

Feature complete with the AI .Net interface, except for GiveGroupOrder, AddMapPoint, GetMapPoints.

Integrated into Spring SVN core. See AI/Global/TestABICAI for an example of how to use ABIC.

There are C++ wrappers for ABIC, Abic++, at AI/GlobalCSAI/AbicWrappers .

[edit] How does it work?

The ABI compatibility layer converts the C++ GlobalAI interface presented by Spring to a C-interface. C-interface ABIs are standard across different compilers, a few underscores notwithstanding.

[edit] What's an ABI?

ABI is "Application Binary Interface". It's what gets exposed by dlls and sos, and is used to link the dll with another application at runtime. There are two parts to an ABI:

  • name mangling. This means: how do we convert the name of a function, possibly in a class, to some globally unique string
  • argument marshalling. How do arguments get passed to and from the function across the link boundary

C-interface argument marshalling is standardized across compilers. At least, each compiler is capable of certain calling conventions, such as extern "C", and there are calling conventions which are portable across multiple compilers.

C-interface name mangling is almost standard. Some compilers add an underscore at the start, some dont; its possible to use dlltool or similar to tweak this.

C++ ABIs are not standard across compilers, neither for name mangling nor for argument marshalling. C++ ABIs arent guaranteed to be standard across different versions of the same compiler.

[edit] Download

ABIC is now integrated into Spring SVN, in the directory rts/ExternalAI/GlobalAICInterface.

Abic++ C++ wrappers are available within AI/Global/CSAI/AbicWrappers directory n Spring SVN.

[edit] How to use ABIC

Add the following #include to your AI:

   #include "ExternalAI/GlobalAICInterface/AbicAICallback.h"

See AI/Global/TestABICAI , in Spring SVN, for an example of using ABIC directly.

[edit] How to use Abic++

Just add the following includes to your program:

#include "AbicAICallbackWrapper.h"
#include "AbicFeatureDefWrapper.h"
#include "AbicMoveDataWrapper.h"
#include "AbicUnitDefWrapper.h" 

There's a example of using Abic++ in a GlobalAI at AI/Global/AbicWrappersTestAI in the SVN.

Retrieved from "http://spring.clan-sy.com/wiki/AI:ABIC"

This page has been accessed 494 times. This page was last modified 19:33, 16 November 2006.