There and back

25 01 2014

That’s it; done. Finished! Another one bites the dust and I’m about to bite the pillow (actually I’m about to bite into a stir-fry my amazing wife had quickly whipped out of thin air as I walked in).

It’s 23.37

I had fun. Lots of fun.

I’m tired… deathly tired. I slept for 20 minutes. Between 7.50am and 8.10am. One of the things I learnt early on with an event like this is that good food and lots of water goes a lot longer than litres of coffee.

We made a game.
I met some really fun and interesting and cool people.

I’ll write up some sort of post-mortem later.

G’night all you lovely people out there!

“We must away, ‘ere break of day, to find our long forgotten gold”


24 01 2014

Let the game jammin’ begin!

Reference Links

18 01 2014

Seeing as I’ve been finding out anything and everything I can about the concept of Entity.Component.System frameworks I thought I might quickly compile a current list of interesting links (might embed this into the blogroll at some point). These are mostly just the baseline links for further reading and will be updated as I undercover more and more interesting ones. All of these links are also just a Google search away.

Unity2D – Sprites 4

14 01 2014

I’ve planned for a longer series of treaties concerning Unity and sprites but I’m going to take a break from all of it for now as it’s been too long between posts. Within this space not only have I lost the main thread of thought but also begun moving away from Unity’s model and implementation of a component-based system. This last has also shifted my coding style a long way from the previous posts concerning Unity.

So where do I stand now? And what am I planning for the next few updates?

Firstly I do want to write down some more notes concerning sprites but these will be more design-oriented than based around an implementation in Unity. And secondly, I want to toss around some ideas concerning Entity.Component.System [ECS] systems.

Unity2D – Sprites 3

13 01 2014

Actually I kind of forgotten where I left off. I really need to start attaching code files. Might create a shared repository for all this stuff over at Bitbucket. Anyway; yes, sprites in Unity. Have I mentioned that this has nothing to do with the new Unity2D update which the lovely boys and girls over at the Unity team just released? Did I also mention that the Unity2D update is mostly not really that useful?

Trolling aside, let’s see where I was.
Hmmm…. Sprites… Meshes… GameObjects… Ah yeah, making sprite-like objects in the editor.

Alright, with the first approach done I’d like to go for the third approach since it’s only slightly more complex. In fact, it’s not even slightly more complex so we’ll get it out of the way right now. Remember how in our first attempt we’ve created the sprite node. All we need to do now is simply create another node and parent the sprite node to it.

var selected_texture = (Texture2D) Selection.activeObject;
var sprite_node = new GameObject("Hero");
var graphic_node = NewSpriteNode.Make(selected_texture);
graphic_node.transform.parent = sprite_node.transform;

And voila, we have a proper transform hierarchy where the graphic_node itself acts as the pivot point of the sprite since it’s position is localized to the sprite_node’s space. And if we really want to be sexy here we can always set the graphic_node’s hide state and not even see the resulting hierarchy ugliness.

The second approach is more interesting and more complex since it involves custom inspectors (which Unity for some strange occultish reason decides to call Editor).

So the first thing we need to do is create a ‘Sprite’ behaviour which will help us control the underlying mesh via its associated inspector/editor. What goes into this behaviour you ask? Let’s see what we want from our sprite and let’s keep it simple for now; pivot and scale.

public class Sprite
  : MonoBehviour
  public Vector2 Pivot;
  public Vector2 Scale;

With that in tow we shall continue onward with our spriting adventure next time.

“Some day you’ll return to me; Your valleys and your farms; And you’ll no longer burn To be brothers in arms”