.:: Alex Erne :: PHP/MySQL & Unity3D/C# projects ::.
Recent news
Categories
* advertisement *
  08 August 2016 - ALL PROJECTS ON HOLD INDEFINITELY :: Posted in General

I've been diagnosed with Asperger's syndrome and ADD back in 2009, but I always felt that was not all there was to me. Only recently I've been diagnosed with a bi-polar disorder, which is most likely the missing piece of the puzzle of my mental state of mind. The last 20 years my moods have been going up and down like that of a 7 month pregnant woman (no offense to the female readers), and the cycle in which the mood changes happen went from about a year to around 3 months now. That does not mean that I have 90 'good days' and 90 'bad days' - it's just the general state of my mind, with peaks both up and down from one minute to the other at times.

Earlier today I've had yet an other such peak in the form of a very sudden deep depression. It was that bad that I gave my wife my wedding ring and I was about to walk out the door never to return. Good thing she was there to talk me out of it. The next 2 hours suicidal thoughts were on my mind constantly and I had to restrain myself not to take the pills that I have lying around the house, or just grab some knife and start cutting myself. Instead I just used my nails to inflict the pain I was yearning for...

This all is somewhat related to my programming work. I can only work on my prejects when I'm doing well and with those times getting shorter and shorter, the progress will become very slow. Not to mention, the stress caused my the need to code and deliver the project to the public is not doing my mental state any good either.

Of course, programming is still one of my greatest hobbies, and I will keep programming. I just will not make any big projects like the d20 project, or the re-coding of TetraGems and complete overhaul of Burst-a-Bubble. That's just the stress I can't need anymore and I have to put it down for that reason. Will I completely quit making games? Not at all! I just won't be making announcements or anything like that, and when I think the game I made is good enough, I'll just drop it on you all.
With that, the main site of my programming activities (AE games) will be closed down as well later this year, as well as a (silent) closure of the Facebook page I created for it. I will keep my twitter account, but don't expect a lot of tweets from me there...

Then TetraGems... I was busy re-coding it and it's basically ready on the 1st stage. I will make some (simple) modifications to code to so that the highscores, which are stored through the aegam.es site, will stay available after the closure of the site. I can't tell any date yet for that release though - it all depends on how I'm doing...


Post A Comment! :: Permanent Link
  13 July 2016 - Implementing AdMob in your Unity project :: Posted in Unity3D

I've recently recieved an eMail from Google, stating that the Android Google Mobile Ads SDK will become obsolete coming September 15th. The AdMob SDK versions 6.4.1 and lower will simply stop to work from that data, and if you have used it in your projects (like I did with TetraGems), you will need to upgrade the AdMob handler to version 7.0.0 or higher. Sadly though, there's NO stand alone AdMob SDK anymore and it's been fully integrated into the Google Play SDK.

It's the Google Play SDK that does give some problems though. With the current latest version of the Google Play Services (rev. 31 in the Android SDK Manager) kinda missing in the package, you have to grab the SDK elsewhere. I've found a copy (rev. 28) on the Unity forums and will share it through my dropbox for your conveneince. The contents of the Google Play Services (rev. 28) needs to be copied into your Android SDK installation directory (C:Program Files (x86)Androidandroid-sdkextrasgoogle by default).

Next up you need to check a couple of packages that MUST BE INSTALLED in your Android SDK Manager. These packages are:
  - Android SDK Build-Tools rev. 23.0.3. I've read reports that rev. 24 is broken, and I couldn't get it to work either.
  - Android Support Repository
  - Android Support Library (Obsolete). I'm not 100% certain this one has to be installed, but the Google representatives keep hammering on the forums that it has to be there - odd though for an obsolete package...
  - Google Play services, even while it's not actually installed right now...
  - Google Repository

With the Android SDK Manager now setup correctly, it's time to download the Unity plugin for the Google Mobile Ads SDK from GitHub. I realize that there are enough alternatives on the Unity Asset Store, but I'm a bit reluctant to use those because you have no clue what's been done to those packages. With that, I've tried 2 free ones from the Asset Store and I could not get those to work, while the paid ones are just plain stupid when you can code it yourself!  Having the plugin, you now need to add this one to your current project (either double-click the GoogleMobileAds_305.unitypackage file or use Unity3D's Import Asset function).

So far that's all you have to do. Now all you need to do is add a bit of simple code to get the AdMob plugin to actually work and drop the advertisement on your app. And the code required is very small:

using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;

public class Create_AdMob : MonoBehaviour {
  #if UNITY_ANDROID
  string adUnitId = "ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX";
  #elif UNITY_IPHONE
  string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
  #else
  string adUnitId = "unexpected_platform";
  #endif
  public static BannerView bannerView;

  // Use this for initialization
  void Start () {
    // Create a 320x50 banner at the top of the screen.
    bannerView=new BannerView(adUnitId, AdSize.SmartBanner , AdPosition.Top);
    RequestBanner();
  }

  private void RequestBanner() {
    // Create an empty ad request.
    AdRequest request = new AdRequest.Builder().Build();
    // Load the banner with the request.
    bannerView.LoadAd(request);
  }
}

Now all there's left is create an EMPTY GAMEOBJECT in your scene and attach the Create_AdMob.cs script to it and you're ready to go!

A couple of notes though....
1) I haven't tested this on iOS since I'm not an Apple fan and don't own ANY (mobile) Apple devices. Please leave feedback if it works as well under iOS as it does under Android.
2) Obiously, the string asUnitId should hold your app's advertisement ID.
3) Do keep in mind that it's against Google's agreement to click your own ads! If you want to test your ads, replace the AdRequest request into

// Test device
AdRequest request = new AdRequest.Builder()
  .AddTestDevice(AdRequest.TestDeviceSimulator)
  .AddTestDevice(SystemInfo.deviceUniqueIdentifier)
  .Build();

4) I've made bannerView public and static so that you can call it from any other routine and use Create_AdMob.bannerView.Show() and Create_AdMob.bannerView.Hide() so you can toggle visibility of the displayed advertisement.

There's a lot more to this plugin and all is described in it's official documentation. I just figured to describe the easiest way to make your advertisement work with your apps...


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:
          myChar.AddClass((int)d20Classes.StrongHero);
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
  Page navigation
  Page 1 of 20 :: Previous Page :: Next Page
* advertisement *
* advertisement *

Copyright © 2009 - 2016 Alex Erné
PHP/MySQL coding by Alex Erné :: Copyright © 2009 - 2016 Alex Erné
...all rights reserved...