2DToolkit Tutorial – one character, many spritesheets

Before 2DToolkit, I was using Unity’s own 2D functionality for the game. By this stage I already had built 2 levels and the base abilities (lasers, sword spins, speed rails) for Gunkatana.

I wanted to create a way for CrazyArcadia (the artist working with me) to create his own levels within Unity without requiring my engineering.One of the big failings of Unity’s current 2D tooling is the lack of tiled sprites. However, their UI system, released later, allows tiling of sprites.

So I bootstrapped a wall tiling tool on top of the UI image component. It wasn’t good enough, due the various ways that the Unity UI can be displayed on the screen, the different measurement systems, it didn’t work as smoothly for level creation.So I just went and bought 2DToolkit.

2DToolkit’s has a great tiling feature for sprites. It also includes a fantastic way to organize your art.Instead of relying solely on where sprites are on the project, you can group multiple sprites into collections, which are then packed into atlases.

Tip: each atlas visible in the viewing frustrum will count as a draw call.

It really makes it easy to catalog and organize your sprites by their domain, be it characters, world details, objects, etc, and then when you’re using 2DToolkit’s sprites, you get a dropdown box with all of your sprite collections.

It also includes animation support. You create animations in separate animation libraries, ideally only animating things from one specific collection / atlas.

Then you can attach a 2DToolkit sprite animator to a gameobject with a 2DToolkit sprite, and on that animator you get a dropdown box with all the animation libraries and can pick which animation you want.

This makes short work of Unity’s builtin animations, which all require different objects and have to be animated on the target object. You can setup your whole sprites and their animations without touching any gameobject, so it’s all ready for when you start assembling your prefabs. Or, you can access it programmatically, which is what I ended up doing.

gunkatana - character select-r5ig9rg4

When a player selects a character and a skin, their ids are stored in the
PlayerSelectModel. When a character is spawned into the level, I get the
correct animation library for that particular character and skin that I have
setup in a ScriptableObject, loaded asynchronously when you start the game.

As I converted my player object to use 2DToolkit, I needed an easy way to create multiple animation libraries with the same sprite ids from a large character atlas, but aiming at a different sprite.

Sprite collections also allow you to define specific collision boxes on different sprites.This is very useful if your entity changes shape as it animates and you want the collision box to accompany it. The classic example of these changing colision boxes are Street Fighter 2’s hitboxes.

34jd2qu
So I edit the actual prefab files in a text editor to point to the correct sprite collection.I’d love to create an automated tool to do this for new skins!

Sprite Collection Clone Workflow

  1. Create new Sprite Collection with same properties
  2. Add the new spritesheet.
  3. Copy data from the Sprite Collection prefab that already has all collisions setup onto the new Sprite Collection prefab (using a text editor)
  4. Change the sprite’s fileID and guid using find and replace all to point to the sprite atlas you want.
    Example: spriteCollection: {fileID: 11422796, guid: 7e8e615b27635412c8c23a07b136537d, type: 2}

The new sprite collection will have the collisions and will use whatever new spritesheet with the different character’s skin!

Screen Shot 2017-12-03 at 23.13.39

Now for animations:

Animation Clone Workflow

  1. Copy animation library
  2. Replace fileId and guid with spritecollection you want, defined in the sprite collection prefab

Screen Shot 2017-12-03 at 23.13.52

It can be a bit fiddly but it works out in the end.

With this I was able to (relatively) easily add new skins for existing characters in Gunkatana.

Advertisements

Mobile Games in 2017

It’s been years since I’ve played mobile games seriously. That is, besides Hoplite, my trusty commute companion.

Turn based strategy goodness

Now I’ve upgraded to the iPhone 7 Plus, and the expanded specs sent me investigating the current state of mobile games.

Nitrome is incredibly prolific

Old favorites: Dungeon Raid, Hoplite, Punch Quest, 100000000

There’s so many gorgeous experiences out there. I want to play Card Thief, Ticket to Earth, Swap Sword, and more!

I spent some minutes playing Golf Zero:


Very fun and unique concept, but I wish the bullet time effect was smoother, a lot smoother!

Also the controls seem floaty on purpose, they’re almost great but not quite.

Knights of Puzzelot

Puzzelot is an old riff on the Dungeon Raid formula. Even on the new iPhone the framerate is choppy. It hasn’t aged well unlike the other games I tried. The art is wonderful, though.


Almost 20 years after the fact, to be playing Baldur’s Gate in such a speedy portable device is a wonder.

Bethesda must do the same for Fallout 1 and 2, there’s a market for those games!!


Rust Bucket is great but it gets so bloody hard! Hits me good with it’s SNES Zelda aesthetic.

And speaking of SNES, Wayward Souls is a Chrono Triggerlike Roguelike.


Quite beautiful! It’s missing a dash, unless it’s something you unlock at some point.


Punch Quest. Just brilliant. So much great design and art!

