Creating great software, one line at a time


view:  full / summary

Using Java to develop an application using public libraries

Posted by Rowan Powell on July 9, 2015 at 2:15 PM Comments comments (0)

As part of my efforts to expand my ablilties, particularly with Java, I developed a small application in 6 hours over two days. The application uses freely available libraries on the internet to create a system that can recognise what a user is saying, check it for key search words and phrases and also search for relavent words around the spoken terms to find out if it's reasonable to flag the user up for further investigation.

The first part of the application is the hardest and least reliable as it's a problem that's been in the process of being solved for a very long time - speech interpretation. For my application I tried using IBM's Speech-To-Text service avaiable through the bluemix platform, but the system proved to be very difficult to use and had little in the way of guides for how to put together an application to make use of it. This was unfortunate because the service appears to be a lot higher quality than others on offer. I ended up working with Voce, which could be implemented as a .Jar library through Eclipse, significantly simpler. Unfortunately the Voce engine has some real issues in reliably detecting words and doesn't automatically use a dictionary.

The second part involved saving a log of what the user said to a file, whichwas fairly trivial as I had created a class to do this for a previous project (The client-server auction system needed a persistant data log).

The third part was trying to find if keywords matched sections of a body of text, this was also a really simple thing to implement as I had also already written a pair of functions that would check if a word could be made by insertions or deletions on the other word which can be found on my gitHub at which I've extended to take into consideration a maxmimum allowed edit distance, here I've just used 2 as a default value, but this could be easily made so that the function checks if the edit distance is less than 25% the length of the word or some other function. In my application I also disregarded words that were less than 4 characters as almost any word could be corrected to them.

