Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
ASSS Bot Core
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  Win32 Contenc.dll - v1.1.3 Post :: Post Trigger module  View next topic  
Author Message
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Wed Apr 02, 2003 10:30 pm    Post subject: ASSS Bot Core Reply to topic Reply with quote

any plans...?
_________________
Signatures just seem so quaint.
Back to top
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Wed Apr 02, 2003 10:34 pm    Post subject: Reply to topic Reply with quote

Bot core? Most bots are just text based online, so all you really need is to see how the player commands work and do it that way. If you want visual bot as a player, there is the fake player module you can use.
Back to top
View users profile Send private message Add User to Ignore List Send email
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Wed Apr 02, 2003 10:35 pm    Post subject: Reply to topic Reply with quote

On what?
ASSS itself pretty much can do the job of bots for you. It can even do some things that bots would not be able to.
_________________
3y3 4m l33t h4x0r
j0! 3y3 4m t4lking to j00!
fux0red 5cr1pt k1dd13.
-"l33t h41ku"
Back to top
View users profile Send private message Add User to Ignore List Send email
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Wed Apr 02, 2003 10:35 pm    Post subject: Reply to topic Reply with quote

right-o, but one that comes canned, so normal people can write plugins in 10 minutes like with MERV (im whining!)
Back to top
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Wed Apr 02, 2003 10:42 pm    Post subject: Reply to topic Reply with quote

10 minute plugins arn't always good. They are more likely to not be well planned, and are more likely to crash and burn than one you spent time on making.

And doing a 10-minute edit to add some new commands for what you need to an existing file is still simple to do.
Back to top
View users profile Send private message Add User to Ignore List Send email
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Wed Apr 02, 2003 10:43 pm    Post subject: Reply to topic Reply with quote

10 to 1 the bot that anyone needs is available in component parts stolen from others, or based on previous bots written
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Apr 02, 2003 10:46 pm    Post subject: Reply to topic Reply with quote

Bots may offer an advantage (for now) for the average joe zone sysop, but for the power sysop (biggrin.gif) ASSS offers many advantages. When V1 is released, expect to see a sudden lack of bots in some zones.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Wed Apr 02, 2003 10:59 pm    Post subject: Reply to topic Reply with quote

no kidding, esp the big zones.
Back to top
View users profile Send private message Add User to Ignore List
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Thu Apr 03, 2003 7:56 am    Post subject: Reply to topic Reply with quote

If only ASSS would not be in damn C icon_sad.gif icon_sad.gif icon_sad.gif
Back to top
View users profile Send private message Add User to Ignore List Send email
make/believe
Guest


Offline

PostPosted: Thu Apr 03, 2003 10:38 am    Post subject: Reply to topic Reply with quote

no kidding, no classes, just structs? kinda behind the curve, eh? i saw the Grem quote on the other board... i think he thought himself in circles... we can write dlls in c++ though? or even (*eeek!) declare functions in VB. That will be nice. thats why i think a core would be nice... so those of us who are used to comprehending data and functions as a single unit won't get lost in the arrays and linked lists icon_smile.gif
Back to top
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Thu Apr 03, 2003 5:54 pm    Post subject: Reply to topic Reply with quote

It was written in C because when he started it in C++, it started to get very unorganized. Its somewhere in his source-release. That, or maybe its only on his server, but i read it somewhere. Anyways, its looking good as C now, no reason to convert over.

As for the C++: I was going to put a hack on the server for the Win32 build for it to read C++ dll's without problems. MSVC likes to add _ and @#'s to things when exporting a function as "C". As for VB, i never had to read a VB dll before, so never looked at the function's exported name.
Back to top
View users profile Send private message Add User to Ignore List Send email
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Thu Apr 03, 2003 6:14 pm    Post subject: Reply to topic Reply with quote

could you post something to get my started? i want to work this thing, but im quite honestly flabbergasted (i never bothered with C, just went to C++, which was taught at school, any escuse? no).