Very curious about Swap Sword, the visuals are reminiscent of Samurai Gunn.

Dream Journal

After experiencing fantastically detailed and weird dreams, I started a dream journal.

One night I had three dreams, in subsequent short sleeping periods.

First dream

I dreamt of visiting a nameless dangerous neighborhood in London with high-rise tube station and many bushes in the ground level. This area is near to an AMC (not AMC TV) warehouse building with big letters outside spelling AMC in red. AMC The International or AMC Intentional. This is probably a place completely fabricated by my mind.
In these bushes there would be spread out big peluccia animals that looked very realistic while walking around them. You’d have tigers and lions and other dangerous fake animals, their bits flying in the wind.
One night when coming home to catch that high tube, one of the animals actually starts moving and turns out to be a real tiger. Me and a friend run from it but eventually I was eaten in a very painful way, which prompted me waking up.

Second dream

Within the corridors of this high level tube station, coming back home, our group of 5 or 6 was stopped by security-looking personnel who were staking out the downward stairs on both exits of the big room we were in.

They claimed a dangerous individual had been seen. At this moment one from the group explains that this area is known to harbour violent people who will lay down extreme violence at random.

The security team keeps talking with each other claiming the individual is getting closer, and everyone gets more tense and nervous. I’m an easy to scare guy, so I was already very scared.

Eventually some other civilian that was in this area waiting with us shouts at another civilian that was with him telling that “THE VIRUS IS HERE” and suddenly the security team stops pointing the guns at the stairs and kill every single person that was there, including our group and firing at me. They motioned against each and there was a shootout between all the security guards. When they began raining down fire on us, they were shouting the positions they had picked and firing at each other. “I PICKED THIS SPOT”, “BUT I PICKED THIS”.
I woke up again.

Third dream
I am in a train carriage with my girlfriend and a nemesis of us, a former friend who has strangely come to visit us abroad.
The train stops at the high level tube station, and we are again warned by someone else in the group that its a dangerous area and violent people can show up at any time for any reason.
We are again presented with security guards claiming we can’t leave the station because there is a suspect walking around outside. Our group seems larger now, as one of my colleagues from work is also present.

Again the security team stakes out the stairwells, and tensions rise. There’s chatter about viruses, weaponry and the fucked up individuals outside.

Eventually we hear gunshots from outside. Me and my group retreats into some stairs going up in the back of the room. It appears theres a large mass of freaks outside with pistols coming up the stairs.

We rush up the stairs as the whizing of gunshots floods the room, one of my colleagues using his hand to cover up my head from any stray bullets. I lose track of my girlfriend by now.

When we reach upstairs, we realise we are stuck in a small office with no other way out. The hope is that the criminals leave soon after gunning down the security guards.

I peek through a window overlooking the room.

I see cops with riot shields, helmets, green night jackets. Dead bodies dot the room. I realize the criminals were the fake security guards, and someone in my group shouts “OF COURSE! I’ll never bend to those bastards!”. I had stumbled upon a major crime network.

and then i woke up…

Global Game Jam 2014

For the first time I’ve participated in a game jam, and the Global Game Jam no less.

Knowing that one of my best friends was also participating in Malta, and that actually he was one of the organisers at his University, was a big boost to my commitment.

Teaming up with Robin, Robert and Antonio to build a game related to “We don’t see things as they are, we see things as we are.” during 48 hours was at times an exasperating experience that came together in the second day and ended in a jamming ecstasy as music, art, code became one being with a purpose.

Inslide World

Our limbed eyeball trots the circular world filled with danger and mystery, forever guided by our work as a team, and the wonderful community of game jammers that was present at SAE London.

You can play Inslide World here: http://globalgamejam.org/2014/games/inslide-world

Again, and for a while now, discussing and experiencing my passions without feeling like they’re simple pastimes, without undue anxiety stemming from the fleetness of such moments in the past, was a fascinating and calming experience.

“It’s ok Geraldo, these people will be there next time, this is real and not a smoky impossible dream”, I tell myself. Being close to the people making things happen is a great learning experience. It’s the validation I needed, as a human, that my beliefs and wants are not just mine. I feel among brethren, and not strangers. Favourite games and mechanics will vary but the common thread of making video game experiences is shared.

Jam On.

Hall of Heroes – 2013

I’ve just hugged my big brother goodbye. I will see him next year, probably 2, 3 or 4 months from now.
I’ve been living in London for the past year and a half (and change). These are the last days from my Christmas holidays in Portugal, I’m flying back to the big city on January 2nd.

A lot of things happened this year.

Moving here in 2012 was a hard decision. The hardest I’ve ever taken yet. But if you know me just the slightest, you’ll know my passion for games. And my passion for games and games development was not being sated in Portugal.
The solution was always to move.

