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
MervGen
Goto page Previous  1, 2
 
Post new topic   Reply to topic Printable version
 View previous topic  AnimationToImages Post :: Post Subspace Offline (AI)  View next topic  
Author Message
Cerium
Server Help Squatter


Age:41
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Thu Feb 08, 2007 12:45 am    Post subject: Reply to topic Reply with quote

@Tansey:
For the team thing, just do "Freq ___" where the user fills in the value or selects "Any freq"

Really, you should head down to gamestop or walmart or something and pickup Starcraft/Warcraft 3. You can get em for like $10 now and you'd be able to check out their trigger system. Or, check one of the popular torrent trackers as I'm sure you can get it there as well.


@Smong:
If that's the case, maybe have an option to auto-compile as well? Remember, a lot of people that will be interested in the result of this project will have minimal programming experience. Forcing them to learn how to compile something is a rather double edged sword.



Some more conditions/actions...

Conditions:
variable is operator value

Actions:
move player at location to location
set variable to value
_________________
There are 7 user(s) ignoring me right now.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Thu Feb 08, 2007 8:14 pm    Post subject: Reply to topic Reply with quote

Samapico wrote:
teams Even / Odd could be used for some balling games

But I guess that,s mostly an interface issue... whether to show 'enters' , 'leaves', etc. as all individual actions, or show a 'regions:' category, in which you can choose the verb

Same thing could apply to about every condition created


I think Even/Odd could be done by the Freq 0 and Freq 1 teams.

Also, I think that for clarity sake, the verbs should static and the nouns should be the options, as a general rule.

Cerium wrote:
Conditions:
variable is operator value

Actions:
move player at location to location
set variable to value