How exactly would i build a dll module to do something when a player changes chip, like spit something to chat.

just something very simple. not even necessarily that event. anything really. ive lost my feet, if you can get me up ill be glad to start chugging out code icon_razz.gif
Back to top
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Thu Apr 03, 2003 6:44 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
#include <stdlib.h>
#include <stdio.h>
#include "asss.h"
/* standard includes */

local Ichat *chat; /* required so you can do the chat->SendArenaMessage */
local Imodman *mm; /* just to keep the same design as other modules */

void TellShipChange(Player *p, int newship, int newfreq)
/* this function is of the same type as [b]ShipChangeFunc[/b] is defined
* in game.h
*/
{
   /* SendArenaMessage requires a pointer to the arena info
    * (which Player data contains as p->arena), then the text you want
    */
   chat->SendArenaMessage(p->arena, "Player %s changed to ship %d on freq %d", p->name, newship, newfreq);
}

EXPORT int MM_shiptell(int action, Imodman *_mm, Arena *arena)
/* the ONLY thing you need to ever change in EXPORT function is the part
* after the MM_. The MM_ is required, but after it is free game (no spaces,
* as usual for functions
*/
{
   if (action == MM_LOAD)
   {
      /* MM_LOAD is the action whenever the dll is first started
       * up. This is where you load in other interfaces and setup
       * any initial values
       */

      mm = _mm;

      chat = mm->GetInterface(I_CHAT, ALLARENAS);
      /* this will let us use the chat interface */

      if (!chat) return MM_FAIL;
      /* make sure this dll is loaded after the chat dll is, since
       * our code assumes that [b]chat[/b] is always a valid pointer
       */

      mm->RegCallback(CB_SHIPCHANGE, TellShipChange, ALLARENAS);
      /* a RegCallback sets up a function to be called whenever
       * the action you request is done. In game.h, you can see
       * the CB_SHIPCHANGE callback, so we setup a function
       * to use it.
       */

      return MM_OK;
   }
   else if (action == MM_UNLOAD)
   /* MM_UNLOAD happens right before your dll is about to be
    * free'd, so now is the time to dealloc memory and
    * unregister any interfaces/callbacks we have so the server
    * won't crash after we leave. Do [b]NOT[/b] assume the server
    * is shutting down if you get this!
    */
   {
      /* Just undoing what we did in MM_LOAD */
      mm->UnregCallback(CB_SHIPCHANGE, TellShipChange, ALLARENAS);

      mm->ReleaseInterface(chat);
      return MM_OK;
   }
   return MM_FAIL;
}


I typed this all up at school, so there might be a compile error or misspelling somewhere in there. Anyways, that should do what you wanted, sends pretty much a *arena whenever someone changes ships.
Back to top
View users profile Send private message Add User to Ignore List Send email
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Thu Apr 03, 2003 9:31 pm    Post subject: Reply to topic Reply with quote

thank you mucho, these function pointer nonsenses are killing me...
Back to top
View users profile Send private message Add User to Ignore List
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Thu Apr 03, 2003 9:36 pm    Post subject: Reply to topic Reply with quote

GetInterface returns void, cannot assign to Ichat

Code: Show/Hide

chat = mm->GetInterface(I_CHAT, ALLARENAS);


DOH! IT STILL THINKS IM A C++ JUNKY!
Back to top
View users profile Send private message Add User to Ignore List
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Thu Apr 03, 2003 9:56 pm    Post subject: Reply to topic Reply with quote

just checking can i Register multiple callbacks to a single interface (it compiles ok)

IE
Code: Show/Hide

mm->RegCallback(CB_SHIPCHANGE, onShipChange, ALLARENAS);     mm->RegCallback(CB_FREQCHANGE,onFreqChange,ALLARENAS);
mm->RegCallback(CB_KILL,onKill,ALLARENAS);


