Category Archives: General

Katastrophe! goes gold

After 12 weeks of planning, scheduling, managing, meetings, designing, codings, bug fixing, optimisations and for me multiple weekends and after school hours meticulously tweaking, researching specific areas until my tasks behaved as I envisaged my parts to behave, e.g. Mirror reflection and controls, Collectable AI, Puzzle FSM, Save and load manager, shaders development, XML Achievement system, GUI creation facilitated by NGUI and Occlusion tuning, Dimidium Games is proud to present the final release version of Katastrophe. Post mortem to follow. For the time being you can grab a copy of the installer here.

screenshot screenshot1screenshot2 screenshot11screenshot13 screenshot14 screenshot20 screenshot23 screenshot25 screenshot31 screenshot32 screenshot36 screenshot38 screenshot40 screenshot43 screenshot47

Advertisements

Storing encrypted strings in memory

Whenever you want to store values as string in memory, whilst at the same time prevent external tools from either finding the value and changing it. e.g. changing high score values. You can use the built in System.Security namespace to do so, the following code shows an example of this.

using System.Security;
using System.Runtime.InteropServices;

SecureString secureStr = new SecureString();

int Score
{
    get {
        var bStr = Marshal.SecureStringToBSTR(secureStr);
        var scoreStr = Marshal.PtrToStringBSTR(bStr);
        Marshal.FreeBSTR(bStr);
        var score = int.Parse(scoreStr);
        return score;
    }
    set {
        secureStr.Clear();
        var chars = value.ToString().ToCharArray();

        foreach (var c in chars)
        {
            secureStr.AppendChar(c);
        }
    }
}

The caveat to this is that its only supported currently in desktop, so if you’re planning on using this code inside unity it wont work for mobile and web as they dont have Marshalling available within their JIT compilers.

If desktop is not an option, alternatively you can hide the value using simple crytography. In its simplest form this can be achieved by means of XOR’ing the value. To allow it to work, a random secret private key is chosen and this is then used to encrpyt and decrypt the value. The following code snippet shows how

private int key = 9999;

int score;

int Score
{
    get { return score ^ key; }
    set { score = value ^ key; }
}

An even better way is to randomise the key when you store the value, as shown below

int Score
{
    get { return score ^ key; }
    set { 
        key = GetRandom(1, 9999999);
        score = value ^ key; 
    }
}

int GetRandom(int min, int max)
{
    Random rnd = new Random(); 
    return rnd.Next(min, max);
}

This way even if they do stumble across the value, the next time they look for the same value it will have changed. Its fast and its also available on most if not all platforms.

Prototype Week4 – Bug Off!

Due to technical difficulties from last weeks presentation, none of which was our fault thankfully. We did however go out feeling a little robbed of all our efforts. So to make amends we decided to investigate the same game some more. Some of the other teams had done so already with one of their prototypes and granted it was within the rules to continue and expand on an existing prototype, we felt this was the game that required this need. The only caveat was we decided to step it up a notch, which wasnt as bad as it seemed as we had become more familair with unity over the weeks, which also built up our confidence with the tool. We were also becoming much more comfortable with each other and their abilities, so the time was right to spread ourselves more thinly and onto new unfamiliar areas. Firstly, it was time to delve further into the story and experiment on existing mechanics, either polishing them up or adding to them on the programmers side, while on the art side, more detailed models and texturing would be their next stage.

For my task I personally took on the responsibility of creating an in game fly through camera, something I have wanted to do for a while in unity, also investigating if a rewinding feature could be implemented. This rewind action would be called via a button press, namely ‘r’ this would then being the process of reversing the characters movement until the button was depressed, it was designed to remove the need for a life system giving the player a softer punishment rather than a harsh one of restarting from a designated checkpoint. I always thought any type of fly through camera was a better form of narrative in explaining or emphasising points of interest. In our attempt, we utilized this technique by indicating where the character should go next from their current location. It would be implemented as an extra camera that would follow a path, smoothly until it reached its end point, in which event it would switch back to the main camera. The flythrough was borrowed from a google search and massaged into our code. I discovered that the system was using time to calculate the path to follow and this would cause issue when run in game. Basically once started, the flythough camera played. So when the cameras are switched we had not way of pinpinting the position of the flythrough camera which was already making its way around its designated path, which and was also looping back to the start once it completed its full path. So the cheapest workaround with the least rewrite overhead in getting around this was to position and save a prefab in edit mode and save it out as a prefab, later instantiating that prefab with initial positions set automatically. The prefab would then appear and run as if it had been set to run from the beginning, of course some may say, why didnt you just reset the time to zero. Well this is because it was using system time and this is read only. In any event this workaround fixed the issue and was enough to get our point through during presentation time.