The final part of the application required an analysis of google search results from a given term, this was made massively easier than it could have been by two factors. First, the analysis of the google search results could be done by applying the keyword contains functions I had used earlier. The second point was that a publically avaiable library GSon could convert JSon files into a readable format. Trying to read a normal google page is difficult as the results back tend to just be the display code for the page, not the actual search results. Instead a custom search engine was created (I actually used someone else's link) which returns all results in a JSON format, which could then be parsed by GSon and read by my program.

This was a really fun and challenging project to put together and really helped me to branch my skills out further, exploring the options available through public APIs and the various Libraries people have put together.

Line of sight detection algorithm

Posted by Rowan Powell on July 8, 2015 at 9:15 AM Comments comments (0)

The code used in this project can be found at

In a recent AI project I needed to work out how to check if the Agent could see locations on the map from where they were standing, taking into consideration the walls placed around the map.

The process of doing this was made significantly simpler by the fact that all obstacles to vision could be considered to be rectangles aligned with the axis, which reduces the neccessary maths by a considerable degree.

The first stage of the process attempts to disregard all non-relavent obstacles as they are tested, by doing a simple in-bounds test using a rectangle I could very quickly and efficiently throw away a large portion of the elements of the scene, this had the added benifit of excluding those that would be along the line of sight between two points but not between the two.

In the image above you can see how the process would take all relavent walls for a sight line between the red and blue locations, keeping all elements within the yellow bounding box and not considering any of those outside (Marked by a red cross) as able to block the line of sight.

The next step in evaluating if an object is going to block the line between two points is to consider it as a rectangle in this case and then break that rectangle into lines which can then each be assessed if they block the line at any point. A sample of how I implemented this for use in my agentCanSeePoint() function can be seen below;

As you can see, the mathamatics of the actual assesment is fairly simple, we just need to check if a line intersects the other line and if this intersection occurs within the bounds we described when we used a rectangle as the model for our obstacle. There are two edge cases for this calculation however, when the line being assesed is directly along one axis or the other, where the gradient is considered 0, Infinity or -Infinity, which is not helpful and leads to some buggy results, as such these have to be handled seperately in my implementation.

Overall though, this is a very simple function with enough modularity to be used extensively in the rest of the program. vectorIntersectsLine() can handle both horizontal and vertical edges to the boxes and then vectorIntersectsObject() can be used to make assesments of any object, moddeling it as a rectangle. This is then extended out in program as canSeePoint(X,Y) which takes into account all of the objects that block line of sight and disregards those outside of the relevant bounds, making for a very quick (in terms of written code) assesment of a line of sight.

On player retention in lwg - A writeup

Posted by Rowan Powell on June 15, 2015 at 7:10 PM Comments comments (0)

I'm Xao, one of the moderators for lwg and have been around for nearly a year now, so I figured I'd share some thoughts. From my position running tournaments and doing various community management things, I may have a different perspective than some of the other vocal members of the community. This post is going to touch on a variety of things to do with the game, but the real focus is going to be on retaining a playerbase.


A few notes before we begin;


A large amount of player questions and feedback go through me, I'm not sure about other community members handling questions like this, but I feel safe in making the assumption that a large enough sample come through me that I'm aware of the most common issues.


The majority of the playerbase is fairly casual, I'd argue that 70-80% of the playerbase play primarily multiplayer modes and less than 5% of the total population takes part in matchmaking (This could arguably be to do with the lack of players looking for ranked games making the mode further sparsely played). On a given day 20-40% of the online player count is guests, which are most likely new players. As such, the focus on improving “Casual” play and retaining these players is a priority for the development of the game, if we also want to see a growth in the 1v1 playerbase.


Contrary to the questions I often get, this game is not really suffering from a lack of income of new players, between the youtube channels we get about 1.3k views per month, depending on how you interpret that (People watching more videos or not everyone going to youtube for content) it still works out to be a significant inflow of new players.





The biggest issue, from my perspective, has consistently been about player retention. About maintaining that consistent interest in the game for people to continue to play after the initial intrigue.


We can try to improve player retention rates through various methods

* Progress and persistence mechanics (i.e. account levelups, rankings, achievements and unlocks) (LWG does this poorly right now)

* Social elements (Friends, Clans, Top-Player-Of-The-Week) (LWG does well on this account)

* Cut down on UI/Mechanical issues when learning the game

* Competitive elements (Ladder and easily comparable stats tend to work well for this)

* Highly polished gameplay elements and interface interactions


Ease of play is perhaps the most intuitive factor, it's how easily the game accommodates and incoming player and enables them to play and understand the game. Incoming players naturally fall into two categories, those experienced with the genre and those who aren't.


For those who are experienced with the genre, the game generally handles these players well, the UI is as to be expected and so are a lot of the controls and hotkeys. These players tend to do well with the game but do suffer from some problems I'll talk about later.


Those who are not however instantly hit a few roadblocks depending on how adaptable they are.




Proposed UI Changes


The initial UI presented to the player is an interesting one, it provides an instant access to the community element of the game as that window in the UI is instantly the main focus due to it's size and positioning. Unfortunately this tends to neglect a little the key buttons the user will want like the “Play” buttons. Not a huge deal, but still. I've proposed a few changes to the UI in the image below.

Firstly is make the key buttons a lot more prominent, as much as this looks like a large change, we sometimes get players asking how to start a game which really shouldn't happen. As much as we could blame users for that, it's better to just make sure it's really clear. A large “PLAY” button to automatically dump the user into an open game is something that I think would benefit the game, not a major priority but for various reasons I think it should be included.


Another change, though purely superficial is to modify the chat box so that it is roughly the width of the chat window, no need to always cut off part of the sentence.


The other big change is the 'profile' section, which I've put in for a few reasons. Firstly it helps promote ranked play (Which I know the competitive side of the community would appreciate some emphasis on) and ranks are good progress markers (Which is good for retention). The other element of this is the “Account Level” which would progress every X games increasing exponentially, this sort of thing is again good for retention as it shows persistent progress. This also allows the opportunity for Jbs to implement unlocking chat emotions or profile badges (I'm aware this art is extra work, but considering there are already various emoticons, including some by Glaba and my forum badge art could be easily re-purposed)


I'd also like to propose an additional button to the top bar, this isn't necessarily to do with retention, but further integration of tournaments as well as promoting tournament winners I think would be very beneficial for the competitive scene.


