Users browsing this thread: 12 Guest(s)
MFGG TKO DevLog - TSG Left
#8
@Phaze and Kosheh:
The game is really only going to be released here and on mfgg. If someone makes a cheap character, then don't play with them. I think that's a easier solution than putting in fake limits. It just doesn't feel right and would probably be more trouble to tweak than it's worth.

Devlog #1

I spent the day moving the character Mit's subaction data over to lua. Everything works fine which is awesome. Moving the movesets out to lua allows so much more ease especially since lua has coroutines. Which basically means I can run a function over time instead of doing it all in one go. It's easier to do in lua than c#. In c#, I just used a behavior tree which basically does something similar. It's also bit uglier when trying to use general variables between 'events'/functions within even the same subaction which wasn't even possible the way I had it set up at first. A few months ago, I even went as far making a cache and wrappers of primitive types for custom variable use. It worked...but it was so ugly..... Anyways, lua allows people to create and use custom variables to do whatever they want and share them between other subactions and throughout the subaction itself without any weird code or ugliness (run on?? heh). I still gotta move all the events out to lua to which is easy, but annoying.

Heres what the first punch looks like in c#:

I also fixed a rendering issue I had with layering a while ago and I also added support for camera shake yesteryday.

GIFS
-Mit's subactions are all in lua in the above gifs

Lua shouldn't be too hard to learn. Really, if you don't plan on doing anything fancy, all you'd have to know in order to make a custom moveset is the list of events that I coded.

---------------------------------------------------

I also made a very simple string file format a few days ago since I needed a quick and easy format to export data from blender to (has nothing to do with this) It's very easy to read in and write out. For those who need a simple save file format, here it is:

Code:
Description
         * each block begins with "{", "}" (on a lone line)
         * a block's properties follow (without quotes, separate line) : "PropName=PropVal"
         * note* the properties just have to be in the same '{','}' block,
         *         they don't have to be in any order
         *
         * block interpretation:
         *
         * each block has atleast "BlockTag" property to easily ID it
         * nested blocks are children of the parent block
Code:
Example:
{
     BlockTag = Player
     Name = TheShyGuy
     Level = -1
      {
            BlockTag = Stat
            Name = Health
            Value = 10
      }
      {
            BlockTag = Stat
            Name = Defence
            Value = 5
      }    
}

Reading the file into an intermediate structure:

Code:
/// <summary>
        /// Reads a block along with it's nested children.
        /// The file format's properties do not have to be in order.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private static Block ReadBlock(StreamReader reader)
        {
            Block result = new Block();

            string line = reader.ReadLine();

            //keep reading until I hit the closing bracket
            while (!line.Equals("}"))
            {
                //If I hit an opening bracket, then the following lines
                //are of a new nested child block
                if (line.Equals("{"))
                    result.ChildBlocks.Add(ReadBlock(reader));
                else if(!string.IsNullOrWhiteSpace(line))
                {
                    //or else the following line is a property.
                    string[] split = line.Split('=');
                    string key = split[0];
                    string val = split[1];

                    result.Properties.Add(key, val);
                }

                line = reader.ReadLine();
            }

            return result;
        }
        private class Block
        {
            private const string BLOCKTAG = "BlockTag";

            public string this[string key]
            {
                get
                {
                    return Properties[key];
                }
            }

            public Dictionary<string,string> Properties;
            public List<Block> ChildBlocks;

            public Block()
            {
                this.Properties = new Dictionary<string, string>();
                this.ChildBlocks = new List<Block>();
            }

            public string GetTag() { return Properties[BLOCKTAG]; }
            public bool IsType(string tagType) { return GetTag() == tagType ; }
        }

Aaand finally converting the intermediate format, the blocks, into the game data:

Code:
public Player LoadPlayerFile(...)
{
     StreamReader reader = ...
     Block rootBlock = ReadBlock(reader);

     if(rootBlock.IsType("Player"))
         return ParsePlayer(rootBlock)
     else
          //throw exeception since the file wasn't a player file
}

