Pages

Sunday, March 25, 2012

OGPC

Oregon Game Project Challenge is a game design challenge to build a video game using any language you'd like . Myself and another programmer along with other team mates will enter the competition using C#, my favorite language. The team, File Not Found, has participated since OGPC has been around, 4 years. This will be my second year. Last year we came in second to Phred, a team from southern Oregon. We have won once, and come in second the other 3 time. This will be OGPC 5.0, or year 5.

This year the theme is Urban Planning. We have yet to come up with a design, however I have begun to build a library flexible enough for most RPG style tile games. I only have 2 levels of the hierarchy done, so not much work, started about 30 minutes ago. More updates to come.

TNariksan

Thursday, February 16, 2012

On Combat

Its been awhile, and I took a little break as the coding was beggining to get monotonous. But I have made a small amount of headway in the area of combat protocols. I'm trying to make passive protocols, only called an update the server when something in the clients game state changes. This is a tad harder than I'd expected, but I am getting there.
On another note, the Lua side of the engine is coming along, it helps to have the versitility of a scripting language as well as the tools of an API like XNA. Just a small update, but I am still here.

Tuesday, January 10, 2012

On Spells and Effects

Any good game usually has a well developed and balanced magic system. The system could use some type of rune or scroll, keeping the player having to carry around their spells instead of having them acessable in a spell book and could be cast at any time. It's all on how you want your game to be balanced. With a game that contains, muliple classes, one might want different spells for each class.

The way I am designing my spell system, is that certain classes have access to all healing spells. But some spells are cast more efficiently by a Monk. And then there are global spells, which every class can learn and use all the same, a simple healing spell or a basic fireball. After playing the game Skyrim, great game might I add, I took a look at their classless system but allowed for specializing by exp of skills. Eg, the more you use your sword, the better you will be with it.

Today I wrote my buff and effect classes, I'm still working on them, as it's getting late and I'll finish it all to arrow, but the way I currently have it is that the buff is applied to the players stats, another class, increasing whatever stat is effected by the effect from the buff.

I am pleased to announce my GUI quick bar is finished. I use a heavy Lua system to call the functions on a key press, it works,and every key is changeable from a text file, but I'm thinking about making a small redesign. First I will have to learn more about Lua vs C#. And how functions are addressed from each language and how I can create effective scripts to later implement.

I will be debating uploading my code.  I'd like to take the path of open source, but at the same time, I'd li,e to develop on, my own, to claim it as my own work at the same time.

As always, with best wishes in your coding adventure,

TNariksan

Friday, December 30, 2011

On Graphical User Interface

The Graphical User Interface, known as a GUI or UI is one of the most important aspects in a game. It is what allows your player to understand the chaos of the game world. The UI gives the player information that if the game were real, the 'player' would already know, eg. Your health. The human doesn't have some meter attached to them telling them how healthy they are, no. A person knows when they are sick, or if they get a cut.

My current project has been key bindings in a GUI. Anyone who has played World of Warcraft or many other games with a multitude of abilities or spells (Dragon Age: Origins, another example) knows that you don't always have room for every ability or spell on your GUI and it ruins the game experience to have to open the spell book to cast a spell every time. This type of GUI mechanism is called a QuickBar. Each slot on the bar is bound to a key. At anytime one can either change to binding of the slot, or the spell in the slot.

First i wanted key bound spells. So i sat down and attempted a flat out c# solution. No success. Now, either i'm missing knowledge, (which is very likely) or it just isn't possible in a language like C#. To fix this i used the Lua wrapper, LuaInterface. It wraps Lua into a dll (for windows) and gives the programmer access to a Lua Virtual Machine. You can feed to VM scripts, which it compiles during run time and executes. I wrote a simple script that takes in a C# method and a key, links them together in a table, and when given a key, calls the linked function. Problem solved.

Now for the GUI implementation of this.... which is a WIP. I've currently coded the QuickBar and am researching live Combat Systems to get a better view on spell effects and such.

Until next time,
TNariksan.

Thursday, December 15, 2011

On Scripting

One of the more useful features i have come across is a scripting language. From may WoW days, i picked up a little of the language known as Lua. Its is a dynamically typed object oriented language. Meaning you don't define variables, and variables can even be methods. That's right, METHODS!

While trying to conquor the problem of key binding, custom user key binding (Aka, the user can set any key to do whatever they want), i came upon a problem. How to do this? I can't just assign the key 'K' to execute, WalkForward(). But with Lua, you actually can, in a way. You can use a table(with a key and a value) to use 'K' as the key and WalkForward() as the value. Now that i sit here and type this, i am most positive (not 100%) that C# probably as a similar data structure, possibly. Though i will still stick with the Lua fix because writing in a scripting language will much improve my game in the long run.

