The Logicon is an in-game calculations library. It helps the game developer by taking care of absolutely all in-game calculations regarding: damage, skills, hit points, scoring, experience, level-upping, stats, properties and whatever other term you might imagine and has a number associated with it.
I built the Logicon with Diablo 2 in my mind ::- ). I wanted to create a library with which I could power all computation in a game like Diablo 2. As it turned out, the Logicon went beyond that, increasing my development speed using the XML loaders I integrated in it, which also make it extremely adaptable to game-modding.
The Logicon can be used for any kind of game (hence, the mash-up of terms I used above), written in any programming language. Its small size of only ~1500 lines of code, clear architecture and C-syntax makes it very easy to port in any language. The original code is AS3, as the first game to make use of it is Alien Invasion.
Below, you can see a diagram which shows a simplified structure of The Logicon. The main class has many more methods, but I cut them out for simplicity’s sake. You don’t want to know all the details, do you?
Using Alien Invasion as an example, I’ll explain a few of the general features of this class library.
At the base of The Logicon lies the concept of “Modifier”. A Modifier is, at its rawest form, an object wrapping a Number (Float). There are two types of Modifiers: Base Modifiers and Influence Modifiers. You can probably guess where I’m going with this. To confirm your guess: in Alien Invasion, the hit points of Bunkers and Flying Saucers are Base Modifiers, while the damages of all Weapons are Influence Modifiers.
The Base Modifiers offer a notification function for when their value changes, while the Influence Modifiers also provide various events.
Each Modifier type has an inheritance branch which perfects it and adds nifty new features to it.
Simplified Diagram of The Logicon
The Temporary Base Modifier, as its name implies, will only be in effect for a certain time. It’s useful for temporary boosts. And yes, The Logicon allows modifiers to stack on each other, using a unique Modifier Type ID. Furthermore, Modifiers can be percentile or numeric. And to top it off, they can be organized in Tiers, which allows the percentile Modifiers to be applied only in a certain order. This makes The Logicon extremely versatile.
As its clear name implies, the Perpetual Influence Modifier is used to make sure that a certain Influence Modifier gets applied more times to a target. This could be used for a poisoned arrow, or a weapon that causes bleeding. Influence Modifiers can also be percentile and numeric and can also be organized in Tiers. Of course, they too can be stacked. Furthermore, Influence Modifiers allow automatic randomization, to give you those “sweet” damage ranges you see in so many games.
The Logicon also has some internal logarithmic functions which are used to provide nice, gradually increasing difficulty in level-upping, or exponential-gradient functions with various curves of difficulty, for any imaginable game scenario.
As I completed the first version of The Logicon, I realized that this Library will probably pay a pivotal role in our future games. This is just version 1, and I already have a several optimizations and improvements in store for version 2. A C++/C# port will probably follow, as we (will hopefully) branch out to Unity / other game engines.