Indie House Vancouver

  • rss
  • archive
  • Messing around with some platformery stuff with Alec and Matt.
-Noel

    Messing around with some platformery stuff with Alec and Matt.

    -Noel

    • 5 days ago
    • 3 notes
  • New TowerFall screenshots, from the freshly redesigned website!

    • 1 week ago
    • 2 notes
    • #matt
  • towerfall:

    Updated www.towerfall-game.com with new info, screenshots, and this new gameplay video!

    Source: towerfall
    • 1 month ago
    • 12 notes
    • #Matt
  • Custom Coroutines in C#

    Coroutines Rock!

    I’m currently developing a game in C# using MonoGame. It’s been great so far, I really love this language and the features it has.

    One thing I’ve found myself missing from my home grown C# engine though is a simple Coroutine system, one like Unity has.

    Read the pages linked above to learn a bit more about how Coroutines work if you haven’t used them before. But basically, they provide an awesome tool for controlling logic flow in your game, and are wonderful for managing things like scripted/sequential events, behavior trees, and motion tweening.

    So to gain this power back, I wrote my own Coroutine system in C#, and I’ve written it into a nice little standalone class that anyone is welcome to use in their own projects if they like!

    Coroutines.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Collections;
    
    public class Coroutines
    {
        List routines = new List();
    
        public Coroutines()
        {
    
        }
    
        public void Start(IEnumerator routine)
        {
            routines.Add(routine);
        }
    
        public void StopAll()
        {
            routines.Clear();
        }
    
        public void Update()
        {
            for (int i = 0; i < routines.Count; i++)
            {
                if (routines[i].Current is IEnumerator)
                    if (MoveNext((IEnumerator)routines[i].Current))
                        continue;
                if (!routines[i].MoveNext())
                    routines.RemoveAt(i--);
            }
        }
    
        bool MoveNext(IEnumerator routine)
        {
            if (routine.Current is IEnumerator)
                if (MoveNext((IEnumerator)routine.Current))
                    return true;
            return routine.MoveNext();
        }
    
        public int Count
        {
            get { return routines.Count; }
        }
    
        public bool Running
        {
            get { return routines.Count > 0; }
        }
    }
    

    A Simple Example

    One major difference between this coroutine system and Unity’s is that when you yield, you don’t need to call StartCoroutine(), you can just call the routine function itself, making the syntax actually a bit cleaner to use than Unity’s. Nice!

    Anyways, here’s a simple example. If you want to try it out, either in MonoDevelop or Visual Studio, start a new Console Application and past this code as the main program and give it a run!

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Collections;
    using System.Diagnostics;
    
    namespace
    {
        class Program
        {
            //"Death" by John Donne
            const string poem = "\"Death\" by John Donne\n\n" +
                                "Death be not proud, though some have called thee\n" + 
                                "Mighty and dreadfull, for, thou art not so,\n" + 
                                "For, those, whom thou think'st, thou dost overthrow,\n" + 
                                "Die not, poore death, nor yet canst thou kill me.\n" + 
                                "From rest and sleepe, which but thy pictures bee,\n" + 
                                "Much pleasure, then from thee, much more must flow,\n" + 
                                "And soonest our best men with thee doe goe,\n" + 
                                "Rest of their bones, and soules deliverie.\n" + 
                                "Thou art slave to Fate, Chance, kings, and desperate men,\n" + 
                                "And dost with poyson, warre, and sicknesse dwell,\n" + 
                                "And poppie, or charmes can make us sleepe as well,\n" + 
                                "And better then thy stroake; why swell'st thou then;\n" + 
                                "One short sleepe past, wee wake eternally,\n" + 
                                "And death shall be no more; death, thou shalt die.";
    
            static void Main(string[] args)
            {
                var coroutines = new Coroutines();
                coroutines.Start(ReadPoem(poem));
                while (coroutines.Running)
                    coroutines.Update();
            }
    
            static IEnumerator ReadPoem(string poem)
            {
                //Read the poem letter by letter
                foreach (var letter in poem)
                {
                    Console.Write(letter);
                    switch (letter)
                    {
                        //Pause for punctuation
                        case ',':
                        case ';':
                            yield return Pause(0.5f);
                            break;
    
                        //Long pause for full-stop
                        case '.':
                            yield return Pause(1);
                            break;
    
                        //Short pause for anything else
                        default:
                            yield return Pause(0.05f);
                            break;
                    }
                }
    
                //Wait for user input to close
                Console.WriteLine("\nPress any key to exit");
                Console.ReadLine();
            }
    
            static IEnumerator Pause(float time)
            {
                var watch = Stopwatch.StartNew();
                while (watch.Elapsed.TotalSeconds < time)
                    yield return 0;
            }
        }
    }
    
    • 2 months ago
    • 1 notes
    • #chevy
  • Ingredients

    For the fun of it, today I asked on twitter, “What’s the one thing, above all else, that makes a game enjoyable for you? ONE thing, and not one lack of thing. :) I want to know.”

    Here are some of the answers I got:

    @Sosowski: Smoothness and fluency of gameplay

    @usdaproved: Passion put into it

    @Capn_Andy: A really deep cause/effect feedback system

    @KunoNoOni: a good story

    @dphrygian: Having enough range in the mechanics for me to make meaningful choices

    @dufflebagus: Meaningful choice

    @a___k: Attention to detail

    @randomnine: discovery

    @limbclock: I mostly play games for the stories they tell

    @saint11: for me it’s probably meaningful choices

    @herebejoshua: - Great atmosphere

    @championchap: surprise

    @mattfox12: Progression/variety. New things at regular intervals

    @iandioch: when you can tell that the developer/s loved making it

    @rje: Exploration

    @nickyonge: I play games to explore their worlds

    @NeoshamanTamago: GOOD and SATISFYING controls

    @isoiphone: Whatever action I take needs to have a obvious and interesting effect on the world

    @iBrent: Re-playability

    @biphenyl: The sense of wonder coming from exploration

    These are only some of the answers. The most commonly occurring phrases in the responses were: exploration, meaningful choices, and story.

    • 2 months ago
    • 2 notes
    • #chevy
  • MiniJam #3 at Indie house. This is games being made.

    MiniJam #3 at Indie house. This is games being made.

    • 3 months ago
    • 1 notes
  • Some variations on a little pixel girl.