private Player ParsePlayer(Block block)
{
     Player player = new Player();
     player.Name = block["Name"] // player.Name = block.Properties["Name"] = "TheShyGuy"
     player.Level = int.Parse(block["Level"]) //don't forget to convert the string to int
    
     foreach(Block childNode in block.ChildBlocks)
     {
          if(childNode.IsType("Stat"))
               player.Stats.Add(ParseStat(childNode)) //Adds health and defence stats
          else
               ThrowNotSupportedBlock(block.GetTag(),childNode.GetTag())
     }
}
private Stat ParseStat(Block block)
{
     Stat stat = new Stat()
     stat.Name = block["Name"]
     stat.Value = int.Parse(block["Value"])
    
     return result;
}
private static void ThrowNotSupportedBlock(string blockTag, string childTag)
{
      throw new Exception(string.Format("{0} block does not support blocks of type {1}",blockTag,childTag));
}

And there we go. The format is simple to write to and read from especially since it's recursive. The block intermediate format allows you to easily parse the properties into your game object properties. People can use this if they want, no credit needed but it would be appreciated if you notify me that you used it.
Animations - MFGG TKO (scrapped) - tFR
[Image: QUmE6.gif]
"It feels that time is better spent on original creations" - Konjak
Focus on the performance, the idea, not the technical bits or details - Milt Kahl
Thanked by: Kami


Messages In This Thread
MFGG TKO DevLog - TSG Left - by TheShyGuy - 01-10-2014, 07:10 PM
RE: Mfgg TKO DevLog - by Neweegee - 01-10-2014, 09:09 PM
RE: Mfgg TKO DevLog - by TheShyGuy - 01-10-2014, 10:10 PM
RE: Mfgg TKO DevLog - by Dazz - 01-11-2014, 10:43 AM
RE: Mfgg TKO DevLog - by TheShyGuy - 01-11-2014, 06:27 PM
RE: Mfgg TKO DevLog - by Kosheh - 01-11-2014, 12:20 PM
RE: Mfgg TKO DevLog - by Phaze - 01-12-2014, 02:33 AM
RE: Mfgg TKO DevLog - by TheShyGuy - 01-13-2014, 01:02 AM
RE: Mfgg TKO DevLog - by TheShyGuy - 01-15-2014, 03:01 AM
RE: MFGG TKO DevLog - by TheShyGuy - 01-17-2014, 01:52 AM
RE: MFGG TKO DevLog - by Mit - 01-20-2014, 11:23 PM
RE: MFGG TKO DevLog - by TheShyGuy - 01-24-2014, 08:21 PM
RE: MFGG TKO DevLog - by TheShyGuy - 01-27-2014, 12:34 AM
RE: MFGG TKO DevLog - by TheShyGuy - 02-01-2014, 05:04 PM
RE: MFGG TKO DevLog - by TheShyGuy - 02-17-2014, 05:47 PM
RE: MFGG TKO DevLog - by MC Jimmy - 02-17-2014, 07:50 PM
RE: MFGG TKO DevLog - by TheShyGuy - 02-18-2014, 05:20 PM
RE: MFGG TKO DevLog - by Mit - 02-19-2014, 08:10 PM
RE: MFGG TKO DevLog - by Mit - 03-06-2014, 03:43 PM
RE: MFGG TKO DevLog - by TheShyGuy - 03-23-2014, 06:01 PM
RE: MFGG TKO DevLog - by TheShyGuy - 04-12-2014, 02:52 PM
RE: MFGG TKO DevLog - by TheShyGuy - 04-17-2014, 03:01 PM
RE: MFGG TKO DevLog - TSG Left - by TheShyGuy - 05-03-2014, 03:00 PM
RE: MFGG TKO DevLog - TSG Left - by Kelvin - 05-06-2014, 08:40 PM
RE: MFGG TKO DevLog - TSG Left - by TheShyGuy - 05-06-2014, 09:10 PM
RE: MFGG TKO DevLog - TSG Left - by Kelvin - 05-06-2014, 09:51 PM
RE: MFGG TKO DevLog - TSG Left - by TheShyGuy - 05-06-2014, 09:56 PM
RE: MFGG TKO DevLog - TSG Left - by Kelvin - 05-07-2014, 11:31 AM

Forum Jump: