Game DevUnityVagrant Heroes

Vagrant Heroes Demo Release

I’ve released a demo for Vagrant Heroes which is now playable on Game Jolt.

https://gamejolt.com/games/vagrant-heroes/374560

The demo will take you around the overworld, through 3 different battle environments, and the town of Kur.

Game DevUnity

Dev Log #2 – Battle System Continued

There’s no doubt in saying that this week has been a slow one with not as much progress as I’d have hoped. Work just happens to get in the way (such as servers dropping out at peak times!) sometimes and then you need that time to chill out before jumping back into the lion’s den.

Further progress has been made on the Battle System, which now has a complete turn cycle between players/enemies. Manual intervention for the player to select their action, and some UI work for the turn queue and player frames.

Game DevUnity

A New Game Project

It’s been a while since I’ve posted anything game development related, as most of my time has been spent on web projects. Now that I’m back into game development, I thought I’d begin by challenging myself to recreate an older game of mine in Unity.

LaravelPackagesPHP

New Package: Laravel CommonMark

I bit the bullet, and tried something I haven’t done before. Today I’ve released my first open-source package, ever.

Introducing Laravel CommonMark, a Laravel wrapper for league/commonmark. Laravel CommonMark can parse Markdown from your blade templates into HTML, or parsed inline by calling the provided helper function.

Usage is fairly simple; from within your Laravel application, simply require the package:

$ composer require harrk/laravel-commonmark

Create a new blade view with the .md.blade.php extension (instead of .blade.php) and any Markdown will be rendered as HTML automatically.

This package requires Laravel 5.6 and PHP 7.1.3 (or greater).

The source code and further information can be found on GitHub, https://github.com/Harrk/laravel-commonmark.

LaravelPHP

Laravel: Extending Models With Existing Relationships

Extending a model in Laravel can cause complications with existing relationships. I’ll use a User model for this example with a bunch of existing relationships to other models, like permissions or roles. And for reasons, we are unable to alter the User model and decide to create a new class to extend it. The new model is Author, which extends User.

Laravel’s base Model class will take our class name and primary key name, forming a foreign key using snake casing. For our user, this is obviously user_id, and should this not be the case we can override the foreign key name when we define our relationships in the model.

However, returning to the Author model from before, the inherited relationships from the user model are still expecting user_id. Since this is a different model though, the foreign key now becomes author_id. Breaking any inherited relationships from the User model that have not been manually overridden.

Luckily there’s a fix for this. Simply override the getForeignKey method in the Author model to return user_id.

public function getForeignKey() {
    return 'user_id';
}

Of course this assumes that the Author model hasn’t defined any new relationships using author_id as the foreign key.

CashierLaravelPHPStripe

Laravel Cashier: Using default card as subscription payment

I’ve been busy implementing a subscription service for one of my projects. As it’s using Laravel I’ve been able to use Cashier for much of the scaffolding around Stripe payments.

In order to create a new subscription plan with Cashier, you would use:

$user->newSubscription('main', 'premium')->create($stripeToken);

However, if you have a user set up already with a default card (Eg, from a separated payment methods page). By removing the $stripeToken parameter Cashier/Stripe will create a subscription for the user using the user’s default card as payment.

$user->newSubscription('main', 'premium')->create();

This is a nice little conveniency that isn’t documented, saving you the hassle of asking for the user’s card details again when taking payment.

Game Maker

GMS2: Simple Camera / Surface Set Up

After slaving away doing the same old configurations every time I create a new room in Game Maker Studio 2 I had to come up with a way to optimise my workflow. By creating a set up room with a persistent camera controller object, I’ve been able to eliminate the mundane task of messing with views/ports (and now cameras) every time I create a new room.

The startup room is responsible for setting the window width/height, and from that the camera controller will store the window dimensions and set a game width/height which a surface will be initiated with. This is handy for when I’m working with small graphics and wish to scale up to the window size, as the surface is stretched to fill giving an effect like this:

