Indie Development: Have Full Versioned Backups at Zero Cost

There is a simple way to have complete backups of all your sources versions, at no cost; it’s the kind of solution a single, destructured, minimal budget indie developer may use. This without any server or complex setup: just use a couple of tricks. I suppose here you are developing on Windows.

What does not work

The simplest way one can think is simply to set up your working folder as a folder in Dropbox (or any similar service), as that syncs online you’ll be fine. For versioning, Dropbox actually does version you files.

Now this can fail disastrously, because:

1. If you want to recover work that happened yesterday before you took the wrong path in your web application using this library that does not work, or before you imported that non compatible plugin in your Unity project, you don’t need to recover just one file: you need t recover a situation, with maybe hundreds of files to be recovered and Dropbox simply does not do that: history is at single file level, not groups of files (e.g. folders).

2. Working in Dropbox continuously modifying files means a lot of syncing going on, and your IDE may not always be happy about that, you are maximizing risk of source / project corruption, and as you cannot recover whole folders, you risk losing everything.

The TortoiseSVN menu for unversioned foldersA simple way that works

What would be cool would be to work outside the syncing folder and commit to a synced versioning server. And we also would like to have complete backups of the versioning server in the form of a single file so that we also have a history of that in Dropbox. We’ll get all this.

First notice (as once pointed out to me by Daniele Giardini) that with TortoiseSVN you can create a Subversion repository just as a local folder without installing any server; so you can setup your project to commit to a local folder based Subversion repository. Just do “Create repository here”,  see here for setup details. This is the key point; the only difference with a server is that you access this local repository with urls like file:///C:/SVNRepository/.

Create that folder repository in Dropbox, and each time you commit the Subversion repository will get your files and these will be backed up online. Still you are not safe, as any little file that gets corrupted in the Subversion repository folder will break all your versions, and as Dropbox keeps only the history of single files, you will have no way to recover a coherent working repository of all your versions. For that, just schedule a daily Windows job to zip and backup your repository as a zip file in your Dropbox. From that file you can recover all your versions. Done Sorriso

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, applied games.

Social Share Toolbar

A podcast & sources for (romantic) game polish and feel – DAG pod 22

In this podcast Daniele Giardini and Pietro Polsinelli (myself) discuss the notions of game polish and feel.

Here is the podcast:

There is also a video of the podcast here:

References

Game Feel: the book.

The game Goscurry.

football drama prototype

The Football Drama site.

DOTween

DOTween tweening component site. Easings http://easings.net/en.

Finally, Vlambeer talk on game feel.

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, applied games.

Social Share Toolbar

Making a sport game in Unity: model & prototype

I just published a video where I describe how to start modelling and developing a sport game, specifically football (soccer) in my case:

In the following notes some motivation for the work and references from the video.

What am I trying to do?

I am creating a game on football (not American Football), called Football Drama: this game is supposedly the story of the coach in the context of a Football Manager like game. The latest version of Football Manager for smartphones has a cool game play:

FM 15 on smartphone

One of the first thing I did in Unity is search for a plugin that would handle the match play part. Given the number of plugins available in the Asset Store and the popularity of football, I was pretty sure that my only problem would be picking the best plugin. Wrong.

I didn’t want to do thisimage

The only decent looking component I found is Soccer Project by “Astute Games”, which is ok but actually does nothing useful in my perspective, as it provides passive 3D models of players and little more.

The are simply no plugins covering modelling, movement and AI for football games in the Asset Store.

Maybe because “The barrier of entry on making a decent team sports game is really high.”, as they say in one of the few discussion of the theme indie & sports available online.

The Simple Soccer examplehttp://ecx.images-amazon.com/images/I/51jAoX1id6L.jpg

In chapter 4 of the book Programming Game AI by Example the author provides a nice implementation of a simple soccer game.

I’ve downloaded the Java sources and made the sample run in my IDE.

simpleSoccer

Here are some of the Java classes of this example:

image

Movements are regulated by physics:

image

Complete Java source code is here.

Not what I want for a sport game

This material is useful but what it is modelling is not football. seems more snooker to me Sorriso. I want a simple grid with squares as players and a state handling framework, where the (hierarchical) state machine can easily be extended. Movement is not determined by physics – the right metaphor is not snooker.

If you actually watch a football game, its a highly fractioned game of control and tactics, my reference for this development has been Cameroon vs. England (World Cup 1990):

Physics plays a role on long shots, but I will model that using tweening (the wonderful DOTween library by Daniele Giardini). I will call the model I need Football Grid.

Football Grid: The model

imageThe example is also using heavily inheritance to model all aspects of play. I instead will be happily mixing inheritance and composition, reducing inheritance to a minimum and modelling state with classes only when strictly necessary. A great book to learn about basic game programming patterns, if you are new to the topic is Game Programming Patterns.

The three states of game play: paused, preparing play, in play: this is simply an enum.

I used object hierarchy and modelling of states with class instances only when it is strictly useful, so e.g. in the case of a player state.

Here are the classes of my model:

image

2015-04-05 16_11_46-UnityVS.footballDrama - Microsoft Visual Studio

2015-04-05 16_20_15-UnityVS.footballDrama - Microsoft Visual Studio

Curve ball effects

2015-04-05 16_29_08-PowerPoint Slide Show - [MasterSlides.ppt [Compatibility Mode]]

To get these effects you can simply tween (I use DOTween) the ball differently along the X and Y axis:

DOTween curse transform

More?

Follow me on Twitter – I study game design, development (2D), applied games, and I post about progress on Football Drama.

Football Drama game design

Unity components used

DOTween tweening component

Game Logic Grids http://gamelogic.co.za/grids/

DOTween http://dotween.demigiant.com/