The rewind feature on the other hand took a lot long as this idea was quite rare and there was little information on how to do it, I had only seen one game using unity, called Time donkeys and they weren’t doing it as an in game rewind rather a replay system. After 2-3 days of research and coding I came up with a solution that worked, only problem was when time to test I discovered that it did not work as intended against a moving platform. The issue arose due to the rewind not being able to indentify the existing trigger and script that allowed the character to attach and follow a moving platform, so instead you would warp to whatever collider was below. What was most pressing about this bug was that our starting platforms in the game were those that moved, and due due to time constraints I wasnt able to come up with a feasible and stable solution to fix and present. I literally got the rewind functionality working 2 hours before presentation and even then it was in a rough basic form. So we decided not to show this feature and continue with only showing the other things we had added. As for the art we did see some new additions, for example a new model for the character which was created and textured. We managed to get it to perform basic ragdolling, only problem was the ragdoll was applied to another model so it just looked weird when you died and the main character would then swap from the current to an army dude while also going all limp, still got a cheer from the crowd so happy with the result.

prototype-week4

Prototype Week3 – Bug Extermination

This week was back to normal in terms of time allowed, we were back to 3 days instead of 2. Last week being interupted and shorter due to a public holiday. Another change was made to the team, another new artist was added and we were now 5 artist strong. This week extra day allowed us to experiment more with mechanics, but what was alleviating us going into this week was a concrete game idea. A few arose, but in the end we were undecided upon two game running of the bulls, my top pick and a rocket jumping game similar to quake in mechanics but with puzzle elements. I prepared a mini prototype going into the week but it wasnt enough as the team decided upon the rocket game that later evolved into a bug extermination game 3rd person puzzler. Similar to tombraider but with bugs as enemies and the main character wielding a rocket laucher instead of dual pistols.

prototype-week3 prototype-week3-1 prototype-week3-2

Prototype Week2 – Hurricane Derby

Due to a shorter week, we knew we had to choose a game from our list that was both fun and achieveable. The game with simplest mechanics was deemed Hurricane Derby and it was the game we set forth to make. A small change this week as well to the team. A new member joined from another team, as this was within the rules of prototype week we decided to give the new guy, who happened to be an artist, a try. His skills in creating realistic greybox assets in short time really helped see this particular prototype come to fruition very easily. Mainly because one of the other artist was beginning to show his reputation of slacking off.
The idea was simple, you are a tornado and it’s your job to destroy as many objects in the game as you can in the fastest possible time you can. Points are awarded for destroying multiple objects chained together. Health is restored by finding the golden cow. The game ends when nothing else remains in the level to destroy or when the timer runs out. What we realised after naming it Hurricane derby was there was little hurricane and more tornado, however, since we didnt want to redo our branding that had been created by the concept artist, the name stuck so we kept it.

prototype-week2-1 prototype-week2-2

 

Prototype Week1 – Text N Drive

10 Refined Game Ideas

Chef Simulator
• A Similar Style to Surgery simulator
• First person perspective (3D)
• Set in a fast food kitchen
• The player has to pick up tools to flip burgers and assemble them
• The player controls the chefs hands
• Apply toppings to the burger by scooping them out of containers
• The burger must also be assembled and boxed (with the bun)
• Your score is based on speed
• The player must add the topping based on an ordered given at the beginning of each round

Text and drive
• A first person perspective from the inside of the car as the driver (3D)
• The player has to steer the car with the numpad or arrow keys
• There is a clingy girlfriend who keeps texting you as you drive and you must respond fast
enough
• While texting the road blurs out as you focus on the phone
• You must dodge traffic to survive
• Your “score” is based on the number of texts you send as well as the distance you travel
• To reply to your girlfriend there is a template response which you must type correctly, as the
game progresses some of the characters are missing
• Start and pause menu are in the phones menu, end screen is a car crash

Animal control greyhound
• You control a rogue greyhound that is running in a race, which then turns rabid and begins to
attack everyone on the ground.
• Objective is to create as much destruction and havoc as possible while avoiding the
RSPCA/Animal control who will attempt to capture and impound you.
• Points are awarded to mauling individuals and objects scattered around the ground.
• Bonus points for mauling hot dog vendors.
• Game is set in a fixed (camera does not rotate) top 45 degree isometric view.

