Sunday, October 14, 2012

Unity Game Jam Manila 2012 Part 2

So with that previous part about the new keyword, I spent time fixing my code for Tactics Ensemble.

By 7pm of Oct 11, Thu, the participants entered. More than 30 people came in (16 teams were ultimately formed).

After the introductions and FYI's with the student's curfews and everything, Brett announced the theme:

"Primitive Life"

Huh.

To help, Brett showed some examples, "Ok, what do you mean by primitive?" It could be, primitive geometry, primitive behaviour, and some other examples I forgot. It was "primitive geometry" that stuck in my head.

Brett told us mentors, "You know, this first half of the jam, you don't need to worry about anything, cause they're still mostly in the planning phase. You might as well get some rest. It could actually get pretty boring so you may even want to actually do the game jam too, you know, while waiting for people to ask for your help, you could do it as well, cause you're gonna get bored."

I actually had a headache that night (was not able to sleep the night prior to that because friends were playing multiplayer Borderlands 2 nearby, shouting all night) so after commiting my changes to Project Tactics Ensemble, I called it a night, & went back home to sleep.

On the way home though, I thought if I was participating too, then I mulled on the theme.

Primitive Life.

Hmm.

The usual thing to go for here is some sort of caveman game. But that's too bland.

What about a game where you beat up programmers who have such a primitive way of thinking in making their code? Yeah that'd be fun, I'd play that. A lot.

All I could remember from Brett's examples was primitive geometry.

So between last night and the following morning, my train of thought led me to this old 1884 novel called Flatland: A Romance of Many Dimensions. I actually found out about that a long time ago in college, thanks to Project Gutenberg.

I never really got around to reading the novel but, long story short, its about a fictional world where 2d shapes were living, breathing characters.