Thank you!

Image references

“Association football 4-4-2 formation” by MaxDZ8, based on work from Mario Ortegon – self-made, original file from Mario Ortegon. Licensed under CC BY 2.5 via Wikimedia Commons – http://commons.wikimedia.org/wiki/File:Association_football_4-4-2_formation.svg#/media/File:Association_football_4-4-2_formation.svg

“Association football 4-3-3 formation” by Threner. Licensed under CC BY-SA 3.0 via Wikimedia Commons – http://commons.wikimedia.org/wiki/File:Association_football_4-3-3_formation.svg#/media/File:Association_football_4-3-3_formation.svg

Social Share Toolbar

Unity3d: Using A* and grids for entering a football field

Just played with the A* algorithm and a grid to make players enter a field and assume the initial 4-4-2 classical formation. Notice there are dumb and smart teams A bocca aperta [Read more…]

Social Share Toolbar

Unity3d: Giving runtime prefab instances meaningful names

This is a short note about a minor issue you may meet in Unity3d when you are creating scene objects in code, say from prefabs.

In my case I am creating a soccer field borders on the base of a grid that may resize, so I want to create everything in code.

Unity3d object instance with meaningless nameI am as always giving meaningful names to variables (and you should too) and so it would be nice to get the instance to be named as the variable, without duplications and without – oh horror – writing the instance name as string, breaking code esthetic and refactorings. In the pic on the side you see what you get by default – not cool.

Actually in the rich and hackable C# universe as managed in current Unity3d this is possible: just this way:

image

Thanks to this post here. I used it this way:

image

imagegetting good names on the instances Sorriso

 

Note that this relies on unspecified behaviour and while it does work in Microsoft’s current C# and VB compilers, and in Mono’s C# compiler, there’s no guarantee that this won’t stop working in future versions. See the discussions here:

Getting names of local variables (and parameters) at run-time through lambda expressions

Finding the Variable Name passed to a Function in C#

Update: It seems like this might no longer be an issue from C# 6, which will introduce the nameof operator to address such scenarios.

If you have suggestions on how to automate getting good instance names at runtime (maybe with cleaner / lesser code) let me know!

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, serious games.

Social Share Toolbar

Game Development with Unity 2D – part 6: Pixel Perfect

Here we have a nice chat with the sinful Daniele Giardini about pixel perfect in 2D games, as a form of holy perfection.

We are continuing our voyage in Unity 2D development; previous trips: Part 0, Part 1, Part 2, Part 3, Part 4, Part 5.

We didn’t find a satisfactory definition of pixel perfect online, so this is Daniele’s: [Read more…]

Social Share Toolbar

A note of the wild use of “if(object)” in Unity’s C# code

Looking at other people’s C# code for Unity, I kept seeing this bizarre usage of if:

if (object) { …}

where object was a real object, not a bool instance. This is a JavaScript kind of usage, where there is a big (perceived) mess about object and value types, so I wondered how did C# “automagically” cast to bool? You cannot do that in classical typed OOP languages like Java.

Turns out there is nothing about this in C# itself, its MonoBehaviour that implements implicit boolean casting

public static implicit operator bool($classname$ me){
return me != null;
}

Actually you will have to navigate the hierarchy up to Unity’s Object to find it. See also here.

But if you are learning C# with Unity, be careful as “This can be really confusing because that behavior doesn’t carry over when you start using standard .net libraries and other 3rd party code that is agnostic to Unity.” – here.

And neither it will when writing your classes, when not extending MonoBehaviour, so its not a healthy habit to catch.

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, serious games.

Social Share Toolbar

A note on slimy static Unity3d gameObject instances

A quick note on the state of C# static variable instances in Unity3d.

So I just discovered that static properties of classes extending MonoBehaviour on level reload may get reloaded or not, depending on circumstances.

The problem is this: you may need in your game development to have a singleton manager class instance which is also a game object. [Read more…]

Social Share Toolbar

A very short note on Unity 2D and pixel characters

Just a note on a simple problem with Unity 2D and small sprites’ physics.

Problem

imageI could not get my 2 pixel by 2 activist demonstrating in the scene to collide with buildings when working in 2D. By using the 3D box collider and locking rotations everything worked fine, but it was not cool at all given the very flat design of People in Love.

I am using 2D Toolkit for handling sprites and atlases, and I was using its built-in 2D physics collider integration, letting it compute the perfectly fitting box collider. But I didn’t get (2D) collisions.

But then using Unity 4.5.2 I got this warning at runtime: “The collider did not create a collision shape…”

Capture_772

Turns out this is the problem:

Box Collider 2D does not collide when its size is small (like 0.01)

2 pixel wide activist

Solution

The solution is not hard: I simply set in 2D Toolkit to leave the colliders as user defined, and I added an Edge Collider 2D to the activist prefab. Works fine Sorriso

EDIT: Thanks to a suggestion from the ineffable Daniele Giardini I’m now using a Circle Collider 2D which works fine even at 0.003 radius and fits perfectly with my activists.

Now I am a Unity beginner dev so any suggestion on refining this would be very welcome – I’m here on Twitter.

image

Social Share Toolbar

Game Development with Unity 2D – part 5: A grid of Roman centuriae

This is the fifth part of a voyage in Unity 2D development, where we document in video the design and development of a simple strategic game reproducing the Battle of the Teutoburg Forest; here we make a more general discussion of grids in games. If you missed them here are Part 0, Part 1, Part 2, Part 3, Part 4.

We’ll dedicate this episode to discussing grids, which are at the core of so many 2D (and 3D) strategy games.  Up to now our battle has been in continuous space, but it would be cool to have a grid so we can more easily create an AI with a strategy. [Read more…]

Social Share Toolbar