PS Is there a player ship movement callback to register? i searched, to no avail
Back to top
View users profile Send private message Add User to Ignore List
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Thu Apr 03, 2003 11:06 pm    Post subject: Reply to topic Reply with quote

see anything wrong with this? compiles 100% error and warning free.

NOTE: this was quick code, please dont make any comments like "dirty" or "unfinished"
Code: Show/Hide

// helicon.cpp : Defines the entry point for the DLL application.
//

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "asss.h"

//// GLOBAL VARS ////
local Ichat *chat;
local Imodman *mm;
/////////////////////


/*    EVENT HANDLER PROTOTYPES    *\
        (call these anywhere)
\*                           */
   void onArenaAction(Arena *a, int action);
   void onFlagWin(Arena *arena, int freq);
   void onFlagPos(Arena *arena, int fid, int x, int y, int freq);
   void onFlagDrop(Arena *arena, Player *p, int count, int neut);
   void onPlayerAction(Player *p, int action, Arena *arena);
   void onGoal(Arena *arena, Player *p, int bid, int x, int y);
   void onFlagPickup(Arena *arena, Player *p, int fid, int oldfreq, int carried);
   void onBallFire(Arena *arena, Player *p, int bid);

   void onBallPickup(Arena *arena, Player *p, int bid);
   void onKill(Arena *arena, Player *killer, Player *killed, int bounty, int flags);
   void onFreqChange(Player *p, int newfreq);
   void onShipChange(Player *p, int newship, int newfreq);
   void onChatMsg(Player *p, int type, Player *target, int freq, const char *text);
   int startup();

//// EVENT HANDLERS ////
void onChatMessage(Player *p, int type, Player *target, int freq, const char *text){
}
void onArenaAction(Arena *a, int action){
}
void onFlagWin(Arena *arena, int freq){
}
void onFlagPos(Arena *arena, int fid, int x, int y, int freq){
}
void onFlagDrop(Arena *arena, Player *p, int count, int neut){
}
void onPlayerAction(Player *p, int action, Arena *arena){
   switch(action){
   case PA_CONNECT:
      break;
   case PA_DISCONNECT:
      break;
   case PA_PREENTERARENA:
      break;
   case PA_ENTERARENA:
      break;
   case PA_LEAVEARENA:
      break;
   }
}
void onFlagPickup(Arena *arena, Player *p, int fid, int oldfreq, int carried){
}
void onGoal(Arena *arena, Player *p, int bid, int x, int y){
}
void onBallFire(Arena *arena, Player *p, int bid){
}
void onBallPickup(Arena *arena, Player *p, int bid){
}
void onKill(Arena *arena, Player *killer, Player *killed, int bounty, int flags){
}
void onFreqChange(Player *p, int newfreq){
}
void onShipChange(Player *p, int newship, int newfreq){
   chat->SendArenaMessage(p->arena, "Player %s changed to ship %d on freq %d", p->name, newship, newfreq);
}
int startup(){
//TODO:stick you initialization code here
   return 1;
}