Lobby UI is generally pretty solid apart from a few hiccups (A way for players to move themselves to observers would be greatly appreciated). The one thing that gets requested a lot about the lobby screen however is the fact that it takes you away from the main lobby chat, A tabbed chat would be a fantastic addition to allow players to both see the game chat and the main chat while waiting, which also solves part of the issue of trying to get players to join.




The next big stumbling block for new players, as with any game, is the mechanics, which is fair enough. There are some things to be done though to reduce the learning curve here.


Tutorials – As much as Yummy, Itano and I have created various guides for various levels of skill, they are all external to the game and for the most part must either be referenced or found. The game could really benefit from ingame tutorials of some form.


Satisfaction of mechanics (Also known as Juiciness) is another key feature for making the game enjoyable as well as creating the moments you want to share with friends. This can be seen clearly in the most popular games like LoL, DotA and SC2, where certain skills and interactions make a clear moment of connection such as the SC2 banelings, which create a combination of effects as they do their damage to create a satisfying moment. LWG currently lacks moments like this, with the possible exception of catapults and ballista. This is a difficult one to balance as we don't want to overwhelm the player, but polishing interactions like this is important to the enjoyability of the game.


Player Skill Discrepancies


This is something I'm not sure LWG itself can solve but is more a function of the low active playerbase, but when new players get matched against strong players it can be a very frustrating experience. This skill gap must exist and be wide for LWG to have any real potential but directing players into safe learning environments as they enter the game for the first time is important for keeping them in the game.


Guiding the player


Proposed UI Changes

The game currently presents the player with a results screen once they leave the game, but to most players these stats are fairly meaningless and the small text sizes mean the effort of creating them is wasted.


Instead I propose a change to this results screen that focuses more on feeding back to the player how to play the game more effectively as well as giving them obvious points for improving.


Achievements would obviously be a fantastic addition to the game retention-wise but also as a teaching aid, with achievements for tasks like creating X units before a certain time or creating Y of a certain unit in a match.


Making use of the login screen



This screen is left practically bare as it is, but could be a great place to feature either splash art for the newest features or a text post of the most recent updates to the game or upcoming patches.


Custom games


The custom games that are part of LWG are a fantastic addition to the game but they don't make sense as the first thing the player sees when they look to join a new game. The solution here would either have to be moving custom games to a separate section of the map select UI or to make it explicitly clear to the player when they join one of these lobbies that it is not the default game.


Misc elements that are non-intuitive


Ballista as of now don't manage to convey that they are anti-air only, which while only a minor issue, should eventually be looked at.


Forge being human/mech, this is another tricky design one, but again if this could be altered to better convey it's role that would be good.


Neutral buildings instead of rocks. Most of the vets probably don't even process that this is off by this point, but doesn't really make much sense from a gameplay perspective and confuses new players, rocks would be a lot better.

Anya's Quest Expansion - Adding Items

Posted by Rowan Powell on December 8, 2014 at 6:10 PM Comments comments (1)

After updating my site recently, it got a little bit of attention and so did one of my games in particular - Anya's Quest.

So I put in motion a plan to expand the game that was sketched out at release, but I didn't have the motivation for. new mechanics and other fun features are planned but this week so far I've just been adding some more items to start to flesh out the game a bit more.

Scythes are a new type of item being added to the game, which focus on having high crit damage but low base damage and are mostly found later on in the game. It's going to be difficult to balance these properly so that the huge burst damage doesn't make them a strictly better choice (Both in terms of DPS and armour penatration). I've also added some more orbs, a +30% crit damage and a +20% crit chance as well as a large version of the +2 damage orb, a +3 orb (Which might get a bit out of control...)

A quick text adventure

Posted by Rowan Powell on November 29, 2014 at 2:05 PM Comments comments (0)

So this week I decided to make a quick text based adventure game, so I could continue to grow my list of finished projects, but also to try something completely different.

In my typical style I went for a dungeon explorer, but it was a fun challenge to try and describe the whole journey and the locations I had in mind with just some text on screen. Initally I wrote the game code by having room classes which extended into classes for each room (Which did allow for very specific room code, which had it benifits) but this rapidly got way too large and instead I've written a function to grab rooms and their descriptions from text files, which is far more convinient, but somehow takes the fun out of the creative process.

