Server Help

ASSS Custom Projects - ACE -- ASSS C Enricher (beta 2 released!)

Arnk Kilo Dylie - Sat Jan 23, 2010 1:12 am
Post subject: ACE -- ASSS C Enricher (beta)
I'm a lazy guy, and this is a tool that I pieced together to enable my lazy tendencies. With any luck, it will be useful to you too.

ACE is a tool for building modules. Some of the most tedious things asss makes you do are automated by using a special middle language that has directives and expansion functions wrapped around your usual C functions.

After working on it on and off for a few months, I am making a beta release to get feedback and iron out any problems I couldn't find in my simple tests of everything (and any really embarrassing things like debug messages that break the output!)

The target audience for this tool is lazy programmers, or specifically anyone who is annoyed at some of the overhead in making well-behaved modules (gracefully failing, logging why load failed, registering/unregistering things, etc.)

Major functionality:
* Generate full asss modules (especially the entry point function) from a builder language that lets the user specify specific asss patterns.
* Wrap asss constructs including callbacks, interfaces, commands, and advisers by automatically registering and unregistering them in the correct order.
* Specify what interfaces your module needs to successfully load, and ACE will fully handle and log any failures to obtain the interfaces.
* Automatic handling of "dynamic" per-arena-data and per-player-data, allowing full structures to only be allocated when they apply.
* Automatically prototype functions.

It is designed to work with the asss makefile if you put it in the src/ace/ folder right now, with your input files using the .aces extension. You still have to put your modules in a .mk for so_files=blah like normal C modules.

Stand in awe at how a simple hello-world program is actually about as many lines as one should be in ACE, while the resulting C program is much bigger (even if you don't count the fourth-gear logging and error handling ACE adds):
Code: Show/Hide

$#module greeter

$#callback global CB_PLAYERACTION
void paction(Player *p, int action, Arena *a)
{
   if (action == PA_CONNECT)
      chat->SendMessage(p, "Greetings, human.");
}
$#endcallback

Code: Show/Hide

#include "asss.h"

local Imodman *mm;
local Ilogman *lm = 0;
local Ichat *chat = 0;

local void paction(Player *p, int action, Arena *a);


void paction(Player *p, int action, Arena *a)
{
        if (action == PA_CONNECT)
                chat->SendMessage(p, "Greetings, human.");
}

EXPORT int MM_greeter(int action, Imodman *_mm, Arena *arena)
{
        int failedLoad = FALSE;
        if (action == MM_LOAD)
        {

                mm = _mm;
                lm = mm->GetInterface(I_LOGMAN, ALLARENAS);
                if (!lm)
                        return MM_FAIL;
                chat = mm->GetInterface(I_CHAT, ALLARENAS);
                if (!chat)
                {
                        lm->Log(L_ERROR, "<greeter> error obtaining required interface I_CHAT " I_CHAT);
                        failedLoad = TRUE;
                        goto ace_fail_load;
                }

                mm->RegCallback(CB_PLAYERACTION, paction, ALLARENAS);

                return MM_OK;
        }
        else if (action == MM_UNLOAD)
        {

                mm->UnregCallback(CB_PLAYERACTION, paction, ALLARENAS);
ace_fail_load:

                mm->ReleaseInterface(lm);
                mm->ReleaseInterface(chat);
                if (failedLoad)
                        return MM_FAIL;
                else
                        return MM_OK;
        }
        return MM_FAIL;
}


I encourage all of you to try ACE and give feedback on the language and performance. Please document issues on the issue tracker, too.

Downloads
Home page - There's fairly complete documentation here, too.
Issue Tracker
Lynx - Sat Jan 23, 2010 8:12 am
Post subject:
Nice Job
Cheese - Mon Jan 25, 2010 12:02 am
Post subject:
im also lazy, therefore i dont feel like downloading anything extra
Arnk Kilo Dylie - Tue Apr 26, 2011 11:04 pm
Post subject:
Update: Beta 2 was released. This version is much more polished, and more feature complete, and you are encouraged to try it out and find things it still lacks or that you still want.

SSCE Hockey/Football Zone and SSCE Hyperspace both use this tool to different degrees, and you are encouraged to as well.

Check the downloads links in the first post.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group