.:: Alex Erne :: PHP/MySQL & Unity3D/C# projects ::.
Recent news
* advertisement *
  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 {
  string adUnitId = "ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX";
  string adUnitId = "unexpected_platform";
  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);

  private void RequestBanner() {
    // Create an empty ad request.
    AdRequest request = new AdRequest.Builder().Build();
    // Load the banner with the 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()

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
  09 July 2016 - Redefining the Bubbles :: Posted in Burst-a-Bubble (project)

While busy with the re-coding of TetraGems I had an idea for a new game. This game would include some of the basics of Burst-a-Bubble along with the gems from TetraGems. Thinking this new idea over I figured 'Why not use the Bubbles instead of Gems?'. After all, the graphics for them has been made already. This means that the initial idea of Burst-a-Bubble will be trashed. This idea, though at the basics seemed viable for a fun game, my implementation was not. The new idea will make the game more fun AND challenging to play.

What the revised version of Burst-a-Bubble will look like..? That's one thing I won't spoil yet... But I can assure you that the old way I've made the game will get quite an overhaul but yet will keep a lot of the original gameplay as I wanted to include it (meaning the chains, locks and keys), while new game features will be added. Also, the new way I want to make Burst-a-Bubble will also be a way that it'll be fun to play on the PC.

For now I won't start on the new Burst-a-Bubble game though. First I need to work on TetraGems, which has more priority for now...

Post A Comment! :: Permanent Link
  05 July 2016 - Re-coding TetraGems :: Posted in TetraGems (released)

It's been a year since I last looked at the TetraGems code, but now I really need to work on it. The main reason for not having spend too much time on TetraGems is the d20 project, which is coming along just fine and twice the thought to abandone the Unity3D engine in favor of the Unreal engine (this is not gonna happen anymore BTW).

Why the sudden attention for TetraGems while I'm currently at an other project I hear you wonder.
To put it simple, I've received a message from Google Play that the AdMob (advertisement) plugin I'm using will expire in a couple of months. This means I need to implement a newer version of the AdMob plugin, which has changed to the core. Basically, I need to implement the full Google Play store now into TetraGems to display the ads from AdMobs
Though the implementation of the full Google Play store will take some time for me to figure out how it works, it also comes with a couple of nice opportunities. One of them is that I can move the Leaderboard function from my own database into the Google Play environment (if possible). An other one is to implement achievements (which I've been thinking about from day #1 that I started on TetraGems, and yet again, if possible).

Yes, I realize I can easily just implement the new Google Play store, but there's still a HUGE list of things that I wanted to change on TetraGems as well.
   First and formost, that weird glitch that's still there and I coded around (it now has a very small chance to happen), I will kill for sure.
   Secondly, I've been thinking to add some nice animations when you crush Gems, which I can now implement as well.
   Thirdly, I want to add some nice 'fluff' to the game to make it look even more appealing.
And it's the 3rd change that requires a full recode of the game. The changes that I want to implement will not work with the 2Dtoolkit plutin I'm using and instead I have to use Unity's 2D implementation. Removing the whole 2Dtoolkit means that all gems (sprites) used have to be redone and the code around them has to be removed and changed into Unity native code. Not to mention, the last version of TetraGems was made with Unity version 5.1.1 and the current version is 5.3.5 with 5.4 already in beta

The changes to TetraGems will come one at a time though over the coming months. I know I've promised that before and then abandoned the updates, but with the changes that I'll be making (and am forced to make because of Google Play and possible incompatabilities with the newer Unity engine version), I do need to keep going on TetraGems right now. And honestly, I think it's a good thing that I've learned a lot the last year working on both the d20 project and the Burst-a-Bubble Project...

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
  Page navigation
  Page 2 of 28 :: 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é