Sunday, February 22, 2015

Game progress: Defender Blender

This was a really busy week, however I managed to have a little progress with Defender Blender.
Defender Blender is a game I made for learning Unity, I'm still learning from it and experimenting playability, difficulty, and a some game design. I will talk more about it once I upload it here, for now I'm sharing the progress I had this week.

First lesson learned, after update Unity 3.2.something to 3.6.2 I found that my game was not working anymore, most of the collisions where working just sometimes so I was not able to hit the enemies, the player was not pushed to stay in the screen (it is pushed by an object at the left of the screen), and things like that, so I started to investigate and found that there where two reasons for these problems:

    1. Rigidbodies sleep. Seems like this is an old Unity feature (before 3.2 version), so I'm not sure how my game was working before :). In order to optimize the physics in Unity, the engine does not check for collisions unless they are required, i.e. only if any object's property that could affect the physics changes. Why my objects were not detecting some collisions? Let me explain.
    • You can have a Collider with Rigidbody, or without Rigidbody. A Collider without Rigidbody can actually collide with other Rigidbodies but only if they are awaken. A Rigidbody won't wake up when touched by a Collider. Some people use a kind of workaround for this (however, note that this is not a bug, it's a feature), they change the Rigidbody's position in the Update method in order to wake it up, something like: "rigidbody.transform = rigidbody.transform". The problem with this is that it is a kind of dirty trick that won't help your game's performance. So what is the correct solution?
    • When a Rigidbody touch another Rigidbody, it wakes up. So put a Rigidbody component in whatever objects you're going to move constantly (like the player, the enemies, the projectiles). Adding a Rigidbody to some objects fixed my issues with some collisions.

    2. Methods in animations. After adding the Rigidbodies to some of my components I was still having problems to attack my enemies, it was like there was a kind of random factor that could make it work, or sometimes delay the collision. Actually I was able to see the collision happening in OnTriggerEnter method, however it was still not working. Then I found out that the issue was because the logic I used to activate the collision of the player's weapon. I used a method call from an Animation as you can see in the screenshot:
StartAttack() method activates a boolean variable that decides whether the sword collision is going to happen or not, this was needed because even when the Collider was really small when not attacking, sometimes the enemies just died because they touched the Collider inside the character.
So the plan was: when the animation starts, call StartAttack(), so the collisions are processed...
Well that is how it worked before, however animations seem to not have a lot of priority for Unity in processing, they are visual components, it's not a really good plan to depend on their accuracy to fire events in the right moment. Instead I called StartAttack() from the method which starts the animation. That fixed my problem.

What is I was really planning to do
After solving these bugs I started what I actually was trying to do, I added a new component to my game: Walls. I'm planning to use them mainly to teach the player how to jump because I noticed some people struggled to notice that keep the jump-key pressed make the character to jump higher. Also I want to use the walls to teach some other movements in the game, I will use them in a new How-to-play level.
Since my game uses physic objects as Kinematic objects, it does not use the physics engine to affect the objects movement, it only detects the collisions, so add a wall is not as easy as drop a rectangular Collider in there.

The Kinematic Rigidbodies/Colliders know they are touching each other, however they don't know the direction of the touch, so I can't just program my character to stop moving when touching a wall, because then it will stop as well when walking above the wall (it must be able to work above the walls). I was planning to use a different Collider on the top of wall but it was going to be messy. My plan so far is to do it by comparing the wall's position and the character position. When the player is above the wall, the wall will behave as a platform, and when the player is in any side of the wall, it will act as, well... a wall.

Well this is work in progress, after complete the programming of these walls, I hope to make a post about my how-to-play level design. See you next week!

Monday, February 9, 2015

Doing and learning - my plan so far

Well, I'm still fixing the laptop in which I have my games so I won't share a new game yet but I really don't want to stop posting here, so I will share what is my vision so far about what I want to do here, you might find it useful if you are starting in the game dev world.

When I was 13 (I think) I started my first game using RPG Maker 2003, working on it was wonderful and I was really trying to make the perfect game for me, there is a long story about that but I don't want to go that way now. The point is that I spent about 5 years working on it from time to time, then I stopped doing it for a while, and about two years later started another project, it was not exactly a game, it was not exactly a PC gadget... well, there a long story about that too, and for now I'm not going to go that way either, I will just say that I worked on this project for about 3 years.

So, I could say I have 8 years of experience creating games, but it would be inaccurate and pretentious. I definitely learnt a lot of things in those two projects, but there is a learning curve that indicates how much you can grow in a single project.


The more you learn, the more you can do, the more you repeat what you know to do you get better doing it, but you stop learning new stuff. As you can see in that simple graph at the beginning you are basically a poor useless baby guided by Google to make your first horrible drawings, flooding forums with newbie questions and experimenting with whatever you think would be useful. Time passes and you learn some stuff, that stuff can have you busy for a while, you start your journey with some drafts in your mind and create your first works. After a while you feel really comfortable doing what you learnt to do, but maybe you don't even bother in look again and find if there are new and more effective ways to do what you already know to do.
Chances are that by that time you will have a long term project in mind that needs a lot of work, if that is the case you can spend a lot of time doing things you already know to do, and not learning much.

Obviously this is a simplistic way to view it, probably you are learning less stuff, but the few things your learn are complex and difficult to conceive for a rookie... anyway, it's dangerous to take this way if you are not looking to become a very specialized person doing those very specific things you know to do.