I'm not sure wether I should call this project complete, say that I've written a dungeon to explore and look around, or if I should extend it and add more areas and more story. I think I'd like to, but with this sort of game it's unlikely that there'd be much of an audience for it, which can be demotivating.

Source Of Mana - DevDiary #2

Posted by Rowan Powell on October 26, 2014 at 8:35 PM Comments comments (0)

I've not done as much interesting development on the game this week, as various bugs and business has kept me from it.

On the plus side, the healthbar/manabar work is being written and should be quite interesting.

It's been difficult to keep working when there's so much demanding my attention, but I'm determined to keep working on the game.

Source Of Mana - DevDiary #1

Posted by Rowan Powell on October 19, 2014 at 3:10 AM Comments comments (0)

It's been a long time since my last project, Anya's Quest, and I finally have time to start working on games again!

I'm working on something a little smaller this time round, SourceOfMana. This game is an arena-based hack & slash through a dungeon (I do love dungeons, maybe you've noticed?) where your power and health are tied together through your Mana.

The key idea of this game though, is that your mana and power come from a certain element, the source of your mana - and by searching for the true source, you can unlock more of your power.

I've got a basic mockup working, though I'm struggling to get the unit collision to behave properly. Hopefully this will be a fairly short game (Perhaps 5-10 generated levels and a boss) that I can polish up and call finished.

Dev Diary #9 - Enchanted Items

Posted by Rowan Powell on February 9, 2014 at 2:10 PM Comments comments (0)

This week I've added a whole bunch of enchanted items that extra bonuses but are slightly rarer, including ones with lifesteal!

Also included in this update are three teirs of lifesteal orbs, a damage orb, reflect orb and updated art for many assets. It also includes  rebalance for gloves, which now have less defence, but improve your stun chance, making them now different from other armour pieces.

This week has been a difficult one on the game development front, it's sometimes difficult to maintain the enthusiasm, especially when the feedback isn't as encouraging as you'd like.

To top this post off, please enjoy a few quick screenshots of the game;

This week also features a new piece of UI, the "New Item" alert, to remind more forgetful players that they haven't checked their inventory for their new loot!

Dev Diary #8 - Pikes, Greathammers & Bosses

Posted by Rowan Powell on February 2, 2014 at 4:50 PM Comments comments (0)

This week I've added six new pikes, weapons that give you a little bit more reach over the typical weapons as well as extending the range of the bows. There are also a few greathammers to be found, which make you slightly slower, but offer the ability to stun enemies, stopping them from attacking or moving for a while. You can also find a resonance orb which will improve your stun chance by 10%

This week also features a new boss; Yomi, plauge of the hills, who creates new fungal spores to attack you, though the boss itself is largely defenceless.

I've improved the UI for the inventory so that it should be more easily useable, and help tips have been added to most transition windows.

DevDiary #6 - oooh, burn!

Posted by Rowan Powell on November 23, 2013 at 4:50 AM Comments comments (0)

This week i've been adding to, and polishing up, many parts of the game, such as a fancy new title screen, better looking health UI and a small mound of extra items!

In previous builds, the GhastlyChains could be found, and while they offered early-game protection, they did have drawbacks, which is the idea of Ghastly/Haunted items. Now though, along with the introduction of some more Ghastly items, you can find the protective bracer! This item protects you from any harmful downsides to wearing haunted gear, though it does take up a slot of it's own.

A new mechanic that's been added is the Burn mechanic, or more accurately burn damage. The idea between burn damage is that you do damage over time, which fades off over time. Burn damage stacks however, so running with lots of burn damage in your attacks, such as using the new FireAmulet, will allow you to really maximise the damage you can do!

Dungeons now behave differently, with later dungeons spawning Dirks, Snakes and Scorpions a lot more frequently, but on the upside, they now also drop better loot too! I'm planning to do a lot of work with tilesets to get them all feeling a bit different, rather than exploring the same dungeon each time.

One of the biggest visual changes in this update however is the new healthUI, which has changed from the old system of health bars and text, to a hearts system, so it should be really quick to see who's got how much health, as well as looking much nicer too!