One of them, a hexagon, thought, "What if there's a 3d?". And such ideas were pretty much taboo in 2d land. So she ended up in a journey going to 3d and even 1d. (As a nice bonus, there's actually an animated film adaptation of the novel released back in 2007.)



That was where I got the idea. Some game where you transition between 2d and 3d. And I thought, practically that would most likely be transitioning between side-scroller and 3d isometric.. or should it be between side-scrolling and 3rd person view?

And I thought the idea is good but I'm going the wrong direction here. There's not much sense in doing those.

So I thought, what about a game where you transition between side view and top view? That's probably more useful. There are things you can only do in side view, and things you can only do in top view.

Then I thought, ok, I'll make it that you can only jump in side view, and that you can't in top view, because it's hard to notice such a thing in top view anyway.

Side view is how you normally move left to right, but top view is useful if you want to "change lanes", so to speak, get behind or in front of things.

So the moment I got back to College of St. Benilde, I was surprised to see my other mentor partner (Charles Cue) was already working on his game jam game too!

Ok, a little competition now, is it?

I started working on my idea as soon as I could. I checked around and it seems like the participants have yet to run into problems.

This obstacle was the very first thing I set up to do.

I might as well link the actual game I ended up with here. Make sure to click in the game so it can get keyboard input:


There are only 3 levels so far; the 3rd level simply loops back on itself when you finish it.

I tried making myself useful for the participants but I got the feeling I was being brushed off. All the other mentors there were faculty staff of the school. I was the only outsider. Some of them probably didn't even know I was a mentor! Brett had a better rapport with the students cause, well, he was visibly the guy from Unity Technologies.

I felt I looked rather stupid roaming around and getting strange looks from the students.

Nevertheless there was at least one participant who was friendly with me. Admirably, she was the only one who went solo while the others were all in teams.



Ok, I'll stop here. In part 3 I'll explain how the jam ended.

Here's some photos I took (since no one was asking for my help!):


Having neglected to bring a sleeping bag, this was
where I slept. I used some t-shirts as a makeshift pillow.
Toilet paper? Check. Food? Check. Laptop? Check. All set!
Billy here used to be an intern in our company, now he's
landed a job! Not in our company, but I'm still happy for him.

:3
















Unity Game Jam Manila 2012 Part 1

I got a rather surprising email last Oct. 2. A notification for a Unity Game Jam here in Manila, Philippines. Amid the looming deadlines I have for both work and personal projects, I thought that more stuff to do was the last thing I wanted to see.

Then I thought, what if the prize is a Unity Pro license?

I read the email more and what I got from it was this was meant more to be for learning Unity, other than it being a game jam (i.e. the whole "learn how to make a game in 48 hours!"). Also it turns out, De La Salle-College of St. Benilde is one of the sponsors of the event, so I take it students will be joining.

So, for the most part, I just ignored it.

The week that game jam is gonna take place, I see the usual announcements on our little IGDA Manila Facebook group, and silly me, I neglected to announce it on our Unity Philippines Users Group too. Though pretty much the people in Unity PUG are in IGDA Manila too. Nevertheless, I probably should have made some announcement too. I was hoping Mars Balisacan would do it; I'm only the guy who answers newbie programming questions in the group!

Then I got a private message, "Hey Ferdi, would it be ok if you come in the game jam as one of the mentors to the participants?" And having gotten that message while I was in the office in the middle of work, it was like a nice little distraction to go on some event for a while.

I also convinced myself that it would look good for the company if we participated in official Unity events. So I decided I would go.

So come the starting day of the event, straight from Quezon City (where our office was) I took the railway transit back to Manila.

When I got to the event's location (i.e. College of St. Benilde) I got stopped by some pretty strict security and it turns out the guards didn't even know the game jam is about to take place in their school.



Fortunately things cleared out amidst many phone calls and forms to sign.

Brett Bibby of Unity Technologies was coming in as the facilitator and the first thing to do was a briefing of us mentors. Apparently his flight got delayed so I was able to take some time to rest and chat with the people there.

When Brett arrived, we set up our things in the game jam's venue, the school's "Alienware Lab". Pretty much a big open space with a bunch of Alienware PC's. Unfortunately those things weren't set up yet so I couldn't get to try them.

So the briefing? It was this: Brett wanted to see how good we are with Unity so he asked us to come up with a game from scratch in 1 hour. Understandably it only needed to use cubes, and spheres, and whatnot.

My throat dried and my heart pounded fast. Being something of a perfectionist, I didn't want to settle for making a game that can't be completed in one hour. You could say I'm a completionist.

Ah, I know which game to make.

The simplest thing I could do: a side-scrolling shooter.

I did one before when Mars and I conducted the seminar about making a game using Unity. But I can easily recreate it from memory, more or less.

The challenge was doing so in under one hour.

So off I went.

I kept on checking for the time, glancing back at Brett. He was eventually getting into small talk with the other facilitators of the event; the faculty staff from College of St. Benilde (CSB).

Oh, good, good, looks like Brett is getting distracted from checking the time. More time for me!

Brett Bibby (left), and Patrick Williamson (right) of Unity Technologies


So I had my player ship moving and shooting, some enemies continually spawning, some particle effects, and I was about to finish some simple powerup feature when Brett called time.

Mine got looked at first, and pretty much the mistakes I did were:
  1. If you are continually moving something (via code) that has a collider, you always, always will want to put a kinematic rigidbody on it. Failing to do so will cause Unity to be forced to recompute the whole world's static collision data.
  2. Do not instantiate while in the middle of the game. Allocate everything you'll ever need at the loading screen or startup only. i.e. use a resource pool. Regardless if this is a mobile or desktop game you will want a resource pool. The enemy here is Mono's garbage collector. Unity is still in the process of updating the version of Mono that they use. In the meantime we're stuck with the old version (Mono 2.6) which reportedly has a slow garbage collector. [1] [2] [3]
The red line shows how bad Mono 2.6's garbage collector is.
The blue line shows the new garbage collector since Mono 2.8.

Point number 2 was understandable because I can't divide my attention at making a resource pool and the game's code and still complete in one hour.

And so point number 1 was really my mistake there. And Brett said, "Don't worry, even I forget sometimes." The problem also was that you'd only notice this if you have the Profiler, which only comes in Pro.

The effect then, is that people using the free version don't know why their framerate gets so low at times, and in effect they may get the wrong impression that Unity is slow.

Brett was actually wanting that some form of warning be made when the user makes this mistake (a message in the console, some explanation on the user manual perhaps, etc.). They're still arguing about how to go about it, it seems.

NCarter in the Unity IRC chat recommends people read up on the Nvidia PhysX User Manual. Since PhysX is what Unity uses, it will clear up a lot of mysteries for the common user if they read how PhysX works.

The only other mentor who I was with, Charles Cue, did a cool job too. It was about feeding food to a dragon, all in cubes and spheres, yes, but that was the idea. It reminds me of Papo & Yo.

Charles Cue, one of the faculty staff and mentors of the game jam.


The marshalls did an ok job too with the one hour hackaton, some were understandably struggling but they all got somewhere at the very least.

Brett gave some final tips for us:
  1. These students who are entering the game jam? They will almost always want to use physics. The problem is that they will likely misuse it and you will end up with something that you might as well throw away. You need to explain the gotchas of combining physics with user-input and animation.
  2. Sometimes they will ask how to do some particular thing which sounds rather strange. The proper thing to do is to ask "Wait, what are you trying to achieve in the first place with doing this?". And they go something like "Oh it's because I want to build a bridge that breaks." And then you realize "Ok, what you were asking for? That is totally not what you need to do to make a breakable bridge. You can forget about that. You need to do this instead..." and they realize they were needlessly doing things the hard way.
He then explained some intricacies with the Unity engine.

When Unity gets memory to use, even when garbage collected in Mono, Unity NEVER releases that memory back to the OS. Naturally when the Unity game closes, only then will it get released.

Apparently, this is actually a feature of any professional game engine: you will always want to allocate everything you'll ever need in a loading screen first, and never do any memory allocation while in the middle of the game proper. This is to ensure a reliable framerate for the game.

Second, things you know about .NET do not necessarily apply with Unity. For the simple fact that Unity uses Mono, and not .NET. Structs always get allocated in the stack? Not in Mono (ergo, not in Unity).

Thing is, in Mono, whenever you use the new keyword, that will always make use of the heap (memory allocation). If you're in Update(), you will not want to initialize a Vector3 with new Vector3(0,0,0) because that will make use of the heap.

Instead, use the handy Vector3.zero, or, if you need to give some specific values, do this for example:

Vector3 myPos;
myPos.x = 345;
myPos.y = 0;
myPos.z = 23;


Don't worry, a struct (like Vector3) can never be null, so this is fine. While it is admittedly a little more wordy (what used to be one line is now four lines of code), it will actually be faster this way. The point is, just don't bother with using new if you're in a tight loop (i.e. Update).

I'd like to clarify that this issue with new is because of the way Mono works, not necessarily something Unity Technologies directly chose to do.

They argue about this in length in this Unity forum thread, and here's some tips on the user manual.



That's it for now, I think this blog post is long enough as it is. In part 2 of this post I'll explain what happened in the game jam itself and share some more photos I took. Part 3 explains how the jam ended.


Thursday, May 31, 2012

Why Level Up In Multi-player Is Bad-Wrong, Says Me


The fundamental problem of leveling up, is that you have to level up.

I quote this from the article 'Unlocks' and the Gamification of Gaming:
"EA had designed a game with a serious problem: new users, already at a disadvantage against their more experienced peers, had the deck further stacked against them through the use of unlocks. EA’s marketing for the Ultimate Unlock Pack explicitly acknowledge the problem they had created..."
The problem is new-coming players have to level-up to have a chance against long-time combatants in a multi-player setting. Did we ever stop to think if "level-up", which is perfectly appropriate in a single-player setting, makes sense in multi-player?

It's no surprise to me I found in Guild Wars 2, that a quick PVP match has everyone temporarily pumped to level 80 (for the duration of the PVP), to have it an equal playing field.

Why do we have Level-Up again?

And don't tell me it's because that's always how it's been.

There are several reasons, but for pragmatic reasons, level-up is there so you are not bombarded with so many attack options at the start that you don't know how to use them all.

Level-up is so you can work your way into learning new powers bit by bit since in a level-up system, you unlock powers a few at a time as you level-up. It forces you to concentrate on some new ability at the moment, sort of like a flavor-of-the-month power.

So that contradicts a bit with having everyone suddenly pumped to full power when in PVP. Imagine you are a level 1 player, enter PVP and so you're now level 80. You now have access to all these attacks, which do you choose? How are you supposed to know which to choose?

Three things come to mind:

  1. Force it: Learn by trial-and-error
  2. Get help: Have a friend teach you, or read up crash-course tutorials
  3. Learn it the way the game meant you to: Stop the PVP, and go through the single-player aspect and level-up to 80

I think having these workarounds is far better than having an unfair playing field, especially if we talk about tournaments.



In contrast, other highly competitive games always have everyone in an equal playing field.

Street Fighter characters all have access to all their attacks at the start, in multi-player Starcraft, everyone starts out not having anything researched, and you all start with an equal number of units.

It's no coincidence these two games have a highly engaged competitive community. It's also no coincidence the three things I mentioned above also work to some extent for Starcraft and Street Fighter.

Wednesday, May 30, 2012

Videogame Development Bookmark Map




Hi, I'd just like to share my small activity here: I'm transitioning my bookmarks from a list into a visual map, and I like the results so far.

I want to share the bookmark links to everyone interested in videogame development, so here it is: http://dl.dropbox.com/u/25260770/Bookmarks/VideogameDevelopment.xmind

UPDATE: The xmind file is now in version control! Git repository here: https://bitbucket.org/AnomalousUnderdog/videogamedevbookmarkmap

(Non-technical people can find there a link that says "Get Source" in an archive format of your choice. Just use that to download the latest version of the bookmark map.)


This is far from complete as I have a lot of bookmarks amassed over the years, so just check that link every now and then for updates.

You'll need the program called Xmind (http://www.xmind.net/). On that note, I'm wondering if there's a better mind-mapping program that outputs in text format so this can be put on a version control system properly. It would be nice to collaborate on gathering links.

Thursday, May 3, 2012

Open Image Annotation Initiative

Long story short: A tool to let you annotate any image and embed the drawings you made to that picture, while having the original file stay intact.


To senior artists, imagine you want to give critic or feedback to another artist's work. Perhaps the anatomy of his drawing is wrong. Perhaps you'd want to draw in red lines how things should be.

Normally you would open Photoshop for this, but what if you can sketch your notes for any image while in the browser, with pen tablet support?

To artists, imagine you are keeping a collection of files for visual reference, or visual peg, as they say, and you want to use your Wacom pen to sketch notes on your reference images, while keeping the sketch and the image separate from each other?

You could save it as a Photoshop .PSD file (because you need layers), but what if you want to annotate an animated .GIF file?

You could save the annotation sketches as a separate file, perhaps a transparent .PNG if you're clever. But that's messy.

What if you don't want extra files to manage? What if you could add "layers" to any image file type? "Layers" on a .JPG, "layers" on a .GIF, "layers" on a .PNG?

(I say layers in quotation marks because this proposed tool does not really add layers in a technical sense.)

The idea is to embed an archive to an image, with the archive containing your "layers" as separate, transparent images.

This hidden archive trick is not meant to be secretive; the file will be renamed to the extension of picture.zip.jpg, for example, if the filename is picture.jpg.

To programmers, you can perhaps see that is not as efficient as true layers as in Photoshop .PSD files. Perhaps, who knows. (Note: the open-source equivalent of .PSD files, .ORA files, are actually just archives. Unfortunately, .ORA is still in a messy state right now to be usable.)

But this tool is not meant for heavy image editing like Photoshop, it is a tool for adding quick notes and annotations to any image.

If you are still not convinced, the annotations can be saved as vector graphics data, ensuring a very small bloat on the original file. Perhaps as 8-bit .PNG files, if need be.


Specifications

There are two variations on how the tool can add sketches on top of the image.
  1. The sketches are saved as either .SVG or .PNG and stored in a zip file, embedded into the original image.
  2. Same as in no. 1, but the original file is included in the zip to be embedded. And instead, a new image, a mixdown of both the original image and the sketches will be the "front-facing" file.
Using the mixdown will add more file size, but ensure that the annotations can be seen in any web browser, in any image browser, without any special program, and yet the original file can still be extracted with any standard archive manager.

If file size is not an issue, the mixdown approach is more useful. To compensate, the mixdown image can be saved in a small file-size, low-quality .JPG if the user prefers.


Transparent Images

 

If the original image has transparency, the user can choose to use a background color to replace the transparent parts (for example, to add a white background on a black drawing to ensure it can be seen, even if it was posted to a forum that had a black background). A checkered square pattern will also be possible.


Pen Tablet Support

 

As noted, the tool promises pen tablet support, such as in Wacom pens. Pressure sensitivity is important, and attaining an, at least rudimentary, recreation of pen or pencil-esque quality is important for the tool to be artist-friendly.


Vector Graphics

 

Typed notes will also be possible, as well as simple shapes like a circle, perhaps an arrow, etc. The tool will allow you to edit the vector graphics (which means the SVG data needs to be embedded, so it can be recreated when editing annotations).


Target Platform


As for what the tool will be made in, I'm currently thinking between Python (as a standalone program), or Flex or HTML5 (as a web browser plugin). Perhaps create both standalone and browser versions.

Out of all of them, I am most familiar with Python, so for now, it will be a standalone program, made in Python, using numerous libraries such as wxPython, cgkit, PythonMagick, etc. Here are the plans for that.


Viewer Program


In the plans is also a lightweight tool to view these kinds of images, and allow toggling display of the annotation sketches. Preferably it would be a plugin to your favorite image browser and web browser. Among the two, a web browser plugin is the simplest path. So that will be given priority. As a start, a Firefox add-on for this is planned.


Open Source

 

I heavily prefer that this be released in an open-source license, but I am unsure which license to use. GPL is seen as restrictive for other people, and yet all my favorite digital content creation tools use GPL (Blender, GIMP, Inkscape, MyPaint, etc.).

I would not want there to be closed-source derivatives/modifications to the Open Image Annotation Initiative, because a tenet here is it should still be usable without any special or proprietary plugins (the original file can still be extracted using any standard archive manager).

The tool will use widespread and readily available data formats: Zip, PNG, SVG, and perhaps JSON or YAML for miscellaneous information.



For interested programmers:


Git repository of work-in-progress here: https://bitbucket.org/AnomalousUnderdog/openimageannotationinitiative

Friday, February 10, 2012

Attributes

Here is what I have been thinking about this whole time:

  • Arm Strength: Powerful arm movements. Affects melee damage, and climbing
  • Arm Dexterity: Quick, flexible arm movements. Like in martial arts. Contributes to actions like parry, flurry strikes, and acrobatic movements.
  • Arm Endurance: Maximum stamina for melee attacks.
  • Leg Strength: Powerful leg movements. Affects melee damage for kicks, faster travel time (i.e. speed)
  • Leg Dexterity: Quick, flexible leg movements. Contributes to actions like evading, dashing, tumbling, acrobatic melee, and proper footing in melee attacks
  • Leg Endurance: Maximum stamina for movement.
  • Hand Dexterity: Fine motor skills. Contributes to actions like skullduggery, playing of musical instruments, or using firearms.
A high leg strength but low leg endurance means the person can do a short burst of fast sprinting, but he will tire away quickly.

A runner with leg endurance means he may not move fast, but in the last 200 meters of a marathon, he's still going at the same pace, while the others are too exhausted. Essentially he's a distance runner.

Separating arm strength and leg strength was because I figured there are brute-like enemies who have overbuilt upper body muscles, but slender legs. Top-heavy, as they say.

Separating arm dexterity and leg dexterity is maybe too much though. Though I understand there could be martial art styles that concentrate on kicks only. I think I won't go that far though, so I'll combine them.
  • Arm Strength
  • Arm Endurance
  • Leg Strength
  • Leg Endurance
  • Dexterity: Quick, flexible movements of limbs. Like in martial arts. Contributes to actions like parry, flurry strikes, acrobatic movements, dashing, evading, and proper footing.
  • Hand Dexterity
Having separate endurances for arms and legs meant that I'd separate stamina for arms and legs. Meaning the legs can get tired but the arms don't yet.

I figured they could be combined as well, as when someone is exhausted, he wouldn't be able to use both arms and legs anyway, so it doesn't make sense to have separate stamina for arms and legs.

The stamina they use are shared, in a way, though consumption wouldn't have been proportional for both depending on the action done (movement would consume more leg stamina and only little arm stamina, attacks consume arm stamina and a fair amount of leg stamina, because proper footing when attacking can also be tiring).

It then made little sense to separate endurances for arms and legs. So combining them:
  • Arm Strength: Melee damage for punches and swings.
  • Leg Strength: Speed. Melee damage for kicks.
  • Endurance: Maximum stamina to expend when doing actions, like moving, attacking, etc.
  • Dexterity: Quick, flexible movements. Like in martial arts. Contributes to actions like parry, flurry strikes, acrobatic movements, dashing, evading, and proper footing.
  • Hand Dexterity: Fine motor skills.
I'd then rename Dexterity to Agility, then Hand Dexterity to simply Dexterity:
  • Arm Strength: Ability to exert powerful force using the arms. Melee damage for punches and swings.
  • Leg Strength: Ability to exert powerful force using the legs. Speed. Melee damage for kicks.
  • Endurance: Ability to sustain force for an extended period of time. Maximum stamina to expend when doing actions, like moving, attacking, etc.
  • Agility: Quick, flexible movements of limbs. Contributes to actions like parry, flurry strikes, rolling, tumbling, evading, and proper footing. Also contributes to melee damage. Reduces charge-up time for melee attacks.
  • Dexterity: Fine motor skills. Nimbleness of fingers.
I could change Arm Strength to simply Strength and Leg Strength to Speed, but I have characters that are slim, lithe, but have high kick damage, essentially high Leg Strength. It would not make sense that their attributes reflect a high strength score when they are slim and lithe.

Thursday, February 9, 2012

Garwolf Gives Up


I was mulling about how Garwolf gets his forceful closure with Serin and this is the scenario that always plays in my mind. It is unusual that this pessimist bypasses the first four stages in the Kübler-Ross five stages of grief.

Garwolf trudges on, disregarding his grevious wounds. "I need to save her", he says. 
Mayev can only watch in despair. Is this what love really entails?

Arriving at the scene, he staggers and stops, lets out a soundless gasp. Once he remembers himself he darts for a place to hide. At this point it all feels rather foolish. What a stupid notion!

He stays quiet and lets them pass in peace. A sigh escapes his breath as their last footstep echoes away. His vision lingers as his thoughts wander, "I wonder what do heroes do, when the world doesn't need their brand of saving."

Eventually Mayev finds him passed out. Dead birds dot the path.



Garwolf finds himself in a lady's room, his wounds dressed.

"Do not banter. They still bleed." Mayev inspects his face, her concern more than physical needs.

His face limps like a lifeless manikin, drawn in a perpetual stare, without joy, without hate.

"Sometimes," he speaks tentatively, "Sometimes I wonder. What it feels like to give up and surrender." He direct his gaze at her. "It would be so much easier.", he whispers.

While she could not escape the flattery, she shakes her head, "You need to rest."
As she closes the door, she could not help smiling.


Mayev kisses him, but something wasn't right. It was like kissing an unresponsive doll.

"No, no, no, no!" "What are you doing? Fight back! Fight back! You always fight back!"

To be continued... Garwolf will find himself fighting one last time before hope is fully stolen.