Do You Even Lift?
• The aim of the game is to continously lift weight ‘guilitone’ style to build those sweet upper
pecs.
• As the game progresses, your muscles start to ache.
• Bro Science tells you to continue to lift during this.
• You have to hit A and D at the right point in the lift to handle the weight, otherwise you will
lose balance and drop the weight onto your neck.
• The game gets harder as the player gets slower and the button presses become harder to hit at
the right time.
• If you button mash, your muscles implode and you die, as well as chopping you neck off!

Thieves ‘r’ us
• Game based on stealth
• Pick your victims house at the start as you pace the street, checking out details and items that
you cna loot.
• Start as a hoon who goes after wallets, then you can buy new ‘anti squeak’ sneakers and hit
the gym to carry more items! You can even start some ballet lessons to tip toe through the
house
• Build up your organistion, hire some more poeple to help you with the massive 60″ tv that you
must have!
• Getting caught is one thing, getting away is another. If you get caught, smash through a
window and run for your life, all in 3D thrid person game!
• Oh, and beware of dogs

Magic Pet Shop Escape
• Save magic animals and help each other escape from the wizards pet shop to maul him after
trying to burning it down for insurance money
• Play as different animals with unique controls and abilities to escape the inferno!
• 3D 3rd person cutesy art style
• Save different animals to use them by opening their cages, switch through different animals to
solve puzzles
• Dog: super strength (push cages)
• Rabbit: ice breath (hold off fire for small amount of time)
• Cat: telepathy (scout the puzzle/maze)
• Animals that survive try to maul a wizard
• Gameplay style is akin to “push box”

Lumberjack vs Beavers
• Play as a beaver to race lumberjacks in a game of who can cut the tree down faster.
• The game is 2D
• The tree cut down first falls on the other player. If the lumberjack beats you it is game over.
• Your goal is to keep beating your opponent and progress to bigger and tougher trees thus
increasing difficulty as the game continues.
• Sometimes fleeing animals will run across the screen. You need to ‘jump’ over them to avoid
getting stunned. Landing on them will turn them around thus making them crash into the
lumberjack which stuns him instead.

Taco Tactics
• Grow your taco business from the ground up, use advanced marketing techniques, espionage
and good ol’ fashion delicious tacos to put your rivals out of business and become the most
gargatuously mammoth taco company of all time
• 2D isometric strategy game
• Ruthless AI opponents
• be the first to make 1 million dollars profit to win!
• hire taco vendors to move more product and take revenue away from rival taco vendors
• street thugs to pester rival vendors and protect your own
• cooks to increase the deliciousness and demand of your tacos
• and spies to steal taco recipes and intel from rival companies
• build various buildings to research recipes, sales techniques and upgrade your units

Running of the Bulls
• You play as a Bull trying to kill as many runners as possible while avoiding the Matadors.
• first person perspective as the Bull with interactive horns in view.
• use “mouse” to move the bull left and right, you do not control the bulls speed.
• the amount of points for each runner is represented by amount of red they wear.
• point multiplier based on how many runners you have impaled on you horns.
• after multiplier ends the runners are hurled off the horns.
• hold “space” to build up horn charge to impale runners further onto the horns to allow higher
point multipliers.
• red bull cans give you speed boost and shorter build up time for maximum horn charge.
• matadors can kill you.
• split paths for you to take.
• finish the game by making it to the arena.

Flock of Life
• Lead your flock of homing pigeons to relative safely with your pigeon (cursor) avoiding
obstacles on the way in an Apocoliptic Hellstorm
• pick up stray pigeons to your flock and avoid losing your pigeons to meteors, hell deamons and
giant floating Beiber head (the obvious bringer of the apocolypse)
• top down “galaga”-ish view but with awesome crisp 3D graphics
• Epic Environments
• attack enemies by forming formations (scissors, gun, ect) that are more powerful depending
on your flock size