I had the chance to go to Facebook London’s HQ and do a talk on cross-platform development, representing where I work at, Plumbee. That was pretty momentous. I met one of my heroes, Alan Cannistraro. I learned Objective-C through his Stanford courses, available on iTunes U. That knowledge got me a job at Bliss Applications doing mobile apps and all of that eventually got me my current job. An ex-Apple employee, he’s at Facebook now heading up iOS development. Talking with him was really great.

A friend visited me and we went to London Comic-Con. I got an autograph from Mark Meer, I explicitly bought the Mass Effect art book just so I could get his signature. I told him I loved his work and to me he was the real Shepard, no matter how good Jennifer Hale‘s work is. I also told him I approved of the Mass Effect 3 ending. He thanked me. It was my first time at a cosplay event. It was really great to see everyone have so much fun, and I hope to do some cosplay in the future.

I met Chris Avellone, at another event, Rezzed. I had played his most praised game, Planescape: Torment, some 14 years ago. I had the chance to meet him and interview him thanks to our mutual friend Ian. This was without a doubt the highlight of this year. Having the chance to personally thank such a huge influence in my life, Chris having written and designed so many of the games that formed my taste in video games, it was a very special moment for me. He signed my boxed copy of Planescape: Torment, which I had travelled to Portugal almost on purpose to retrieve it some months before. Seeing him deliver his Project Eternity keynote, I shouted YEAH when he showed all the Black Isle games logos. Those were my teenage years on full display for all to see. I keep looking back to that first time I played Torment. I had no idea I would ever meet the person responsible for those first few lines of dialogue and interaction. I had no conception at the time there even was a person behind that. But after that and the Fallout games, I really started to pay attention to the people that made games. And if at the time I didn’t consciously decide to become one of them, I know now that was one of the key moments that sparked the dream.

Still at Rezzed I played Journal, by Richard Perrin. I spoke with him and he gave me some great tips, and just seeing his game completely inspired my own games and projects and I changed the direction for #projectnoir, previously a visual novel adventure game and now a top down adventure game. I asked him why can you jump in Journal, when there’s no platforms to climb to. He said the extra interaction brought you closer to the game. I agreed and did a quick platforming + dialogue prototype right afterwards.

I also met Rami Ismail, one of the people behind Ridiculous Fishing, Luftrausers, Nuclear Throne, Super Crate Box and so many other games and projects. He’s one of the nicest developers I’ve met, and I really admire his output, either through games or reaching out to the community in tangible ways, like pressKit(). I wish him all the best with his next games, and would love to say hi some next time.

This year I dabbled in Unity and Futile. I even did an internal talk at Plumbee about what I had learned. I’ve been doing good progress on #projectnoir and recently started work on a smaller, less ambitious little platformer, something perhaps a bit autobiographical.

In September I went to Eurogamer Expo, I had a two day pass. However, I didn’t manage to find anyone to go with me. The first day started good. I bought Doom and Fallout t-shirts. Thank you Bethesda for the merchandising, so many years later I can finally wear official Fallout gear!
Not many games excited me, though.
However, since I was alone, I was quite depressed by the end of the day, and did not go the second. Just the prospect of another 8 hours staring at games and not saying a single word, it was just too much. I could have tried to spark some conversations, sure, but it can be very hard for me if I don’t feel at ease.

I went with friends from work to the onelifeleft podcast Christmas party, and I karaoke’d Don’t Stop Believing, with modified lyrics, helped by the onelifeleft crew. It was a brilliant party to top off the year, to be amongst lovers of video games, celebrating everything good about it. There was even Secret game Santa. I met Keith Stuart, Kieron Gillen and Simon Parkin at that party, world famous game journalists, but also really cool, approachable and fun people. Hell, I sat on Keith’s lap while he handed me a PS3 game from the Secret Santa pile. Thanks Santa, I got Dead Rising 2 (and some F1 game…)!

While I love the work Keith and Simon do, meeting Kieron Gillen was such a fantastic surprise for me. I couldn’t resist saying hi to him and the folks he was playing Coup with. I told him how amazing his review for Deus Ex (the first one!) was back in the day, and we reminisced about that great game.

This year another one of my friends also moved abroad to work on games research. It’s three of us now, friends that met at University during our Computer Science course and moved out of Portugal to work in games. I’m here in London, another one is near Toronto, and now one moved to Malta. It makes me so happy that we are able to pursue our dreams and don’t have to be cut down by the near-sightedness of the people of our country. Really, really happy. For anyone born in a country that’s been making games since the 70s, having the chance to work on games might be nothing new. For us, it’s our dream.

I have also made fantastic friends at work. I have to send a shoutout to a particular argentinian friend that has been a very patient and fun friend.

Looking back at 2013, I can’t say I regret much. I could have moved to a slightly bigger, slightly farther away, slightly cheaper flat, but other than that, I’m pretty happy with this year. All of the experiences I’ve had, all of the people I’ve met, all the fantastic work I’ve had a chance to contribute to at Plumbee, all of them had been just dreams, with no chance of happening. Until I tried to make them happen.