EDIT: lol apparently Tumblr thinks it’s a great idea to blow that image up a million times. Whatever.

    Some variations on a little pixel girl.

    EDIT: lol apparently Tumblr thinks it’s a great idea to blow that image up a million times. Whatever.

    • 3 months ago
    • 5 notes
    • #CHEVY
    • #ART
  • Thank you var-y much!

    Quite often when helping students or novice developers with C# Unity code, I’ll be showing them something and will type out a piece of code something like this…

    var toPlayer = player.position - transform.position;
    

    I am often interrupted here with a concern, “Wait, isn’t var for JavaScript only?”

    Actually, you’ll notice if you try to compile this, it will work just fine. I’m surprised more people don’t use var, as I find it quite handy to use in C#, and it doesn’t affect the performance of my code at all.

    Vector3 a = new Vector3(1, 2, 3);
    var a = new Vector3(1, 2, 3);
    

    The above two lines of code compile down to the exact same thing. The only difference is how they’re compiled: the first is explicitly typed, meaning I’ve said “this is a Vector3 no matter what!”, and the second is implicitly typed.

    An implicitly typed variable means the compiler will assume the type based on context. Here, it will examine the line, see that I’m assigning var a to a Vector3, and give it that type.

    You can assure yourself of this by typing “a” followed by the “.” accessor, and seeing the code-sense in MonoDevelop pop up showing all the member vars and methods of the Vector3 struct. (If MonoDevelop can detect the type of the var at runtime, certainly the compiler can figure it out!)

    Sometimes var can be super useful. For example, let’s say I have the following:

    //Let us assume this array is actually populated and not empty
    GameObject[] targets = new GameObject[10];
    
    foreach (GameObject target in targets)
    {
        //do something with target
    }
    

    Works nice. (I rather like the foreach loop, it looks very clean and I prefer it to i-indexed for loops.)

    But what happens if I want to change the type of this array from GameObject to something else, like Transform for example?

    //Let us assume this array is actually populated and not empty
    Transform[] targets = new Transform[10];
    
    foreach (Transform target in targets)
    {
        //do something with target
    }
    

    I had to change that small bit of code in 3 places. Whereas if I’d used var to my advantage here, the identical code looks like this:

    //Let us assume this array is actually populated and not empty
    var targets = new Transform[10];
    
    foreach (var target in targets)
    {
        //do something with target
    }
    

    Now, Transform is only identified in one place, so I can easily change the array type, and the rest of the code is compiled with that knowledge.

    Admittedly, some programmers may not like this, they like being able to examine the type of a variable at any given point, and var might feel too “script-ey” for them. That’s understandable, I love using it because I can type code faster, and usually have no problem following the types of variables in small, bite-sized chunks like the above (whether it be mine or somebody else’s).

    Just know that var is not dynamic, it still compiles down to strictly-typed variables, it just saves you the typing.

    • 3 months ago
    • 4 notes
    • #Chevy
    • #Unity
  • Spawn Patterns

    I’m currently working on a contract Flash game as a programmer, and one of the fun things about designing this project has been managing as much of the game’s tweakable variables via external text files.

    Because I’m working with a game designer, it’s nice for him to be able to edit the values and re-test the game without having to know how to compile or find the variables in my rather large code base, so I’ve chosen XML for the task. This is because it embeds and reads nicely in ActionScript 3, and throws useful errors when an incorrectly formatted document is embedded.

    So for example, the Ranks.xml file, where I load in information about the different ranks you can unlock, looks like this:

    <Ranks>
        <Rank name="Apprentice" exp="0" />
        <Rank name="Rookie" exp="100" weapon="Pistol" />
        <Rank name="Rookie I" exp="250" perk="Commando" />
        <Rank name="Rookie II" exp="500" combo="Air Assault" />
    

    Here you can see the different ranks listed, how much experience is required to achieve that rank, and possible weapon, perk, or combo unlocks.

    Enemy spawning was a bit trickier, though. I wanted the designer to have fine control over the frequency and types of enemies that spawned during different waves, but keep it in a format that was easy to modify without jumping into the game code.

    What I came up with basically uses a single text string for every wave, that denotes a looping pattern that denotes what spawns while that wave is active. Here are some examples of these patterns:

    A, B, C
    A*3, [B, B], C
    A*2, B, {B, C}, C
    { (A*5), (B*5) }
    

    So here’s how these strings work:

    INDICATORS:
    A, B, C, etc. (I use more descriptive words in the actual files)
    
    EXPRESSIONS:
    (A, B, C)       Spawn the whole set in sequence (one after another)
    [A, B, C]       Spawn the whole set at once (simultaneously)
    {A, B, C}       Choose just one in the set to spawn (random)
    X*n             Repeat "X" n-times
    

    So if the spawn frequency is set to 1 second, here’s how the timeline for each of the above patterns would look:

    A, B, C
        An A, then a B, then a C
    
    A*3, [B, B], C
        Three As, then two simultaneous Bs, then a C
    
    A*2, B, {B, C}, C
        Two As, then a B, then either a B or a C, then a C
    
    { (A*5), (B*5) }
        Either five As or five Bs
    

    So basically these flatten into a single array of letters (or enemy types). As you can see by the final pattern, these expressions can easily be nested. You can also multiply expressions, so for example…

    (A, B) * 5
    

    …would flatten out to…

    A, B, A, B, A, B, A, B, A, B
    

    Making it really easy to describe pretty elaborate patterns with a nice shorthand syntax! Also, the { } random (or what I call the choose) expressions allow the designer to take advantage of randomness to keep things unpredictable.

    The choose expression also lets me describe probabilities adequately, though it might not seem obvious how at first. It basically looks like this:

    { A*7, B*3 }
        70% chance of A and 30% chance of B
    

    Pretty cool, huh? These are parsed by a simple set of AS3 classes, and are generic so they can be used for other projects. If you are interested in using them or want to try them out, just email me and I can share the source code with you.

    • 3 months ago
    • 4 notes
    • #Chevy
  • Sunday night, made a delicious lamb stew with our new cast-iron stewpot, then gave my new brush pens a test run by drawing a little witch girl.

    • 3 months ago
    • #Chevy
© 2013 Indie House Vancouver
Next page
  • Page 1 / 2