Bird Shit Game
Idea: You play as a bird and your main goal is to “shit” on as many passers-by as possible, while you
avoid being attacked by larger birds, cats, slingshot-wielding children and angry people.
Style: Toony – can be 2D or 3D.
Gameplay: The setting is beside a busy road with trees on either side, and branches that arch across.
This allows places for your bird to hop to, in order to avoid danger, but also to reach targets on both
sides of the road.
Hitting certain targets may net more points, but they also come with a few consequences – example. If you hit policemen enough times, they may open fire and kill you if you don’t dodge fast enough. You can also acquire more points the larger the shit is– this is achieved by collecting (eating) bugs that spawn in the trees. Certain bugs give different effects.
Characters: You can choose to play as;
•Pigeon – Slow moving, but has small AOE when they shit. Has large shit.
•Seagull – Average speed. Has an average-sized shit, but can fire at a faster pace.
•Sparrow – Very fast. Has small shit, so it needs to hit targets multiple times to get decent
points, but it is also the best for avoiding danger as it is the smallest target. Fastest at shitting.

Game Brainstorming Ideas

Team Taco is incorporated and here are the games we have brainstormed.

1. Magic Animals Escape:
Magic animals join forces to escape a pet shop that is on fire.

2. Animal Control Greyhound:
Punters didn’t bet on this greyhound jumping the fence. They bit off more than they could
chew, literally.

3. Running of the Bulls:
Impale as many people as you can. Avoid matadors.

4. Extreme Chair Balance:
Paper Toss meets Chair Balancing. Overthrow and you die.

5. Skydiving Game:
Becareful not to be sucked into a planes engine. Avoid obstacles while falling. Hit checkpoints
while falling.

6. Bird Shitting Game:
Jump from tree to tree as a sneaky bird shitting on innocent people. Hit babies for more points.

7. Wrecking ball vs Wrecking Ball
Taking strikes to a whole new level. Two disgruntled crane workers decide to strike by causing
chaos.

8. Text and Drive:
Everyone knows how dangerous it is, but everyone does it. So we want to teach people the
reasons not to.

9. Escape UTS:
The famous crane that hit the building next to UTS, this is what would of happened if it hit the
UTS building, in drunk mode.

10. Hurricane Destruction:
Control a tornado as it tears through a city, get points by collecting as many objects as possible.

11. Balancing Tight Rope:
Jousting meets acrobats. Balance while trying to knock off your opposing acrobat.

12. Lumber Jacks vs. Beavers:
Try and get to the middle of the tree before your opponent to kill him.

13. Do You Even lift?
The aim of the game is to continously lift weifht ‘ guilitone’ style to build those sweet upper
pecs.

14. AI Tower Defense:
Towers only fire when the camera can see them. Move the camera to power up those towers.

15. Drunk Knife Throwing:
Throw knives at a player on a spinning target… While drunk.

16. Drunk Driving Grand Prix:
Formula one driver kills people, in a drunken rage.

17. Hide in Basement:
Based on a true story. Sneak up at night and steal food from your mother who has kicked you
out of home. Spend the rest of your days playing LOL.

18. Monkey Business:
Shoot targets which launch bananas at you and you have to catch them.

19. Pigeon Guide Deluxe:
Guide a flock of pigeons as they fly north for the summer, or south. Pigeons are dumb, guide
them around planes and obstacles.

20. Wifeception:
Steal stuff for your beloved wife as she investigates who is stealing stuff.

21. Taco Tactics Lite:
Turn based game where you have to build your Mexican enterprise to take on your rival.

22. Hair Dresser Simulator:
Cut customers hair without cutting their ears. Become a professional barber and shave them,
with a straight edge razor. Enough said?

23. Chef Simulator:
Control a Burger King and flip burgers for your life. Remember, you are a bit uncoordinated
and burn easily.

24. Vine vs Gardener:
Be one of those annoying leech trees and strangle the life out of other trees. The gardener will
come to trim you down however.

25. Thieves ‘r’ Us:
Pace the street and pick your victim. Call in your hoons to steal that 60″ TV that you dream of.
Build the ultimate organisation.

26. Affair Escape:
Don’t get caught sleeping with your mates wife. Escape the house without your friend seeing.
Stay in the dark the whole time.

Second year – blink and you’ll miss it

So not a lot has been happening post wise, which is not to say im not busy. Quite the opposite. Second year has been a blur of new and amazing knowledge and with it challenges. I am now on holidays again and busying on my second AI assignment having just completed the first graphics assignments familiarising myself with the modern shader graphics pipeline and all that it entails. I might post some screenies of some of the effects I have made along the way.

I have sidelined my box2D project for the time being until I have at least finished this school assignments first. Hopefully, I can get some free time over the coming weeks to finish that off. Im currently reading Programming Game AI by Example, a book I perused partially in first year and now revisiting in more depth for second year, its a great read and book I would highly recommend if learning AI for the first time, it also has useful accompanying source code and executables allowing me to follow and fully comprehend the subjects outlined by the author.

