Thursday, June 29, 2017

Reflection

hi all,

John Dewey, the famous educator and philosopher, once said that we don't learn from experience, but by reflecting on experience.


In programming, reflection, as I in my extremely limited way, understand it, refers to the ability of code to examine itself and report its findings, and to alter itself at runtime. There are a large number situations where you might want a program to be able to do this, but in my own case it comes from working on my never finished quest system. When I design a quest, I want to be able to set up what conditions and events the quest should pay attention to, how it should change when particular events are met, etc, like in this image from Wolcen Lords of Mayhem's blog post.

One of the ways you can do this, in my opinion one of the more sensible ones, is to use reflection to generate a list of classes or objects which might contain events or conditions you are interested in, then from that list generate lists of events in those classes or objects. Why not just hard-code it? Because hard-coding is EVIL! Really, though, what if you hard code your list of classes and realize that you left out one class? In a full game project, keeping (in your head) a 100% accurate list of classes that are relevant to the task at hand is impossible. Even in my incomplete project, which has almost zero gameplay, and includes a massive TWO characters and ONE item, contains more than 40 scripts. Most of those, of course, deal with the quest system and node editor, but sorting through the other classes by hand is a recipe for disaster.

Same goes for finding the events. If you try to hand code it, what if you make a spelling mistake for one of the events? You might not catch it and your compiler might not catch it until you're playing the game and you get a bug. So, here is some code that does just that. I create a dictionary using strings as the key and storing a list of strings as the value. The key is the class name, and the list of strings is the events found in that class.

Dictionary < string , List  < string  > > targetclasses;
Assembly assem = Assembly.GetExecutingAssembly();
   Type[] types = assem.GetTypes().Where(t => string.Equals(t.Namespace, "QuestSystem", StringComparison.Ordinal) && t.BaseType != typeof(MulticastDelegate) && t.BaseType != typeof(ScriptableObject)).ToArray();
   for (int i = 0; i < types.Length; i++)
   {
    FieldInfo[] fields = types[i].GetFields();
    EventInfo[] events = types[i].GetEvents();
    if (events.Count() > 0)
    {
     List temp = new List();
     for (int j = 0; j < events.Count(); j++)
     {
      //Debug.Log(events[j].Name);
      temp.Add(events[j].Name);
     }
     targetclasses.Add(types[i].Name, temp);
    }

   }

   }



After you select the class and event, the game system will serialize your choice as a string. When you start the system up again, it can deserialize these events (which are just stored as strings) and rehook them up to their appropriate targets using reflection again.

Wednesday, June 28, 2017

Google Autocomplete

Morning all,

I've started making the rounds of companies yet again. While waiting for replies, I went back to watching tutorials and trying to inch forward on my own small RPG project. In the course of doing research, I of course turned to google, which helpful gave me these suggestions:



I wanted to ask "Can you have delegates in a scriptable object?" but as you can see there were more popular options.

Sunday, June 25, 2017

Rediscovery of Purpose

hey all,

Ever since I posted my Digestion game on Itch.io at the end of May I've been in something of a slump. I cannot even quickly count the number of different projects I've started and abandoned in that period. As a few examples:

  •  I began a test project to try to develop something like Total War's unit manager system to control the movement, pathfinding, and orientation of soldiers

  • I went back to my old node editor to try and mash it together with my quest system
  • I started watching tutorials about making game object databases, dialog editors, and quest managers
  • I went back to a radial progress bar script I had made months ago and tried to improve it
  • I went back a turn-based strategy game and started sprucing that up for a gamejam
  • In line with the previous entry, I learned a little more about 3D modelling using Blender to make a simple plant model
For the whole month of June, I didn't even bother checking or making events on my calendar. Normally, I'd schedule at least a week out in advance so that each morning's tasks would not be left to whim or chance. So, I've gone back into my calendar and started scheduling events and tasks again, but at this time it is mostly continuing several of the above projects. The gamejam at least has some potential to get my name out there among other developers.

The more work I put into game development, the more I realize that there is still more for me to learn. And the farther away my goal of making my own indie smash hit like Mount & Blade: Warband  seems.

Thursday, June 22, 2017

Quest System and Node Editor

hey all,

Here is a short video showing some of what I've been working on for the last few weeks.



Wednesday, June 14, 2017

E3 and Other Items

hey all,

This week is the annual E3 convention in Los Angeles. Normally, I'd be spending hours going over videos to check out the latest games, but I'm finding myself a little underwhelmed by the offerings. Creative Assembly have released some footage of the second game in the Total War: Warhammer series, which looks pretty good. And finally Taleworlds has released a bit more information about Mount & Blade II: Bannerlord, but that's about it.

Where are the innovative titles? Where are the new IPs that we will fall in love with?

Anyway, working on the plant game inspired me to sign up for a gamejam, which will be my first ever. The theme is growth, and I plan on using the plant game as the starting point.

I didn't receive the position working on the SF RPG, but as I said, I still plan on refining the tools that I started to work on and using them for my own projects.

Cheers,

Thursday, June 8, 2017

The Future

The last week has been draining. No word from the company that was supposedly so interested in my digestion game.

Instead, I've been working on a coding test for a startup company that plans on making a SF RPG game. It is only a part-time job and sounds really cool, but it is crowd-funded. That means they will be asking people to make donations, and if enough people make donations to support development, then development will begin in earnest. However, their crowd-funding campaign will not begin until 2018, which means that I could potential spend 480 hours (6 months X 4 weeks X 20  hours per week) coding and developing the backend of their RPG without ever seeing a penny. Of course, just completing the coding test I learned a lot and refined some of the tools in my limited programmer's tool box, and I only spent about 20 hours on it, so 480 hours could take me to a whole new level of competence. In any case, it has been really fun working on the coding test, and even if I don't receive the position, I am thinking that I will still be able to use that code for my own projects.

In the meantime, I think I will go back to some of my other small projects like my plants evolution game.