Simply Pointless

But hey, why not?

By

A Short Introduction To Finite-State Machines

… written by Fernando Bevilacqua back in 2013 can be found over at TutsPlus.

By

A Cyberstorm Is Coming

Ok, hands up everybody who is old enough to remember Missionforce Cyberstorm. Ah, I see. Well, for those of you who have never heard of it, MFCS was a turn-based mech strategy game which took a lot of inspiration from the Battletech board games but got released long before the latter’s Mech Commander, and up until today that remains a genre with painfully few entries.

However, as the indie scene and crowdfunding platforms taught us in the recent past it’s only a matter of time until even the most underserved niche receives its long overdue update. Enter developer toasticus aka Zack Fowler who took it upon himself to breathe life into the genre again with his yet nameless entry. Previous projects he has worked on include Firaxis’ XCOM reboot so he probably knows a thing or two about turn-based strategy games.

Today Zack shared a video showcasing the current state of his game. While that alone should be interesting for (semi) old farts like us, the main reason I mention this is that the video features background music by yours truly. :)

Bouncing ideas back and forth with Zack has been great fun so far, and I hope we will continue to do so in the future.

By

Pool Of Randomness

For my current Unity project I had to convert Kipp Ashford’s Weighted Array script into something I could use in my C# environment. I had a similar solution already working in ISIS but Ashford’s script was much more elegant since it includes a number of useful functions my bare-boned version was lacking.

A clever (or so I hope) use of a hashtable allowed me to trim some of the variables the orginial script had used to keep it as slim as possible.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// WeightedRandomPool.cs
// 2013-10-09 by Thomas Touzimsky
// http://www.simplypointless.com/
//
// Adds, deletes and returns a random item from a pool of objects based on each item's associated weight
//
// A conversion of the original JS script by Kipp Ashford
// http://blog.teamthinklabs.com/index.php/2011/08/23/grabbing-items-from-an-array-based-on-probability/
 
using UnityEngine;
using System.Collections;
 
public class WeightedRandomPool
{
 
    // Our pool is stored in a hashtable where
    // key   = (Object)item
    // value = (int)weight
    public Hashtable htItems = new Hashtable();
 
 
    /// <summary>
    /// Adds a new item to the hashtable or changes its weight if has been added before
    /// </summary>
    /// <param name="item">The object you want to add to the pool</param>
    /// <param name="weight">The object's weight within the pool</param>
    public void Add(Object item, int weight)
    {
        if (!htItems.ContainsKey(item))
        {
            htItems.Add(item, weight);
        }
        else
        {
            Debug.Log("WeightedRandomPool::Add() --- WARNING: Object is already added. Changing weight of object instead.");
 
            htItems[item] = weight;
        }
    }
 
 
    /// <summary>
    /// Changes the weight of an object within the pool
    /// </summary>
    /// <param name="item">The object whose weight you want to change</param>
    /// <param name="nWeight">The object's new weight within the pool</param>
    public void ChangeWeight(Object item, int nWeight)
    {
        if (htItems.ContainsKey(item))
        {
            htItems[item] = nWeight;
        }
        else
        {
            Debug.Log("WeightedRandomPool::ChangeWeight() --- WARNING: Object '" + item + "' is not a member of this pool.");
        }
    }
 
 
    /// <summary>
    /// Removes an object from the pool
    /// </summary>
    /// <param name="item">The object you want to remove</param>
    public void Remove(Object item)
    {
        if (htItems.ContainsKey(item))
        {
            htItems.Remove(item);
        }
        else
        {
            Debug.Log("WeightedRandomPool::ChangeWeight() --- WARNING: Object '" + item + "' is not a member of this pool.");
        }
    }
 
 
    /// <summary>
    /// Returns a randomly chosen object from the pool depending on all members' weight
    /// </summary>
    /// <returns></returns>
    public Object Get()
    {
        int nSumOfWeights = 0;
 
        foreach (DictionaryEntry item in htItems)
        {
            nSumOfWeights += (int)item.Value;
        }
 
        int k = Random.Range(0, nSumOfWeights + 1);
        // +1 to make sure we can actually find the last item if it has a weight of 1
        // since Random.Range never hits the maximum value
 
        foreach (DictionaryEntry item in htItems)
        {
            // walk the pool one item at a time and see whether its weight is lower than k
            // if yes, return the current item ; if no, subtract the item's weight from k
 
            // if, for example, the pool includes three items with a weight of 40/40/60 and
            // k = 70, the first loop's result will be negative and k gets reduced by 40;
            // the next loop's result is positive since k (now 30) is lower than the second
            // item's weight
 
            if (k > (int)item.Value)
            {
                k -= (int)item.Value;
            }
            else
            {
                return (Object)item.Key;
            }
        }
 
        return null;
    }
 
 
    /// <summary>
    /// Clears the pool
    /// </summary>
    public void Clear()
    {
        htItems.Clear();
    }
 
}