Thinking outside the Box2D

When one thinks of the capabilities of Box2D one instantly conjures up images of flying birds, angry flying birds. So what really lies underneath the hood of this little engine that could. Well there’s only one way to find out. So I grabbed myself a copy of the latest code, version 2.12 as of this writing. The first thing you need to do after downloading is configure it with cmake to generate the visual studio solution and associated projects. Which is not to difficult just a matter of unzipping the source somewhere, pointing cmake to that directory, set a build output directory, hit the configure and if no errors hitting generate. A solution called Box2D should be created, open it and build both a debug and release build and you’re good to go.

To assist in getting up to speed with Box2D, there is the usual hello world program. This does nothing more than track the movement of a Box2D object or body (as it is defined) and output it to standard output. Better examples are contained within the folder named Testbed. Inside there is a program that when run allows you to choose a set of examples configured to display and render graphically using OpenGL, freeglut and glui. More importantly all the code is available soone can see how it is all done. Its cleverly designed in a such way to be easily extensible. Just create another header file defining your world, body and fixtures while also including the usual Step, Create and Keyboard functionality and add a new entry into the testentries code file and your done.

As with all frameworks there are certain workflows a developer must abide by to create and use the API correctly. In Box2D, you need to define a world in the form of a b2World object. Think of this as your standard factory pattern that allows you to create other things. Within this world, the other things that can be created are bodies, fixtures and shapes. You can create the world object using new, however due to how the memory is contained in pools you can not new bodies, fixtures and shapes. So dont do it. One of the first things I found out about Box2D is it is renderer agnostic, it basically lives as an entity that you tell to work in a world and how you wish to display that world is up to you. What is strange though for an API designed in C++, why are there so many examples found on the web all using mainly Flash. My knowledge of Flash is dismal to non-existent so you can imagine for a beginner you have this API that can create worlds and there are no examples of how to display your beautiful world. In the end I decided to traverse the testbed example and break it up into the minimum functionality that would produce an output.

Here in lies one of the first hiccups I had using Box2D, evidently it was not triggered by Box2D itself rather it was freeglut. I created a new empty console project and added the necessary files from the testbed, namely Test, Render and Main. I linked the freeglut_static.lib file and all was good except when it came time to run, it complained that freeglut.lib was missing. I thought this was strange as I had linked the static lib. Searching through some forums, I sourced a reputable prebuilt lib file and used it, it fixed the issue provided I also placed the associated freeglut.dll in the executable directory. The program fired up with no popups and then instantly terminated, flashing an error message in the command window before shutting down. After tracing through the code I discover the message was trying to say:

freeglut function called without first calling ‘glutinit’

int main(int argc, char** argv)
{
testCount = 0;
while (g_testEntries[testCount].createFcn != NULL)
{
++testCount;
}

testIndex = b2Clamp(testIndex, 0, testCount-1);
testSelection = testIndex;

entry = g_testEntries + testIndex;
test = entry->createFcn();

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitWindowSize(width, height);
char title[32];
sprintf(title, "Box2D Version %d.%d.%d", b2_version.major, b2_version.minor, b2_version.revision);
mainWindow = glutCreateWindow(title);

glutDisplayFunc(SimulationLoop);
GLUI_Master.set_glutReshapeFunc(Resize);
GLUI_Master.set_glutKeyboardFunc(Keyboard);
GLUI_Master.set_glutSpecialFunc(KeyboardSpecial);
GLUI_Master.set_glutMouseFunc(Mouse);
...
}

As seen in the highlighted code snippet above, I had actually called glutInit so what could possibly be causing the issue. After debugging I could see that line that was causing the issue was the call to GLUI_Master.set_glutReshapeFunc(Resize);. Now GLUI_Master is a global instance that should be available with the initialisation of glut, so if I was calling glutInit… why then wasn’t this being intialised as well. Several hours past I finally found it to be due to the mixing of the freeglut_static.lib and freglut.lib. The fix was as simple as adding the preprocessor definition FREEGLUT_STATIC. Once in place all the code I transferred from the testbed program into my solution worked. So with a working testbed and seeing exactly how everything hooked up, what else could I do. I decided that perhaps putting together an angry birds clone would fuel my persistence to learn Box2D in more depth. At this stage I only feel like mimicking the first level with the aim to make it as close as possible to the original in functionality.