Why am I explaining this? well, as I said at the beginning I wanted to explain what I'm trying to do with the projects in this site (I know I have uploaded just one so far xD, but promise I will upload some other game as soon as I fix my computer).

I want to make some fast projects, different styles, different types, different platforms. Then improve them based on your feedback and take each project as far as people ask, or at least as far as I feel proud of the result :P. I'm planning to take a Non-Zero Week approach, i.e. I will try to post some progress here at least once a week.

I already know I can fall in love with a single project and stick to it for years, it's time to take a different approach and experiment a little more. I'm specially interested in experimenting game design ideas, gameplays, how to make an appealing game, how to make them fun, how to teach the players to play the games, how to transmit the sensations I'm looking to transmit to the players, even how to explain some philosophic ideas. I'm not discarding experimenting different technologies too, but that is not my main learning objective for now.

Would be great to know what you think about this project, so please leave your comments below!

Monday, February 2, 2015

I survived my first Global Game Jam

How to survive to the Global Game Jam? Even when I have some experience making games, I don't pretend to be an expert, I have just participated in a couple game jams, for the first one (Winter Jam) we didn't finish our game, for the second one (Global Game Jam 2015) we completed Burn & Run Kamikaze Heroes (BARKH), and I am very satisfied with it actually. So, what was the difference?
  1. Scope
  2. Emergency exit
  3. Organization
  4. The basic stuff
  5. Luck
Scope
We programmers have a mental problem, we are always too optimistic, not necessarily in life but when coding we are. When we started with BARKH's idea we discussed a little about how should we do it, I was planning to do it in a kind of open and dark place, Lal0l thought about it as an auto-generated labyrinth from the beginning, and we were really close to go for it, however we decided to do it just if we would end up with some extra time (yeah sure). So we decided to do a hardcoded labyrinth. I'm pretty sure that do the auto-generated one would take most of our time because of unexpected bugs.

So the tip here is: If you have an idea that sounds kind of complex, but possible. DON'T EVEN DARE TO TRY IT, the Jam have enough things to invest your time on, but discover how stupid you were when you though it was going to be simple it's not a good one. Better to use a temporary version that works and can be thrown away if anything changes in your plans.

Emergency exit
If possible think different ways to make your game a playable game if something terrible happens. Imagine that suddenly they say you will have only the half of the time you originally thought. What would you do? what would be your real scope? can you cut a couple levels? can you remove all those extra abilities and super powers? would your game be playable without them?
Think how could you do your game playable without all this, and make sure the emergency exit is actually easy to follow.

Then if you find out you are running out of time you can go for one of those exits. Remember, it is much better to present a short complete game, than a super cool idea that you didn't finish.

Organization
Well I have not that much to say about this (we were only two in the team :)) however in the previous Jam we were 3 in the team, and I can tell that 3 laptops running Unity were not as useful as two laptops well used in the GGJ. Since only one had Unity installed we made all the Unity stuff in one of them, the other was used for graphics, music, sound, investigate, get resources.

Maybe this piece of advice is obvious in an heterogeneous team, but if you are a bunch of programmers, don't mess with GitHub for a 2 days project, use your resources to get all the other stuff done and ready to be plugged into your game once the main gameplay is done, e.g. the title/credits/gameover screens, the music, the sounds, and so on.

The basic stuff
I think this one is the one which I noticed lacking more in the projects I saw in the jam.

  1. Screen flow. A very simple step which makes a huge difference in how a game "feels" is whether it has a complete screen flow, i.e.:
    • Title screen - give a good first impression
    • <Optional> Story - explain what is the player trying to do, is the player trying to find anything? kill anything? survive? make the player's mission important. If you don't put this screen at least explain the purpose of the game in the gameplay.
    • The game - well this one almost nobody forgets about it, those who don't have this are the ones which go and explain that they didn't make it on time.
    • <Optional> Game over - show a quick screen when the user dies (not just reboot at the start of the level). It makes the game to feel more complete and you can use it to reinforce the theme of your game, or even make the player laugh and give another try.
    • The win - reward your players with a good ending, is the less you can do to thank them for playing your game.
    • <Optional> Credits - recognize all those who helped to have the game done.
  2. Music & sounds - music and sound makes your game to feel complete, they are not just additional stuff, music helps to give a feeling to the players, and sound give them feedback about the game itself, "was that something good or bad?", "was it an interacting object?", "did I click that button?"...
  3. The GAME. Why your game is a game? can I win? can I loose? is it difficult enough to be fun? is it easy enough to be played? does the player have a purpose? is it fun? Of course that some types of games don't really need all this, but most of them do.
  4. The theme. How is your game related to the jam's theme? The theme is a tool to push you in new ways of thinking, I mean, if the theme is pushing you to make a bad game obviously you need to keep thinking and bounce ideas with other people. The theme could push you to learn new stuff, if you only know to do Mario-style platformers, then doing something similar is fine but the theme could help you to explore from other perspective, instead of just make another Mario.
Luck
Certainly you might need a bit of luck, for example the day that the GGJ began my computer's hard disk crashed, it got damaged so I couldn't bring my computer with Unity to the jam. That seemingly not really nice coincidence forced us to do what I explained in the point above about organization.

Will you find good a team? will you find those free resources you need? will your brain want to work and give you a marvelous idea? will your computer explode?
My advice: a positive attitude to whatever happen in there will make the difference between a really awesome weekend and two days of frustration :).


Hope this help you for your next jam!