/********************* MAIN DLL BODY ************************/
EXPORT int MM_botcore(int action, Imodman *mm_, Arena *arena){

   if (action == MM_LOAD){
      mm = mm_; //shorthand

//REGISTER INTERFACES
      chat = mm->GetInterface(I_CHAT, ALLARENAS);

//RUN STARTUP FUNCTION, KILL IF BAD RETURN
      if(!startup()) return MM_FAIL;

      if (!chat) return MM_FAIL;

//REGISTER CALLBACKS
      //game.h
         mm->RegCallback(CB_SHIPCHANGE, onShipChange, ALLARENAS);
         mm->RegCallback(CB_FREQCHANGE,onFreqChange,ALLARENAS);
         mm->RegCallback(CB_KILL,onKill,ALLARENAS);

      //balls.h
         mm->RegCallback(CB_BALLPICKUP,onBallPickup,ALLARENAS);
         mm->RegCallback(CB_BALLFIRE,onBallFire,ALLARENAS);
         mm->RegCallback(CB_GOAL,onGoal,ALLARENAS);

      //core.h
         mm->RegCallback(CB_PLAYERACTION, onPlayerAction, ALLARENAS);

      //flags.h
         mm->RegCallback(CB_FLAGPICKUP, onFlagPickup, ALLARENAS);
         mm->RegCallback(CB_FLAGDROP, onFlagDrop, ALLARENAS);
         mm->RegCallback(CB_FLAGPOS,onFlagPos,ALLARENAS);
         mm->RegCallback(CB_FLAGWIN,onFlagWin,ALLARENAS);

      //arena.h
         mm->RegCallback(CB_ARENAACTION, onArenaAction, ALLARENAS);
      
      //chat.h
         mm->RegCallback(CB_CHATMSG,onChatMessage,ALLARENAS);

   }
   else if (action == MM_UNLOAD){
//UNREGISTER THE CALLBACKS
         //game.h
         mm->UnregCallback(CB_SHIPCHANGE, onShipChange, ALLARENAS);
         mm->UnregCallback(CB_FREQCHANGE,onFreqChange,ALLARENAS);
         mm->UnregCallback(CB_KILL,onKill,ALLARENAS);

         //balls.h
         mm->UnregCallback(CB_BALLPICKUP,onBallPickup,ALLARENAS);
         mm->UnregCallback(CB_BALLFIRE,onBallFire,ALLARENAS);
         mm->UnregCallback(CB_GOAL,onGoal,ALLARENAS);

         mm->UnregCallback(CB_PLAYERACTION, onPlayerAction, ALLARENAS);

         //flags.h
         mm->UnregCallback(CB_FLAGPICKUP, onFlagPickup, ALLARENAS);
         mm->UnregCallback(CB_FLAGDROP, onFlagDrop, ALLARENAS);
         mm->UnregCallback(CB_FLAGPOS,onFlagPos,ALLARENAS);
         mm->UnregCallback(CB_FLAGWIN,onFlagWin,ALLARENAS);

         //arena.h
         mm->UnregCallback(CB_ARENAACTION, onArenaAction, ALLARENAS);

         //chat.h
         mm->UnregCallback(CB_CHATMSG,onChatMessage,ALLARENAS);

//RELEASE INTERFACES
         mm->ReleaseInterface(chat);
         return MM_OK;
      }

      return MM_FAIL; //problem
}
Back to top
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Fri Apr 04, 2003 12:39 am    Post subject: Reply to topic Reply with quote

Try renaming the file to .c instead of .cpp. That way it will compile as a C program, instead of MSVC trying to C++-ify the exported function.
Back to top
View users profile Send private message Add User to Ignore List Send email
Gravitron
VIE Vet


Age:41
Gender:Gender:Male
Joined: Aug 02 2002
Posts: 993
Location: Israel
Offline

PostPosted: Fri Apr 04, 2003 3:20 am    Post subject: Reply to topic Reply with quote

Shouldn't this be moved onto one of them coding forums?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address Yahoo Messenger MSN Messenger
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Fri Apr 04, 2003 12:30 pm    Post subject: Reply to topic Reply with quote

yeah probably... btw it is a .c file, but MSVC++ is a bitch.
still no luck with a "PlayerMove-esque" callback?

maybe there is a call to retrieve current Player structs?
Back to top
View users profile Send private message Add User to Ignore List
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Fri Apr 04, 2003 7:40 pm    Post subject: reply to lots of posts here Reply to topic Reply with quote

Bot core: bots are dumb. Write modules instead. Yes, there are plans for an easy-to-use way of writing modules and other stuff. They're just plans for now, because I have higher priorities and very limited time. For now, you'll have to use C or get someone to do it for you. If you have ideas that you think would make generally useful modules (i.e., useful to more than just one zone), tell me and I might do them myself.