I don't know if we want to go so far down as to allow variable settings. Part of the problem would be that it's confusing to a lot of novice bot makers (i.e. people who don't know how to program), and while it wouldn't be incredibly hard to generate, it would complicate things. I'll add it to the list anyway, since I already have a lot of that functionality generated in the beta.
Back to top
View users profile Send private message Add User to Ignore List
Cerium
Server Help Squatter


Age:41
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Thu Feb 08, 2007 8:22 pm    Post subject: Reply to topic Reply with quote

Probably. The SC system had things called "Switches" which were basically just boolean variables. There was an action to set/clear/toggle a switch, and a condition to check the status of one. I was just trying to expand on that.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Wed Apr 18, 2007 12:53 am    Post subject: Reply to topic Reply with quote

Just wanted to let you guys know that I started work on a new MervGen tonight. The new design works on the trigger concept as described earlier, and will use a plug-in architecture so that you can create your own conditions and/or actions.

I just finished debugging the last part of the foundation (plug-in architecture, base classes). Next I'm going to start the actual code generator library that will hopefully make things easier for the plug-in developer.

However, this will have to wait for a week, as I'm a student at Virginia Tech and I am going home for the week to get away from all the craziness here.

I'll keep you all updated and will post a prototype as soon as possible.


Last edited by tansey on Wed Apr 18, 2007 7:52 am, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:36
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Wed Apr 18, 2007 2:11 am    Post subject: Reply to topic Reply with quote

Holy crap, I never knew I knew so many people at VTech until now....
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Tue Apr 24, 2007 2:33 am    Post subject: Reply to topic Reply with quote

I thought that before I get too far into this, it would be a good idea to throw out my current proof of concept design and get everybody's feedback.

Like I've said before, this is based on the concept of triggers (if a set of conditions is true, you carry out an associated set of actions). The current view for creating triggers looks like this:

Right clicking on one of the nodes in the tree will give you a context menu which will allow you to add an item. For example, right clicking on Conditions for trigger0 will give you the option to "Add a Condition." That will then pop up the following window to let the user choose a condition to add:

Note the name of the sample condition. Each condition or action is its own plug-in. The plug-in interface has all the properties shown in the example above.

Each plug-in contains a list of phrases, and each phrase contains a specific option for how the user can fill it in. For example, in the above picture there are 6 phrases: "Player ", "player", " enters region ", "region", " and has bounty greater than ", "bty". The "bty" phrase is of the type FillNumber, signifying that the user is able to input only numbers into that field. There is also a FillText type and a Select type (combo box of predefined choices).

The idea is that the application will then call GenerateCode for each plugin, and each plugin will add its own code to the library to be generated.

Thoughts?
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Tue Apr 24, 2007 5:54 am    Post subject: Reply to topic Reply with quote

Would you click the underlined "My Conditon Plugin" to edit the sentence using another dialog (not shown)? Just wondering because one line doesn't look like enough space.

Anyway, here are some screen caps from outlook express:

When you click an underlined word list:

When you click the options button:


I don't think you'll be needing word lists. But you can replace that with say coord selector. So it would be like:
When a player enters 'x1,y1,x2,y2' or 'x1,y1,x2,y2'

Note I didn't underline player, if I was following the outlook express style I would have player/team/arena in the top list.
_________________
ss news




screenshot

wordlist-options.png - 12.5 KB
File downloaded or viewed 30 time(s)

screenshot

wordlist.png - 9.44 KB
File downloaded or viewed 37 time(s)

screenshot

newmailrule.png - 23.06 KB
File downloaded or viewed 32 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Tue Apr 24, 2007 10:35 am    Post subject: Reply to topic Reply with quote

The "Select a Condition" dialog just gives the user a preview of the plugin. Then when you click on it in the tree view in the main MervGen form it will load the info into the panel on the left (currently just blank space in the screenshot) with an editable box among other things. Then clicking on an underlined word will pop up a dialog which allows you to edit that word according to its predefined setting. The pic is below:


I'm not quite sure what you're getting at with the Outlook examples. My idea was based more on chaining together items one-by-one, like this:

In your example:
When a player enters 'x1,y1,x2,y2' or 'x1,y1,x2,y2'
My approach would be to make 1 simpler plugin condition:
When a player enters 'x1,y1,x2,y2'
And then I would have the player add two of them to a trigger.

Would you mind expanding a little more on your idea?




WIIIScripEdit.jpg - 210.43 KB
File downloaded or viewed 38 time(s)

pic3.JPG - 12.84 KB
File downloaded or viewed 44 time(s)
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Tue Apr 24, 2007 5:23 pm    Post subject: Reply to topic Reply with quote

So you're saying one trigger can have many "plugin conditions"? To me it originally sounded like a separate merv plugin for each condition.

Seeing as you already have the real trigger editor to work from just ignore my screenshots, outlook filters can't do everything anyway.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Wed Apr 25, 2007 10:41 am    Post subject: Reply to topic Reply with quote

I'm almost done with the beta version. I've finalized the first version of the plugin interface, it's just a matter of writing the Merv C++ library code and then writing the generator which will produce the user-created bot.

I'd like your guys' feedback on the plugin interface though. The basic idea is that if you want to create a custom action or condition, you create a new IActionPlugin or IConditionPlugin. Your plugin is responsible for the text the user sees and edits, as well as for generating the required C++ code. I considered making code generation a little more structured, but I decided that this is simple enough that people should be able to follow a convention if it's well-documented.

This is also true for basic stats tracking, which will be automated and the plugins can simply make use of them. I will establish a convention for the variable types/names for each stats field, and methods which need them will know how to access them. The plugin is required to specify which stats it requires, and then MervGen will only generate the ones which are needed.

The PluginInterface is listed below:

Code: Show/Hide
public interface IPlugin
    {
        IPluginHost Host { get;set;}

        string Name { get;}
        string Description { get;}
        string Author { get;}
        string Version { get;}

        /// <summary>
        /// A string containing the code required to call this plugin's main method.
        /// The method call should start with "mervgen." since it will be placed inside
        /// of a class (MervGen) which will have an instantiated object named mervgen.
        ///
        /// i.e.: "mervgen.[name]([parameters])"
        /// </summary>
        string CallMethod { get;}

        /// <summary>
        /// A string containing the signature of this plugin's main method.
        ///
        /// i.e.: "[return type] [name]([parameters]);"
        ///
        /// Note that conditions should return bool and actions should return void by convention.
        /// </summary>
        string MethodSignature { get;}

        /// <summary>
        /// A string containing the definition of this plugin's main method.
        ///
        /// i.e.: "[return type] MervGen::[name]([parameters]) { [body] }"
        /// </summary>
        string MethodDefinition { get;}

        /// <summary>
        /// The list of phrases which will be displayed to the user.
        /// </summary>
        List<Phrase> Phrases { get;}

        /// <summary>
        /// The built-in stats that this plugin uses.
        /// </summary>
        List<Stats> RequiredStats { get;}

        /// <summary>
        /// The valid locations that this method can be called from.  This is used
        /// to determine where the method call(s) will be inserted in the generated
        /// code.
        ///
        /// For instance, a plugin which is concerned with where a player moves
        /// would likely have a single entry (PlayerMove) as its valid placement.
        /// </summary>
        List<Events> ValidPlacements { get;}

        void Initialize();
        void Dispose();

        /// <summary>
        /// Instructs the plugin to generate all source code based on the
        /// current state of its Phrases list.  The code to be generated is:
        ///
        /// - MethodSignature
        /// - MethodDefinition
        /// - Any extra methods, includes, or variables.
        ///
        /// MethodSignature and MethodDefinitions should be generated to their
        /// corresponding properties in the plugin.  All extra code should be added
        /// to the appropriate location in the PluginHost.
        /// </summary>
        void GenerateCode();
    }

    public interface IActionPlugin : IPlugin
    {
    }

    public interface IConditionPlugin : IPlugin
    {
    }

    public interface ITrigger
    {
        List<IActionPlugin> Actions { get; set; }
        List<IConditionPlugin> Conditions { get; set; }
        string Name { get; set; }
    }

    public interface IVariable
    {
        string Name { get; set; }
        string Type { get; set; }
        string Declaration { get; set; }
    }

    public interface IPluginHost
    {
        /// <summary>
        /// The triggers for this bot.
        /// </summary>
        List<ITrigger> Triggers { get; set; }

        /// <summary>
        /// The method signatures of any additional library methods which may need
        /// to be generated.
        /// </summary>
        List<string> LibraryMethodSignatures { get; set; }

        /// <summary>
        /// The method signatures of any additional library methods which may need
        /// to be generated.
        /// </summary>
        List<string> LibraryMethodDefinitions { get; set; }

        /// <summary>
        /// Any #include's (or #define's) which need to be included in the generated class.
        /// </summary>
        List<string> Includes { get; set; }

        /// <summary>
        /// Any fields which need to be generated in the class.
        /// </summary>
        List<IVariable> Variables { get; set; }
    }

    public enum Events
    {
        All,
        Tick,
        ArenaEnter,
        ArenaSettings,
        ArenaLeave,
        ArenaListEntry,
        ArenaListEnd,
        FlagGrab,
        FlagDrop,
        FlagMove,
        FlagVictory,
        FlagGameReset,
        FlagReward,
        TimedGameOver,
        SoccerGoal,
        BallMove,
        File,
        PlayerEntering,
        PlayerMove,
        PlayerWeapon,
        WatchDamage,
        PlayerDeath,
        BannerChanged,
        PlayerScore,
        PlayerPrize,
        PlayerShip,
        PlayerSpec,
        PlayerTeam,
        PlayerLeaving,
        SelfShipReset,
        SelfPrize,
        SelfUFO,
        PositionHook,
        BrickDropped,
        ObjectToggled,
        CreateTurret,
        DeleteTurret,
        ChatArena,
        ChatPublicMacro,
        ChatPublic,
        ChatTeam,
        ChatTeamPrivate,
        ChatPrivate,
        ChatPlayerWarning,
        ChatRemotePrivate,
        ChatServerError,
        ChatChannel,
        LocalCommand,
        LocalHelp,
        RemoteCommand,
        RemoteHelp,
        Init,
        Terminate
    }

    public enum Stats
    {
        PlayerDeaths,
        PlayerKills,
        PlayerShipChanges,
        PlayerFlagGrabs,
        PlayerFlagDrops,
        PlayerFlagVictories,
        PlayerFlagPoints,
        PlayerScore,
        PlayerKillPoints,
        PlayerDamageDealt,
        PlayerDamageReceived,
        PlayerTeamKills,
        PlayerMVP,
        TeamDeaths,
        TeamKills,
        TeamShipChanges,
        TeamFlagGrabs,
        TeamFlagDrops,
        TeamFlagVictories,
        TeamFlagPoints,
        TeamScore,
        TeamKillPoints,
        TeamDamageDealt,
        TeamDamageReceived,
        TeamTeamKills,
        TeamMVP,//Tracks the player with the most points in each team
        TeamMVT //Tracks the team with the most points
    }
Back to top
View users profile Send private message Add User to Ignore List
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Wed Apr 25, 2007 1:11 pm    Post subject: Reply to topic Reply with quote

Here is an example condition plugin (the one I used in the screenshots in earlier posts):

Code: Show/Hide
public class MyCondition : IConditionPlugin
    {
        #region IPlugin Members
        IPluginHost host = null;
        private string name = "My Condition Plugin";
        private string author = "Wes";
        private string description = "This is a test plugin to see if the MervGen plugin architecture works";
        private string version = "1.0";
        private List<Phrase> phrases = new List<Phrase>();
        private List<Stats> stats = new List<Stats>();
        private string callMethod = "mervgen.myConditionPlugin()";
        private string methodSignature = "bool myConditionPlugin();";
        private string methodDefinition = "bool MervGen::myConditionPlugin(){ return true; }";
        private List<Events> validPlacements = new List<Events>();

        public List<Events> ValidPlacements
        {
            get { return validPlacements; }
            set { validPlacements = value; }
        }

        public string MethodDefinition
        {
            get { return methodDefinition; }
            set { methodDefinition = value; }
        }

        public string MethodSignature
        {
            get { return methodSignature; }
            set { methodSignature = value; }
        }
       
        public string CallMethod
        {
            get { return callMethod; }
            set { callMethod = value; }
        }

        public IPluginHost Host
        {
            get { return host; }
            set { host = value; }
        }

        public string Name
        {
            get { return name; }
        }

        public string Description
        {
            get { return description; }
        }

        public string Author
        {
            get { return author; }
        }

        public string Version
        {
            get { return version; }
        }

        public List<Phrase> Phrases
        {
            get { return phrases; }
        }

        public List<Stats> RequiredStats
        {
            get { return stats; }
        }


        public void Initialize()
        {
            phrases.Add(new Phrase("Player "));
            List<string> options = new List<string>();
            options.Add("any player");
            options.Add("freq 0 player");
            phrases.Add(new Phrase("player", options));

            phrases.Add(new Phrase(" enters region "));

            options = new List<string>();
            options.Add("region1");
            options.Add("region2");
            phrases.Add(new Phrase("region", options));
            phrases.Add(new Phrase(" and has bounty greater than "));
            phrases.Add(new Phrase("bty", OptionType.FillNumber));

            validPlacements.Add(Events.All);
        }

        public void Dispose()
        {
           
        }

        public void GenerateCode()
        {
           
        }

        #endregion
    }
Back to top
View users profile Send private message Add User to Ignore List
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Thu Apr 26, 2007 5:49 pm    Post subject: Reply to topic Reply with quote

I've been reading up on the way ASSS plugins work and I think it could be possible to apply this system to both Merv and ASSS...would there be any interest in this?
Back to top
View users profile Send private message Add User to Ignore List
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:36
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Thu Apr 26, 2007 9:08 pm    Post subject: Reply to topic Reply with quote

Definitely. A lot of developers are scared of AS3, and something like this might really help to change that.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Fri Apr 27, 2007 5:00 am    Post subject: Reply to topic Reply with quote

Ok a few questions now.
- What does myConditionPlugin() get used for? Some time during code generation?

- Would it be better to initialise phrases = new List<Phrase>(); inside Initialize() incase it gets called twice?

- What does validPlacements.Add(Events.All); do? Would it have been ok to use just movement and bounty change events for this particular condition?

- What does #region IPlugin Members and #endregion do?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Fri Apr 27, 2007 9:59 am    Post subject: Reply to topic Reply with quote

Smong wrote:
Ok a few questions now.
- What does myConditionPlugin() get used for? Some time during code generation?


Kind of. The idea is that each plugin generates a method which will be called at the specified event. By convention, an action plugin returns void and a condition plugin returns a bool. So wherever the trigger that MyConditionPlugin belongs to is going to check its conditions, it will call myConditionPlugin() in the generated code.

So if this was the only condition to the trigger, then the generated code would have (assuming its valid placement was player move and bounty change like you pointed out below):
Code: Show/Hide
case EVENT_PlayerMove:
      {
         Player *p = (Player*)event.p[0];
         if(mervgen.myConditionPlugin())
         {
            ...(actions for the trigger called here)
         }
      }


And you'd have an identical setup for the bounty changed event.

Smong wrote:

- Would it be better to initialise phrases = new List<Phrase>(); inside Initialize() incase it gets called twice?


Yes. This was just a very quick and dirty solution. In reality, Initialize should only be called once by the container, but I suppose that a good practice would be to assume it could be called more than once.

Smong wrote:

- What does validPlacements.Add(Events.All); do? Would it have been ok to use just movement and bounty change events for this particular condition?


Yes. I just threw that in to show how you add valid placements. If this were a real plugin, it would make more sense to put it in those 2 events instead.

Smong wrote:

- What does #region IPlugin Members and #endregion do?


The code is C#. #region and #endregion define sections that you can collapse/expand in visual studio. It really helps to clean up code.
Back to top
View users profile Send private message Add User to Ignore List
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Mon Jul 09, 2007 2:51 pm    Post subject: Reply to topic Reply with quote

If anyone is interested in this project still, I can post it on CodePlex. I know how to resolve all the issues I had a few months ago, it's just a matter of interest at this point.
Back to top
View users profile Send private message Add User to Ignore List
Aquarius
Guest


Offline

PostPosted: Sat Sep 08, 2007 10:17 am    Post subject: Yes Reply to topic Reply with quote

I was reading this whole post, thinking to myself, "wish this was for AS3, wish this could make Python modules"

Please do!
Back to top
JESUS
Guest


Offline

PostPosted: Sat Sep 22, 2007 2:11 am    Post subject: Reply to topic Reply with quote

WORK ON THIS
Back to top
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Sat Sep 22, 2007 8:40 am    Post subject: Reply to topic Reply with quote

Quote:
WORK ON THIS
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Misc User Apps All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 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: 641 page(s) served in previous 5 minutes.

phpBB Created this page in 0.501487 seconds : 46 queries executed (77.5%): GZIP compression disabled