Silent Kraken

TransformUtilities

by seth on Feb.06, 2010, under Game development, Programming

Hello. I’ve been working on a set of four tools to aid in the Unity3d development. After using Unity for a while I encountered the classic problem of needing to copy the position of an object over and over. This led me to create the “Copy” tool. I’ve found a similar script on the Unify community, but I wanted to extend the tool. It is now possible to copy position, rotation and scale of any axis you want. Also, the values apply to all objects selected in the scene.

After that, and inspired by the tools I found on the Gamebryo Lightspeed editor, I created the Randomize and Add Noise tools. Those tools work almost the same, the randomize the position, rotation of scale of any object selected (or all objects selected). The difference is that while Randomize sets the absolute values for position, rotation or scale, Add noise adds a delta to the current value of the transform. This is useful for example to randomize the Y rotation of all the trees in your level, or to make a bunch of boxes look more natural by not being perfectly aligned.

Finally, after been learning Autodesk 3ds Max, I created the Align tool inspired by a tool in that software. It basically takes a source transform, just like the Copy tool, then uses it’s collider and the collider of the object (or objects) selected to align it. You can align for example, the minimum point of your selection with the maximum point of your source (what you are aligning to) to place an object over another. It let’s you align using the minimum point, maximum point, the center of the object or the pivot point on both the selection and the source. You can align on all 3 axis.

To use these tool, all you need to do is download the script file, and add it into a folder named Editor in your project’s Asset folder. Once compiled by Unity you find the new functionality in Window -> TransformUtilities, or simply press Ctrl+t (Cmd+t for Mac users)

Developed by Daniel Rodríguez (Seth Illgard) in January 2010

Download TransformUtilities!

Hope you find them useful, and please let me know how can I improve theses tools.

1 Comment :, , , , , more...

Coroutines in Unity3d (C# version)

by seth on Jan.23, 2010, under Programming

Coroutines in C# work the same way that they do in Javascript (UnityScript), the only difference is that they require more typing (they have a slightly more complicated syntax). You should see the blog post on Javascript coroutines first.

Here, I present the differences:

Coroutines must have the IEnumerator return type:

IEnumerator MyCoroutine()
{
	//This is a coroutine
}

To invoke a coroutine you must do it using the StartCoroutine method:

public class MyScript : MonoBehaviour
{
    void Start()
    {
		StartCoroutine(MyCoroutine());
    }

    IEnumerator MyCoroutine()
    {
        //This is a coroutine
    }
}

The yield statement becomes yield return in C# :

IEnumerator MyCoroutine()
{
    DoSomething();
    yield return 0;	//Wait one frame, the 0 here is only because we need to return an IEnumerable
    DoSomethingElse();
}

Remember that we need to return an IEnumerable, so the Javascript yield; becomes yield return 0; in C#

Also, since C# requires you to use the new operator to create objects, if you want to use WaitForSeconds you have to use it like this:

IEnumerator MyCoroutine()
{
    DoSomething();
    yield return new WaitForSeconds(2.0f);	//Wait 2 seconds
    DoSomethingElse();
}

Happy coroutining :)

1 Comment :, , , , more...

Coroutines in Unity3d (Javascript version)

by seth on Jan.22, 2010, under Programming

I’ve been working with Unity3d for some time now and I couldn’t really make good use of the coroutines because I was unable to truly understand them. After some time playing with them and making some experiments I realized their true power. I couldn’t believe what I was missing! So, a couple of fellow game devs asked me to explain the concept to them. I decided that a blog post was the perfect way to do it and, at the same time, share this with everyone.

Coroutines: Special type of functions(in the programming sense) that allows to stop it’s own execution until certain condition is met.