Tools

New Tool: Random QR Generator

Things have been quiet the past week, with numerous games launching and only recently returning from my trip in China. I have been playing through everything that I missed, starting with Pokemon Moon and now Final Fantasy XV.

I was playing through Pokemon Moon and upon discovering the in-game QR reader I started searching around for a random QR generator without much luck. The lack of such a tool spurred me to creating a dedicated tool just for the job, and so one morning I put together randomqr.com which was by far anything from fancy.

Random QR

Today I revisited the tool as I lay in bed with an aching back, and decided to put some more work into it. One of the key areas I want to address is increasing time spent on the site, as analytics currently show it to be very weak in this area. Obviously this speaks for itself since the tool is for a specific purpose, and a very small one at that. Now how I could possibly improve in this area is a challenge without rebranding the website as a generic QR tool, which there are plenty of anyway.

So it all comes down to further carving out the niche the tool is built around. I’ve rebuilt the tool with AngularJS and rearranged the page format in preparation for expanding it with new pages. Now the tool has a function to automatically regenerate the QR image and next I intend to add additional pages.

Will this increase time spent on the site? Probably not, but it lays a foundation of what’s to come.

Go check it out here!

Game Maker

GMS: Chrome Menu Updates

Tonight I spent a few hours working further on my menu UI framework. I managed to tidy up the style slightly, whilst making it aware of its position and boundaries. The menu behaves similar to its original behaviour in Chrome by anchoring itself within the window boundary.

I added support for sub menus which are showing/hiding when necessary at the side of their parent menus. Finally the elements are customisable and I added settings in for a darker theme, oh and I almost forgot to mention I added dividers.

white_menu

black_menu

The way I’m designing this is to be simple to work with, whilst avoiding rooting it deep into a project. A menu is created by merely creating an object that extends the super menu object, then defining what items the menu has within its create event.

Currently a new menu has code similar to this in its create event:


//Inherit menu
event_inherited();

//Create Items
ds_list_add(items, "Add Node");
ds_list_add(items, "Something Else");
ds_list_add(items, "@-"); //Add a divider
ds_list_add(items, "Something...");

ds_list_add(items, ["Edit", objContextMenu2]); //Add a sub menu
ds_list_add(items, "Print...");
ds_list_add(items, "Cast...");

The data structure is still up in the air. I’m thinking of how I’ll implement icons next or even how I’ll add further meta data to each row. I’m looking at swapping the string/array values for a map, but instead I just keep wishing for structs or object literals.

 

Ramblings

New Blog

Man it’s been a while since I’ve done something like this. Instead of tackling the issues of building my own site and keeping it maintained, I thought I’d just take the easy route and set up a WordPress blog. At least this way I can ramble without worrying that I should be working on functionality instead.

Game Maker Studio 2 is in beta currently and I plan to mess around with that. I’m happy to see the rewritten IDE which makes it feel a lot more robust and future-proof. It’s still lacking certain features I’d love to see, mostly from my time with Unity such as being able to write your own UI tools within the IDE. Please Yoyo <3

GML is still more or less the same, though YoYo’s resources can only stretch so far. They did just recreate the IDE so I can wait for them to focus on GML – fingers crossed that’s the next big project. I’d love for GML to support OOP eventually, or even structs would be nice. However I am toying around with the idea of writing a Typescript to GML transpiler in the meantime.

I’m looking forward to creating with GMS2, once I can decide on which project I wish to tackle. For now, I’m just enjoying messing around with the revamped features.

Here’s a little preview of what I’ve been tinkering with today:

 

 As GMS deprecated the menu a while back, I decided to write my own based on the Chrome style. It only supports a single list currently, and I have an issue with how to write the click events in a simplistic manner. Right now I’m triggering user events based on the list position, though there’s only a maximum of 16 user events, so I don’t really like that idea too much. Internal object functions would be a blessing here.

Anyway, I cannot wait to see what comes next for GMS2.