.:: Alex Erne :: PHP/MySQL & Unity3D/C# projects ::.
Recent news
* advertisement *
  02 June 2017 - Almost able to create a (ungeared) character :: Posted in d20 project

For the last two weeks I've been working a few hours a day on the d20 project again and things are going quite well at the moment. I'm even at the point to make the announcement that I'm close to finishing the basic character creation To get this done I had to make a character sheet (from UI elements), create a character as I would when playing Dungeons & Dragons with pen-and-paper and see what's missing or not going as it should (good thing I've played [Advanced] Dungeons & Dragons for almost 3 decades ).

When running the character sheet, I can add a basic class and occupation. The occupation can only be selected as long as your character has no XP, and the skills and feats that come with it do influence those of your basic class. Having selected both occupation and basic class you can add points to your skills. Also stuff like AC, saving throws and Base Attack are calculated completely automatically - no need for you to spend any time (or when you're using the d20 project as plugin, extra code) to it.
When your character levels up, new skill points and (bonus) feats become available to choose from, as well as the option to pick a new class (basic or advanced - if you match the requirements for it). The only error I found so far is that I forgot that every level the character gains it'll get a free feat and am currently busy adding that (it's kinda like the bonus feat code but with a few changes).

I think somewhere next week I've finished the basics. I will then take a week to fully test it and see if I can find any errors in the mechanics and/or code. If I can't find one. I'll make the program (not code!) available for all to test is more thoroughly, while I'll start on adding the whole inventory and gearing system. I already have both coded, but now I need to implement it as part of gearing up the character and let the character 'use' it all.
And speaking of using, I also need to implement skill and feat usage. Though I think this might be pretty simple, because all I need to do is check DC and roll a couple of virtual dice

Last but not least, I've implemented ExtensionMethods for the plugin. This way you don't really need to know how I've coded the whole thing, but instead use simple methods to get the stuff done, while the code behind it does all the calculation, adding/removing of items to the massive amounts of Lists<> used and such.

Post A Comment! :: Permanent Link
  23 June 2016 - Rebuilding the Feats :: Posted in d20 project

When I started on the d20 project, I added the data structure for the Feats quickly so that I could add the advanced character classes as well (they have some feats as prerequisite). At the time the way I've set up the structure for the Feats seemed okay...

Now with me wanting to implement the Feats as a whole I found out that I made an error with my thining on how the Feats should be implemented back then. TO save work I used a 'specialization' level for the feat so that I could include the regular, improved and advanced into one class. But now that I've come at the point where I'm testing the d20 project code by making an actual character, that no longer is sufficient enough.

Some of the Feats, and most certainly the improved and advanced ones have specific prerequisites for the chatacter to add them. Let me take the Combat Martial Arts Feat as an example.
The normal Combat Martial Arts Feat requires the character to have a Base Attack Bonus (BAB for short) of 1 (a score that almost every Strong Hero can obtain at level 1). Improved Combat Martial Arts required the character to have the Combat Martial Arts Feat, as well as a BAB of 4, and Advanced Combat Martial Arts required the character to have a BAB score of 8.
Other Feats have also different prerequisites for the character to take them, like one (or more) minimum ability scores, a minimum number of ranks in a Skill and even multiple Feats.

And while at it, the benefits of some Feats have different effects. Where some Feats directly influence the DC of a skill, other Feats allow you to select a skill that it affects, or you can select it multiple times for some piece of gear you're using. This also is a reason to take a closer look at how Feats I wrote the Feats at the start of the d20 project and how I need to modify and add to the way Feats work...

Post A Comment! :: Permanent Link
  20 June 2016 - using d20Modern; :: Posted in d20 project

I've already learned the basics about OOP and the use of Unity3D and C# when I was working on TetraGems, but now that I'm working on the d20 project, my knowledge about them is exploding!

After yesterday's blog post, I've been extremely busy recoding large portions of the d20 project. As said yesterday, the use of extensions will become one of the primal additions I'll be working on the coming days, so that the used of the d20 Modern plugin will mainly be using the classes (and their extensions) that are part of the d20 project and no longer will be calling to methods in the scripts of the plugin.

A lot of these extensions will be called from the d20Character class and thse are mostly to get available options (feats, talents, classes and the alike) that are available, as well as adding them to the new d20Character class.

There are also 3 bool extensions available for the d20Class class, to check if it IsOccupation(), IsBasicClass() or IsAdvancedClass(). These checks (which
comes from my thought to merge all 3 different kind of character classes into one enum, and with that conform to the rest of the code where I'm linking to the enum name and not the int value of it) are needed because each of the 3 character class types have their own class properties, with the occupation being the real weird one and not actually being a class since it can't gain XP and level up.

Having started to code these extensions, I had to give them their own namespace, which I called d20Modern. I could have dropped all these extensions into the global namespace, but that's not really a professional way to handle it , while using my own namespace does look kinda cool

Yet, there's still a lot of methods that I need to move into the extensions. And while it's very easy to do (like I said yesterday, I'm just calling the method from the extension with correct parameters), I do need to check the code as a whole if I'm using that method elsewhere, and I have to rework the example project as well...

Post A Comment! :: Permanent Link
  19 June 2016 - Rewriting/optimizing parts of the code :: Posted in d20 project

With the d20 project growing more and more, I've also been thinking about some of the userfriendlyness that the plugin needs. As programmer of the project, I know all the ins & outs of the code and know why I've done some of the things that are in place. But I can imagine that a user of the plugin would have some questionmarks at some of the (current) code and choices I've made.

One of the examples of the (current) choices I've made is the way you add feats, classes and other stuff to your character. At this moment I'm simply calling a method to add one of these things from the code. Much like the following:
          d20Classes.AddClass(myChar, (int)d20Class.StrongHero, true);
While the first two parameters are pretty clear, the third one is not. Why add a boolean value there to tell if I want to add the class yes or no, while the method is called AddClass()? Well, that has to do with the internal workings of the method. I'm also using it to determine if a class is available to take, and then I should not add it to myChar
It's exactly that why I've taken an other look at how the code of the plugin shoudl behave. I want it to be 100% lear for the user of the plugin what's going on in the code without too much dabbling with the mechanics I'm using to let the code function flawlessly.

My first thought was to include these methods as part of the d20Character class, but looking at the number of methods that are already used to Add and Check data within the d20Character class is huge, and I'm only at about 75% of coding the d20 Modern RPG basic rules, with FX and Psionics to be added later as well. This would mean that the d20Character class would become one massive (memmory hogging:!:) class. And while one such class used would not matter a lot, in a RPG you need this class dozens (if not 100s) of times, because not only your main character is using it, but also most (all?) of the NPC characters that are out there.

As an alternative I figured to make these methods an extension (or rather someone on reddit reminded me of that ). And with the code of the method already there, all I have to do is add a very small extension for it, and the above example looks like:
          public static void AddClass(this d20Character myChar, int myClass) {
            d20Classes.AddClass(myChar, myClass, true);

This small extension makes it possible for me to make the same call now like:
A call that's a lot smaller and makes more sense. Afterall, you're now just simply telling to add the Strong Hero to myChar with one clear instruction without any odd stuff around it (like that boolean value). More importantly, for not being part of the d20Character class, the size of the class stays the same as it already is (which is already pretty big I must add )

Now I have to 'translate' all the methods that I've written in the past into these clear extensions. Though it's not a ot of work, I do need to go through most of my demo code again to see which methods I'm calling, make the extension code and then rewrite that demo code.

And while at it, you might have noticed that I'm also using a cast to int for the character class ((int)d20Classes.StrongHero). I'm using this because I have 3 different enums that are linked to the d20CharacterClass class. These enums hold the hero's occupation, the basic class and advanced class, and I'm musing to merge these 3 different enums into a big one so that this cast won't be required anymore either. I just have to take a close look at the code on how to implement it in the best and most efficient way...

Post A Comment! :: Permanent Link
  07 June 2016 - Age, aging & death and how to implement them (if at all) :: Posted in d20 project

Progressing well through the d20 Modern rules, I desiced to implement the occupations compeltely. That means that I still have to allow the player to add a couple of skills to the character, which will add a +1 to the class skill use as well as a feat that some occupations give. But one of the things to implement is a minimum age requirement that all occupations have. And this kinda made me wonder...

Where in pen-n-paper RPG playing age is a thing that would allow the DM to to add timed progress for the character and even death (both being killed or even old age), in a computer game this is something that's less used. Where in the pen-n-paper campaign you can easily reate a new character at any level to match your fello friend's characters and the DM can give you a certain amount of ''starter equipment", in a computer RPGs this is not so much the case. Also, the DM can at any time change the course of the planned story the way he wants to. This is to match the development of the characters and how the story evolves.

Computer RPGs are far less flexible than pen-n-paper RPGs for the simple reason that the DM (the computer in this case) has a set story and can't change things at all when the character evolves and the story unfolds. It's a rigid path that has a start, middle and end. There's no evolvement of the story other than what's been programmed on the character's statistics and how the player interacts with the NPCs. Of course computer RPGs can have a certain amount of flexibility, but that would mean that the game must have tons of options ready along with multiple possible endings of the story.

That all being said, now lets return to today's topic... Age, aging and (permanent) death. In computer RPGs you barely see these them. Age is mostly used for cosmetic purposes only while aging is mostly null and void in computer RPGs, if aging is implemented at all... While death in most computer RPGs is nothing more than a setback with some optional XP loss and a restore to a previously set point.

But what if both aging and death are implemented in a game..? Aging would mean that at a certain age your character would become wiser and physically weaker, until at a certain point it will die of old age. Would this mean the end of your game, or can you continue with a child of that character? And if it has a child, it should have had some interaction with the opposite sex to concieve the child and should have spent time to raise it. This child in turn could inherit some (or all) of the original charatcer's items and continue with the story. But would that be fun..?

Then an other thing, I'm right now busy coding d20 Modern, which is somewhat set in our world. Death in this world is more permanent than death in a fantasy setting where a diety can grant new life to the character. If you die in this world, you're just DEAD! Perhaps in the (near) future there are ways to cheat death (cloning to name one), but right now you can't.

This brings me to an other problem with d20 Modern as computer RPG system: how to handle death? If computer RPGs are about the story the character goes through, how will it be challenging if your character can't die to be able to reach the end of the story? This means death MUST be inplemented along with some of the earlier mentioned setbacks. But I can't just figure out how to resurrect a player in our current world, other than those few lucky ones which were clinically dead for a couple of minutes and got revived by CPR...

Post A Comment! :: Permanent Link
  04 June 2016 - Languages fully implemented :: Posted in d20 project

After having created all code for the talents, I figured that with the Smart Hero's Linguest skill I might as well work on the language implementation first, and as written earlier this week, I decided that languages would get their own class because of a fundamental difference with them in d20 Modern compared to d20 Fantasy (Dungeons & Dragons 3.5).

Entering the code for about the 50 languages named in the d20 Modern system was easy enough after I figured out how to get this working. Coding the use of the languages in the demo I'm making was a bit harder though. While coding the demo I also found out that there were certain calls to the main d20project plugin that I still had to make.

 photo d20project 20160604_zpsyjqvji2k.png

One of the most challenging issues at hand was the use of a prefab that uses 2 dropdown UI menu items. While it might look easy from the user's poitn of view, the Unity engine has a terrible flaw here that resets the 'Label' object to that name back again when you've made it a prefab. And while not overly important, the 'Label' field is used to show the 1st entry of the options list when the prefab is loaded.
The easy way around this would be by making 2 small pieces of code that would control the 2 different dropdown UI menu items, but that would kinda screw the interaction with the 2 toggle UI items and 2 UI buttons I also have in this prefab. So instead I've had to be very creative to work around this issue and as you can see (in the above picture) I managed to get it working.

An other technical issue I bumped into was that the dropdown UI menu options are converted to the string type, while the languages values are stored in an enum type. Though this might not sound too significant, it did give me a lot of problems when coding the OK button, where the language selected would be added. Unlike when adding an option from a single menu dropdown, where you can simply point to the field in the list with [dropdownmenu.value], using 2 dropdown menus where one selection (language groups) changes the list of the other (languages itself), this direct approach is not available. Instead I had to compare the string type of the current selected language with one the values in the enum type. And eventhough C# is very flexible with casting one value to an other, it is impossible to cast a string type to an enum type As a final option I had to write an extension class that's much like the ToString() one to convert the string holding the selected language into an enum type from the language list.

Now "all there's left" to code for the d20 project is the implementation of adding talents for the basic hero classes, of which I have already done most of the work and a simple popup like the one used for languages is required to get it working (and test the code immediately). After that (when my test character hits an even level) add the (bonus) feats in a similar way, including the special feats (not actual feats, but pretty much like them) for the advanced hero classes. When those 2 are coded, a couple of small tihngs need to be fixed/coded in the usage of the core rules, like reputation, action points and wealth. After that only the 'big thing' to implement is of the hero's gear and equiment of it remains, which will still need some work I fear...

Post A Comment! :: Permanent Link
  31 May 2016 - Languages their own Class() instead of Skill :: Posted in d20 project

While adding the talents earlier this week and being stuck on the prerequisits of the Smart Hero's Linguist talent (Research talent tree), I found out I was making an error on languages in d20 Modern.

I've been used to d20 (Fantasy, or rather (Advanced) Dungeons & Dragons), where the Speak Language skill can be obtained a couple of times, each time for a new language. When obtaining Speak Language you could automatically read/write it *caugh* impossible in illiterated medieval fantasy settings *caugh*. In d20 Modern however, the Speak Language and Read/Write Language skills are two different things, meaning you can read one language but not speak it and vice versa.

Though it might be odd that these 2 skills have been created as seperate ones, it does make sense when you think about it. We (Germanic language based) will have a lot of trouble to speak a language like Japanese and to read/write it. The difference between verbal and written language is HUGE in some cases. And while on the subject, d20 Modern also through it would be handy to group languages by their origin as well. And these groups influence the DC of the Linguist talent tests. When the unknown language is within your language group, you have a DC15 to understand the (general) meaning of the message, if it's an other group the DC will be 20 and for ancient/unique languages you'll have DC25.

In C# code that'd mean that I should use both Speak Language and Read/Write Language and keep track on what languages the character knows and in an odd way link that language to the group. And I've made odd way bold on purpose because it will not be clear for the user of the plugin (yes, I'm still serious on releaseing it to the Unity Asset store) how this is handled.

Instead I will use the Speak Language and Read/Write Language skills only to keep track of how many foreign languages the character knows. In addition to this I'll add classes that'll hold the properties of each language, including what group it belongs to. Then (like with skills), I'll add a new List<> to the main character data that'll hold the language and if the character knows it as speaking and/or read/write.

I realize this is a lot of extra work (and that data flowshart I showed earlier is already big), but it'll make things a lot easier when using the d20 Modern plugin, and that's the main thing I should keep in mind...

Post A Comment! :: Permanent Link
  Page navigation
  Page 1 of 2 :: Previous Page :: Next Page
* advertisement *
* advertisement *

This website is Copyright © 2009 - 2018 Alex Erné
PHP/MySQL coding by Alex Erné Copyright © 2009 - 2016 Alex Erné
...all rights reserved...

AE games™ and the AE games logo are Trademarks owned by Alex Erné
TetraGems™, Burst-a-Bubble™ and the Burst-a-Bubble logo are Trademarks owned by Alex Erné