Ask yourself: Why is WoW so popular? It's because you can nearly do WHAT EVER THE HELL YOU WANT.
Custom GUI, here you go.
No Gui? Got your keys memorized? Sure. Macros, hell yeah.
GIANT ASS WORLD?! Got that too.

This is what i aim to replicate. The sheer depth of the game. Players will customize the game, i only provide the means to do so. This means custom armor (yes, you will be able to make your own armor, no not in the traditional, 'smithing i need 5 copper and 10 bronze to make a chest plate' No, you'll be able to mix and match metals to make alloys of various strength, the mix will determine what colors you can have your armor appear, its resistance to damage types... and so on.) custom building, custom enchantments, i've even thought about a language that would allow you to write words down in books, then if you click on the books, it would cast a custom spell.

All this would not be possible without a scripting language. Scripting means compiling while the game is running. You don't compile it until it is needed, that is the beauty of it, along with other things.

To Sum It Up: Scripting is beautiful, use it to take those leaps you couldn't with your core language. Learn a scripting language. Use one, it can make your life easier.

TNariskan.

Wednesday, December 7, 2011

On Positioning

While coding the element that would allow the player to select a target I ran into the problem of assuming the reference point of my sprites (2D pictures) was in the upper left hand corner, as was the default. For the animation of my sprites, i use code written by Microsoft in their Platformer XNA Demo. The reference is changed to the middle of the bottom of the sprite (for collision detection reasons). After a good fifteen minutes of staring at the normal rectangle bounding intersection statement, i came to realize this and corrected the problem. Only now it works, but only if the mouse if anywhere off to the upper left, yet not inside the actual sprite. Just one of the many bugs a programmer may run into.

TNariksan.

PS. I will attempt to answer any bug questions posted if you may be having similar problems. Also, i apologize for not posting more. More on my latest game system to be implemented. I'm working on a system that would allow the players to learn words (in some lore related language) that would be able to be combined with any other words to create effects, being a totally dynamic system, it has to be nearly bug free.

Monday, November 21, 2011

On Libraries and Overall Architecture

A very useful tool if you may be reusing classes or large parts of code in different applications is a Library. A Library is a collection of classes one can use simply by adding a:

 using LibraryName.Subfolder;  
 import LibraryName;  

at the top of your code. (using for C# and import for Java). I have many classes i reuse on both the server and client, for example a Class.

##Note: from here on out, Class will indicate an RPG class. class will indicate a code class.

Eg: Class - Mage. I have to reuse a lot of the damage and or stat calculators as i calculate data both client and server side. Instead of simply copying classes from folder to folder and worrying about whether or not both classes are updated on both the server and client, i can simply edit my Mage class on the server and it will update on the client.

THE DOWNSIDE: You cannot address the client or the server from your library code. I'm running into problems where my network streams used to communicate from the client and server cannot speak directly to my client or server code. I have to use a retriever to extract variables from the stream classes. It is a work around, but not the best coding practice. Normally you'd want to use a method from inside the class to pass variables out.

Architecture is something many people over look when building their programs. Of course, the user will never see just how your code works, unless you a) open source it, or b) allow it to be read. (Blizzard has released a viewer so you may read their code, some funny comments in there.) I like designing architectures. The overall structure and order is needed for me. Some developers program as they think up ideas, or some dive right in. But i like to take it step by step. Today improved my class system with a better inheritance:

Classes:
      Caster                                                                                                                              Melee
Healer            Damage                                                                            

Monk,         Tempest, Mage                Knight, Reaper, Titan


Poorly formatted, but you get the picture. Healer and Damage(Caster) inherit class Caster. while at the moment  Knight, Reaper, and Titan inherit Melee. Monk can inherit both Healer and Damage, or just Healer, haven't decided. And Tempest and Mage inherit Damage. This does not mean one Class can only use Healing abilities or Melee abilities. Each Class will be able to use any abiliy, or a large range of them, however, one Class will be better suited to heal or deal melee damage.

Architecture is important, you have to know how your code will work and the most efficient use of code. Languages provide a powerful reuse system already with inheritance. In C# the only thing one must do to inherit is thus:

 public class Mage : Caster  

However , Java must supply a type of inheritance:

 public class Mage extends Caster  
 public class Mage implements Caster  
 The first means you may modify any existing methods in the parent or super class. The second means you are using an interface. More on interfeces later. They are very usefull for RGP's and being able to define many different classes with one statement. (Quick example to clear that up, horrible wording)

EG:

Player testMage = new Mage();
Player testKnight = new Knight();

Player would be the interface here. I'll explain them fully in the next entry. For now, tata.

Push on my friends! Many happy coding adventures.

TNariksan.