A coroutine looks like this (on javascript, the C# version is here):

function MyCoroutine()
{
	DoSomething():
	yield;                         //Mystery here
	DoSomethingElse();
}

When you invoke this function (start the coroutine) it will behave just like any other normal function you have ever seen, until it reaches the yield instruction.  The yield instruction explained: The yield instruction works like a return statement in the sense that it stops the execution of the function and returns control to the code that invoked that function. The main difference is that the yield instruction lets you delay the execution of the code that is after it (in the last example, the DoSomethingElse() statement).

function MyCoroutine()
{
	DoSomething():			//Do this immediately
	yield;                          //Return control to the caller
	DoSomethingElse();		//This will be executed one frame later
}

void Start()
{
	MyCoroutine();
}

What happens if you have more code after the MyCoroutine call? Let’s see an example with some prints:

function MyCoroutine()
{
	print("This is printed second");
	yield;    	//Return control to the Start function
	print("This is printed one fourth, exactly one frame after the third");
}

void Start()
{
	print("This is printed first");
	MyCoroutine();
	print("This is printed third");
}

You can control when do the code after the yield instruction will be executed. It depends on the parameter of the yield instruction, according to the following table

Nothing: It will wait one frame
Another coroutine invocation: It will wait until the invoked coroutine finishes execution
A WaitForSeconds object: It will wait certain amount of time

Confused? Here are the examples:

function MyCoroutine()
{
	DoSomething():				//Do this immediately
	yield WaitForSeconds(2);   	//Return control to the caller
	DoSomethingElse();			//This will be executed 2 seconds after
}

void Start()
{
	MyCoroutine();
}
function MyCoroutine()
{
	DoSomething():				//Do this immediately
	yield MyOtherCoroutine();   //Go and execute MyOtherCoroutine!
	DoSomethingElse();			//This will be executed after MyOtherCoroutine finished execution
}

function MyOtherCoroutine()
{
	DoStuff():				//Do this immediately
	yield WaitForSeconds(2);   	//Return control to the caller (in this case the Start function)
	DoMoreStuff();			//This will be executed 2 seconds after
	//MyOtherCoroutine finishes execution here
}

void Start()
{
	MyCoroutine();
}

As you can see, coroutines are very powerful and easy to use once you understand how they work. I will post some usage examples and the C# version of the scripts on this post soon.

1 Comment :, , , more...

Game development facts and tips

by seth on Nov.19, 2009, under Game development

Last month I had the pleasure of finding a new friend in the gamedev community: Ian Masters, a senior game programmer at Sidhe Interactive, creators of the Speed Racer game for Nintendo Wii and Sony PlayStation 2.

While he was in town I managed to compile a list of game development facts and tips. Here they are:

Programming:
Everybody creates their own internal technology to build games. They modify engines and create frameworks for internal use.
The technical director is the responsable of selecting technology like the game engine.
Developing a game engine from scratch could take years and it’s not recommended.
The most used languages in game development are : C++, Lua and Python.
It’s common to have a prototyping team.
Use source control (SVN, mercurial, etc.)
Have all your projects into a solution, prefer that to link against static libraries (including third party code).
Have your engine’s source code in your source control system so you can modify it and the changes will propagate.
QA:
Unit testing is very important (specially for math libraries and core functions).
Regression testing is important too.
QA team is different from playtesting. QA test QA, playtesters test fun.
No QA guys in multidisciplinary teams.
Art:
Conceptual art should be delivered as soon as possible before programming start (at least a month ahead).
Work on iterations.
Artists hate naming conventions.
It’s not easy to convince the artists to follow naming conventions (normally you need a producer to talk to them).
Having a lead artist who follows naming conventions is crucial.
Try to integrate audio as soon as possible. Audio is not a luxury.
Post effects are often decided between the post effects coder and the art director.
Camera effects are often decided between the camera scripters and the designers.
Have metrics with the export tools (poly counts, texture sizes, bone count, etc)
Should present a visual target.
Design:
They can’t account for everything.
Design document should be as detailed as possible.
Design document should be a live document.
They define tunable properties.
Normally use XML files for tunable properties (exported from spreadsheets for extra awesomeness).
There are co-designers (scripters).
Production:
Producer’s work is to assure work is being done and cycles are running smoothly.
Wikis are awesome.
You can manage a whole project documentation using exclusively a wiki.
Procedures, knowledge and project management all fit into a wiki.
Multidisciplinary teams are a great way to work.
Have a list of features that need to be tested on the prototype.
Recommendations:
Scrum is the way to go.
Use Scrum properly.
Scrum meetings in the mornings.
Put scrum plans on the wiki.
Create tickets on Trac or a similar tool.
Keep things visible and transparent.
Read a lot. Be proactive and an active learner and problem solver.
Try to work as close as possible with artists, programmers and designers.
You need a published title to get into the industry. To get that title you need to be in the industry. Indie titles are a good way to break into it.
Prototype as soon as possible.

Programming:

  • Everybody creates their own internal technology to build games. They modify engines and create frameworks for internal use.
  • The technical director is the responsable of selecting technology like the game engine.
  • Developing a game engine from scratch could take years and it’s not recommended.
  • The most used languages in game development are : C++, Lua and Python.
  • It’s common to have a prototyping team.
  • Use source control (SVN, mercurial, etc.)
  • Have all your projects into a solution, prefer that to link against static libraries (including third party code).
  • Have your engine’s source code in your source control system so you can modify it and the changes will propagate.

QA:

  • Unit testing is very important (specially for math libraries and core functions).
  • Regression testing is important too.
  • QA team is different from playtesting. QA test QA, playtesters test fun.
  • No QA guys in multidisciplinary teams.

Art:

  • Conceptual art should be delivered as soon as possible before programming start (at least a month ahead).
  • Work on iterations.
  • Artists hate naming conventions.
  • It’s not easy to convince the artists to follow naming conventions (normally you need a producer to talk to them).
  • Having a lead artist who follows naming conventions is crucial.
  • Try to integrate audio as soon as possible. Audio is not a luxury.
  • Post effects are often decided between the post effects coder and the art director.
  • Camera effects are often decided between the camera scripters and the designers.
  • Have metrics with the export tools (poly counts, texture sizes, bone count, etc)
  • Should present a visual target.

Design:

  • They can’t account for everything.
  • Design document should be as detailed as possible.
  • Design document should be a live document.
  • They define tunable properties.
  • Normally use XML files for tunable properties (exported from spreadsheets for extra awesomeness).
  • There are co-designers (scripters).

Production:

  • Producer’s work is to assure work is being done and cycles are running smoothly.
  • Wikis are awesome.
  • You can manage a whole project documentation using exclusively a wiki.
  • Procedures, knowledge and project management all fit into a wiki.
  • Multidisciplinary teams are a great way to work.
  • Have a list of features that need to be tested on the prototype.

Recommendations:

  • Scrum is the way to go.
  • Use Scrum properly.
  • Scrum meetings in the mornings.
  • Put scrum plans on the wiki.
  • Create tickets on Trac or a similar tool.
  • Keep things visible and transparent.
  • Read a lot. Be proactive and an active learner and problem solver.
  • Try to work as close as possible with artists, programmers and designers.
  • You need a published title to get into the industry. To get that title you need to be in the industry. Indie titles are a good way to break into it.
  • Prototype as soon as possible.

Hope that helps, and a big “Thank you” to Ian for his time with us. I learned a lot.

Leave a Comment more...

Introduction to Game Development and Unity3d

by seth on Nov.19, 2009, under Game development

Today I was invited to the UVM University to give a workshop on game development using Unity3d. For that purpose I created a small presentation that you can find in pdf format here: Introduction to game development and Unity3d.

It is a very basic introduction, but I hope you like it.

2 Comments :, more...

Game design with Noah Falstein, part 4: Brainstorming and extra tips

by seth on Oct.10, 2009, under Game development

Meta-observation:

  • The best way to learn is by playing many games and learning from other designers
  • Game designers must also learn to observe themselves on many levels as they play
  • Some levels in playing/designing games: Mechanics, strategies, cheat/exploit, game design rules… but there are other ways to see it

Basic brainstorming:

  • Be aware of, but not shackled by constrains
  • Listen to what others say
  • Challenge assumptions – your own and others
  • Vary discussion of theme/story and gameplay mechanics (Important!)
  • Try to cross-fertilize ideas even (specially) when it seems absurd
  • You are finding new neural pathways
  • Mixing wildly different ideas or themes can create useful tension
  • Example: Art deco + bio-tech + Ayn Rand + 1960 + underwater = Bioshock
  • Ideas, not egos: Critique concepts, not people
  • Review constraints and question them too
  • Good, not escential, to have a reason why
  • Nothing is to odd or silly – low hit ratio
  • It’s normal to wander – some!
  • Best size around 5 +- 2
  • Common ground, divergent opinions
  • Avoid including managment directly (fear of firing, danger of deferring to boss)
  • Consider flied trips, resources, toys
  • Time pressure (optional)
  • No judgments (optional, useful for dealing with people that has never done brainstorming)
  • More than art as you gain experience

Great game elements (advanced techniques):

  • Classic convexity structure (Start wth one node, then many, then one again)
  • Appropiate inteface
  • Negative feedback (Handicap)
  • Self-tunning features
  • Emergent complexity (Overlap various game mechanics)
  • Great balance (tradeoffs again!)

Negative feedback examples:

  • Exponential costs (experience, money, etc)
  • Easier to aim after each failure or death
  • Selling items give you less money that what you originally paid for it
  • Stronger units are more restictive (specialized, only good against another specific unit, etc)
Leave a Comment : more...

Game design with Noah Falstein, part 3: Natural funativity theory

by seth on Oct.04, 2009, under Game development

Natural Funativity Theory:

Natural funativity theory is Noah’s own work. You can find the original gamasutra article here. What I present here are only my notes on the subject, my personal interpretation of the theory. Hope you find it useful.

What is fun?

  • Dictionary: Enjoyment, a souce of amusement (that does not help)
  • Consider underlying reasons
  • “Funativity”: Thinking about fun in terms of a measurable cause and effect
  • Inevitably this leads to “Why do we commonly share the experience of fun?”

Evolutanary roots:

  • We must look to our distant past
  • Young mamals play to learn basic survival skills
  • Games are organized play
  • Human entrataiment is more complicated

Entretaiment is Learning:

  • Life is either work, rest or entretaiment
  • Perhaps at first it was all work or rest
  • Play (and fun) may be neotenal traits
  • Fun is about practicing or learning new survival skillin a relatively safe setting
  • People who didn’t experience were less likely to survive to become our ancestors

Natural Funativity Theory:

  • Basic concept is that all fun derives from practicing survival and social skills
  • Partly learning new skills, partly mastering and mantaining familiar ones
  • Key skills relate to stone-age human life, but often in modern context
  • Three cathegories: Physical, Social, Mental

Physical fun:

  • Sports generally enhance our strength, stamina, coordination skills
  • Exploration is fun, both of local area and knowledge of exotic places
  • Physical aspect to gathering “stuff”
  • Hand/eye coordination and tool use are often parts of fun activities, crafts

Social fun:

  • Storytelling is a social activity, a way to lean important survival and social lessons from others, our first VR
  • Gossip, bonding with friends aids survival
  • Flirting, showing off, finding mates is a key component in social fun
  • Language has become paramount

Mental fun:

  • Pure abstract reasoning practice is fun
  • Pattern matching and generaion
  • Music, art, puzzles, all pattern based, both perception and creation
  • Gathering has also a mental aspect: categorizing and identifyng patterns

Multipurpose fun:

  • Many fun activities have physical, social and mental aspects in combination
  • Games that mix these aspects tend to be very popular (e.g. Blizzard games)
  • Incorporate ways to practice these skills to increase popularity of games

Noah also mentioned that Diablo 2 was a great in combining the 3 types of fun. You have great physical (hack and slash mechanics, click click click), great mental (inventory, item management, etc) and of course, great social fun (multiplayer is great!).

Seth out.

1 Comment : more...

Game design with Noah Falstein, part 2: Fundamentals

by seth on Oct.03, 2009, under Game development

Ok, continuing with my notes on game design, here you have the fundamentals that Noah Falstein teach us:

Identify your constrains:

  • Creative: expectations and goals
  • Technical (including platform)
  • Bussiness, marketing, sales, distribution
  • People: skills and personalities
  • Internal politics
  • Serious games – add teaching/training and real world content constraints

    Game design fundamentals:

    • Creative plagiarization: Take only what is appropiate, make it your own
    • Sid Meier’s rule: Fun for the player, not for computer or designer
    • Albert Einstein: Make it as simple as possible, and no simpler
    • Make it familiar, yet new
    • Easy to learn, hard to master
    • Easy, clean, deep
    • Emphasize exploration and discovery
    • Have a clear short, medium and long term goals
    • Natural funativity: hunting and gathering

      A great game:

      • A series of interactive choises in the persuit of a series of well stablished and compelling goals
      • Must be a series of choises or it’s too simple to be a game
      • Must have a goal or it’s a software toy
      • With Sim City and The Sims players may bring heir own goals
      • Choises need to be meaningful
      • If choises are dull could be that:
      • Easy to code that way
      • Lazy designer
      • Meaningful choises are perceived by the player as having significant consequences
      • May not have actual consequences

        Goals:

        • Clear goals: it’s not fun to flounder aimlessly
        • Avoid “the protagonist with amnesia” cliché
        • Compelling goals are goals that follow the concepts in natural funativity
        • Surival is always a compellin goal

          Flow:

          • Combine intense learning with practical gameplay
          • Start with a relatively low stress level
          • Combine rapid difficulty increase with slower increase. That maximizes fun.
          • High difficulty increase: Boss battles, climatic battles, quest resolutions
          • Low difficulty increase: Bonus levels, new resource ad tresure-rich areas, series of easy minion enemies
          • Overlap introduction of new skills, areas to explore, tools, enemies
            2 Comments : more...

            Mixins in game development

            by seth on Oct.02, 2009, under Game development

            Programmers tend to think in the Object Oriented Programming paradigm all the time. We create complex class hiercharies that describe every single entity on the game. Thats what we learn at school, we are programmed (deeply into our firmware) to do that, but there is a whole world of different pradigms and approaches we can use, and the scripting languages are bringing the dynamic style into the game.

            Functional programming can be great for game scripting, Lua has beeen a very popular game scripting language for a very long time, and a bunch of game engines uses it (including CryEngine 2.0 and Gamebryo LightSpeed). The ability to attach properties and functions into an object at runtime, for example, is incredibly useful to create high level game logic and even artificial intelligence.

            We can talk about dynamic languajes and their benefts here, but I want t focus on Mixins as the modern approach to game entity description:

            Mixins are chunks of functionability that can be applied to game objects. You can think of them as little pieces (building blocks) that you use to create a complex game entity. The most basic mixin every game entity is the entity’s transform which defines its position, rotation and scale. Each game engine implements entity’s transform in a different way, but the concept is the same.

            Mixin complexity can vary from a simple mixin that lets you name an object (holds a string identifier), to very complex mixins like the one that provides characters the ability to use pathfinding to navigate the scene.

            Each engine handles mixin agreggation in it’s own way, some engines even let you use multiple inheritance with mixins. Please note the difference between mixin inheritance and mixin agreggation:

            • Inheritance:
            • Mixins can be inherited
            • You can have mixin class hierarchies just the same way you can with normal classes
            • Aggregation:
            • Game objects agreggate a number of mixins to aquire their functionability
            • Mixins are agreggated (added to game objects) to create entity model descriptions

            For example: A mixin called BoomerangTarget provides the ability to be the target of the player’s boomerang. BoomerangTarget is a child of another mixin called Target which provides the generic ability of being a target of a player’s weapon. At the same time, an Enemy agreggates the following  mixins: Actor, BoomerangTarget, SwordTarget. Actor lets the enemy play animations, BoomerangTarget is the mixin desvribed above and SwordTarget provides the ability to be hit by a sword. SwordTarget mixin is also a child of Target, thus, both BoomerangTarget and SwordTarget share the basic functionability defined in the Target mixin.

            A lot of game engines are using Mixins these days. Mixins have become the standard way to represent game object functionability.

            Seth out.

            Leave a Comment :, more...

            Game design with Noah Falstein, part 1: The game designer

            by seth on Sep.28, 2009, under Game development

            Last month I took a very interesting course of Game Design with the professional game designer Noah Falstein, fomous for working at LucasArts (formely Lucas Film Games), DreamWorks Interactive, and now his very own game consultant company: The inspiracy

            I asked Noah for permission to share my personal notes about this course, so, here you have them. The stuff presented here may be the basics of game design, but I really learned from them.

            In this first part I collected my notes about what is a game designer, his role, and the types of game designers.

            Game Design with Noah Falstein:

            How to spot a game designer:

            • Obsessive game players, moviegoers and readers. Be in the popular culture!
            • They easily get mistaken for the standard programmer and common nerd
            • Wonders how things work and why: Rules!
            • Smart but quirky
            • In-depth knwoledge of many different areas

              Tips:

              • Know a lot of things: If you only specalize in one thing, all your games will be the same
              • Story & design should support each other: they both will become stronger that way
              • Reuse characters, that will add more to them
              • DON’T make your first level first! Always start designing at the middle of the game
              • Don’t stay in the kwnon landscape, explore!

                Game designer types:

                • Lead designer/Design director:
                • Combination of managment and design
                • Assistant designers/co-designers
                • Take charge of subset, may share vision
                • Level designers
                • Often hybrid of artist, architect, designer
                • Playtesters
                • Separated from QA (PT = fun, QA = bugs)

                  How to become a game designer:

                  • You need experience
                  • The chicken and egg problem (do something else)
                  • Specialize in different areas (if you only know a subject all your games will be the same)
                  • If you only want to be a game designer, probably you shouldn’t become one

                    Game designer fundamentals:

                    • Clear overall vision
                    • Keep the audience in mind
                    • Consider the player’s experience
                    • Concentrate on the decisions made
                    • Chris Crawford says: “Verbs, not nouns”
                    • Do stuff, don’t show it

                      The next part of my notes are about game design in general, I’ll post them soon.

                      Leave a Comment : more...

                      Looking for something?

                      Use the form below to search the site:

                      Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

                      Visit our friends!

                      A few highly recommended friends...