The class itself is used just like Ashford’s original.

WeightedRandomPool myPool = new WeightedRandomPool();
 
myPool.Add(myFirstItem, 15);
myPool.Add(mySecondItem, 5);
myPool.Add(myThirdItem, 2);
 
UnityEngine.Object myRandomItem = myPool.Get();

Feel free to suggest any ideas on how to improve the script – after all, I am still a novice coder. :)

By

Take A Walk On The Tiled Side

Came across a great write-up by Rodrigo Monteiro on the many ways of how to deal with moving characters in a 2D environment and the many obstacles one has to tackle when faced with slopes, moving platforms or ladders.

The Guide To Implementing 2D Platformers

Unfortunately his website hasn’t been updated in a year, but I hope he’s just busy coding at the moment.

By

Knee-Deep In The… Eucalyptus Oil?

Today’s addition to my shelf is one of the classic video game releases – id Software’s Doom. While in rather good shape for its age, the box came with some sticker residues on it, but I successfully managed to get it all off without damaging the box…

I love the smell of a hot herbal bath in the morning!

… thanks to a suggestion I read on a forum of fellow video game collectors. Applying a bit of eucalyptus oil to the residue makes it easy to remove it while keeping the box intact. And it doesn’t smell too bad either.

By

WCRI – A Round-Up

Now that we have a thread about collecting old PC games over at the RPS forums, I decided I should upload some pictures of the current collection rather than posting a long list of names.

By

We Can Rebuild It – January Edition

More goodies to fill up shelf space. Seems like the only big box edition of Turrican II was the PC release, but that’s misssing some of the outer artwork. Also, Golden Axe, North & South and a still shrinkwrapped box of Machines (“Rrrrreaper online!”).

Size doesn’t matter.

Furthermore here’s the (new to me) long box edition of the first Command & Conquer which I think looks much better than the Worldwide Warfare edition. The latter comes with Red Alert (+ expansions) and the soundtrack, but since I already got the latter and want a proper box of Red Alert I gave in and bought this one instead.

Three’s a crowd.

February is off to a good start as well – Dungeon Keeper and Crusader: No Regret should arrive soon.

By

ISIS Canned For Now

Looks like there won’t be a finished version of ISIS anytime soon – after putting some more work into it, I had some of the more important mechanics working, but realized that it just wasn’t fun.

Back to the electronic drawing board.

By

We Can Rebuild It

In my late attempts to rebuild my once glory collection of Amiga and PC game boxes, I made some progress recently – since yesterday, both Syndicate and UFO: Enemy Unknown are on display in my bookshelf. Finding a copy of UFO wasn’t exactly easy since the rather unspectacular UK packaging gets sold pretty regularly…

X-COM Ufo Defense "Interceptor" Box

Boring.

… while the alien box rarely makes an appearance on eBay.

UFO Enemy Unknown Alien Box

Awesome.

Surprisingly, the almost equally hard to find Syndicate came as a bonus from the same seller, so I even saved on shipping costs.

By

So… what is ISIS?

ISIS is my attempt at creating – and eventually finishing this time around – a small game in Unity. The basic premise is creating a Space Invaders-inspired game that breaks away from the standard “You down here, they up there” scheme the original and its various clones rely on. How to do this? By placing the game on a hexagon!

Apart from the obvious difference that there are no borders on the sides of the screen which stop your movement, the biggest advantage is that the game will allow you to go beyond the standard “One screen, one stage” template by creating layouts of various separate hexagons, allowing the introduction of proper level design and objectives (like destroying the power generators in the three outer sections before being able to harm the centre section’s main enemy).

I will post screenshots of the current version later.