Friday, September 26, 2014

Arena - The Chaos Masterpiece

As mentioned on the previous post, about 5 months ago I took my first shoot at developing programs on my own and Arena was my first contact with game programming. Surprisingly it went pretty well, I didn't expect the results that I had since I knew nothing about C. The concept is simple, a text-turn-based game where you can battle some pre-defined creatures and get stronger as you win matches, the goal is to kill the last creature in the Arena, the Behemoth. 

I started by making the player structure, this task doesn't require much programming skills and it helps to get used to the language, that's why I choose it first. Basically, I just made a bunch of switch statements and lots of printf's, both things I was already familiar with. All I've done after this was really hard to me at that time and required some time studying the C language. Funny thing to mention is that all the code I was writing was in the same file, I mean, I had a 'main.c' containing my whole game, wasn't much code but still disgusting...

I created players, enemies, visualization on console, all the trivial stuff. Then I realised that I couldn't make that work together without having the basic knowledge, I thought "This code is getting pretty messy and I still don't have anything I can play with". That was the point I stopped 'programming' and started studying for real. I needed to know how to deal with pointers, attributions, headers, how to access variables, and so on. Summing up, I started it over again, best decision ever.

This second time I started by creating all the structs that I was going to use in the beginning, all the headers and files, and while I was creating the console visual I was already putting the values typed by the user on the right fields on my variables. So in a couple of hours I had the 'create player' functions fully working. I got excited and went right to the battle system, the disaster of course.

Pointing to the wrong direction maybe? 

It took me some time and a lot of testing to figure out how to manipulate my pointers correctly...but when I got that working, it flowed pretty well. After this phase I implemented the whole battle system, level up, some techniques, the 5 enemies and then, I had a playable game at last. The main functions were done and I was still excited to make more features, so I added in-game experience calculators, two more player classes, polished all the battle printf's, and I was done. 

Finishing a match against a globin at Arena

After playing it for a while I sometimes found myself leaving the game open so I didn't lose my character progress, that's when I decided to learn how to generate .txt files with the data I needed and load a variable assigning those values, so I could load my character and keep playing from where I left off. Even though there is no serialization involved, it was really tricky for me to implement at that time, but worked pretty good for that occasion.

I never touched the code since then. I thought of refactoring almost the whole project and write it properly, but.. I can't do this... my first 'game' ever, no solving problems skills involved, everything done from the top of my head, so I decided to leave it exactly as it is, a chaos masterpiece.

Thursday, September 25, 2014

#1 - Introduction to Game Developing

I first started trying to make games about 5 months ago, it was very casual. As science computer student, my goal was just learn how the C language works. I had to study the subject 'Data Structures' and my teacher was using C, I was clueless at that time... So I decided to study at home in order to succeed.

My first thought at that time was to make a game. A simple Turn-based C game where you create a character and battle creatures inside an arena. Guess what, I called it Arena. Type your option on the console, attack, use skills, level up and that's it.

Arena - C

The project is abandoned but the game is working, it's buggy but you can still save/load your character and level up until you are strong enough to kill the final boss, the Behemoth.
I was very satisfied in the end, learned a bit of C, got something working, good grades on the subject and a brand-new game for me to play.

That was just the start, after this first try I decided to learn Java. My goal was the same as the first time, study the subject of object-oriented languages. But this time, I decided to go further, 
ArenaGame 2D RPG in Java was born. 

ArenaGame 2D - Java

I started by following The Cherno's tutorial on java game programming. I watched the whole series in 3 weeks, the goal was to make a game from scratch, engine, mechanics, etc. To be honest, at start I was just copying code and trying to understand what was going on, but after several weeks working on this project, my Java language skills improved a lot and I found myself solving problems, writing code on my own, implementing features, things that I couldn't think of doing before, but this is a story for another post.

Finally I reached where I am today, still eager to learn more about game programming and currently working on a couple of projects. All my projects involving game development will be recorded here, so I can share/gain experience and when I finally finish each of them, I get to see the progress made, the problems I faced, how I managed to solve those problems and so on. 

More posts will come soon, I intend to do a couple of posts for each project, explaining in detail what is it about and showing the progress so far. Hopefully I can keep going with this and make it work.

Feel free to give any feedbacks.