Why C? I don't like C++ (yes, I do have good reasons for this), and I wasn't comfortable enough with any alternative languages at the time when I started. As I've said elsewhere, the perfect language for an SS server is probably Erlang. If I add a supported extension language, it'll probably be Python, because it's simple, easy to learn, and unobjectionable.

It's hard to learn: Yeah, I know. It's a big complicated mess of event-driven multi-threaded code with many interacting modules. Sorry, that's just how it has to be to do its job. Some developer documentation would help, but I haven't had a chance yet. Btw, I _don't_ think adding comments to .c files will help at all. It's the header files that need comments, to describe what each function in each interface does, and when each callback is called. And then something spelling out how to use interfaces, callbacks, and what happens in which thread.

In C, not C++, void pointers are automatically coerced to any pointer type.

You can register as many callbacks as you want in a module.

There is no ship movement callback, for efficiency reasons: it would get called far too often. You can access current player position information from the player structure (p->position.x,y,etc.). In the future there will probably be callback events for entering and exiting user-defined regions.

That code (in msg Thu Apr 03, 2003 11:06 pm) looks fine. Realize that you'll need to get pointers to a bunch more interfaces than chat if you want to do anything useful. Also realize that registering lots of callbacks that don't do anything will make things slower (though it probably won't be a big deal). Finally, if you're writing a module that's going to apply to specific arenas, then you probably want to set up your callbacks in the MM_ATTACH event (and unreg them in MM_DETACH), and pass in the arena pointer instead of ALLARENAS, so that it will only be called for events in that arena.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
make/believe (heteronym)
Guest


Offline

PostPosted: Fri Apr 04, 2003 10:44 pm    Post subject: Reply to topic Reply with quote

thank you for your support. i am duly grateful for your work, it is truly outstanding, but, as a certified bitcher, this is my job. i cam currently writing my own stuff (digging out the C, damn i thought i'd never use those libraries!) I understand the need for more interfaces, ive got them. I also understand my liberal use of the word "bot" may not have been the best given the situation. i suppose "mod_bot" would have been more appropriate, eh?

right now im just making a really friggin huge module with "bot-esque"(word?) format to learn your API, relearn C, and offer myslef a mod-able(word?) template for making simple game hacks and pseudo-bot game-specific modules. ill let you know if i accidentally come up with something good.

hopefully the end of all this will be an extension of the .conf and .cfg structure to support common game types with greater ease, IE infantry, flaggin, etc
Back to top
m/b(h)
Guest


Offline

PostPosted: Fri Apr 04, 2003 10:47 pm    Post subject: Reply to topic Reply with quote

PS, i think i might actually finish a VB program to spit out .c files with only chosen callbacks and interfaces done automatically...interested? probably not, but it will certainly save me some time.

inn your estimation, how much do you believe the callbacks and interfaces will have changed come (blessed) release?
Back to top
m/b(h)
Guest


Offline

PostPosted: Fri Apr 04, 2003 11:03 pm    Post subject: Reply to topic Reply with quote

using mainloop->SetTimer
and using FOR_EACH_PLAYER(p) to iterate would be feasible?
Back to top
m/b
Guest


Offline

PostPosted: Fri Apr 04, 2003 11:33 pm    Post subject: Reply to topic Reply with quote

one last thing for tonight:

in your example (MGB) you provided something to this effect;
Code: Show/Hide

void onShipChange(Player *p, int newship, int newfreq){
   //chat->SendArenaMessage(p->arena, "Player %s changed to ship %d on freq %d", p->name, newship, newfreq);
}


utilizing the Ichat function:
Code: Show/Hide

void (*SendArenaMessage)(Arena *arena, const char *format, ...);


the %s and (2) %d (which appear different when printed in-game), as well as you passing the parameters to the function, produce a nice result that would certainly circumvent some CString confusion

could you please explain their use? are they flexible?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 645 page(s) served in previous 5 minutes.

phpBB Created this page in 0.486853 seconds : 50 queries executed (90.3%): GZIP compression disabled