Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


NathanRunge

Member Since 08 Feb 2008
Online Last Active Today, 07:14 PM

Topics I've Started

Dual-Purpose Transform Hierarchy (2D)

02 November 2014 - 05:20 PM

Good day everyone.

 

Over the past couple of years I've worked, on and off, on a 2D game development framework using C# and Mono for cross-platform development. It's been a great learning experience and definitely useful. I've recently begun a new iteration in order to implement a number of lessons I've learned.

 

The current focus of my attention is implementing the game object model and transform hierarchy. Currently I have a Transform2D class which keeps track of local transform data (translation and rotation only for now) in addition to keeping track of its parent and children transformations. This is used to propagate 'dirtiness' as needed and to calculate the world matrix.

I am now implementing the GameObject class. Every GameObject has a transformation. GameObjects are similarly arranged in a hierarchy and this is where things get tricky. It seems highly problematic, on many levels, to manage two hierarchies. Furthermore, it is important that the GameObject hierarchy is the same as the GameObject's transformation hierarchy. That is to say, the GameObject's Transform's parent should be the same as the GameObject's parent's Transform. So, it seemed like a good idea to simply allow the Transform to dictate the hierarchy.

 

However, I also need the ability to use Transforms independently of GameObjects. That means that a Transform may, potentially, have no attached GameObject and this would introduce 'gaps' into the GameObject hierarchy. There are certainly ways to work around that problem, but most of them violate violate the contract offered by the Transform class. It has become quite apparent that I am trying to use one class for two distinct purposes, and that is a problem.

 

One solution is to drop the notion of a GameObject hierarchy entirely. Another is to create multiple types derived from Transform2D, but that hardly seems ideal. I could also make a GameObject's transform private and control parent-setting access, but that introduces a number of irritating properties to GameObject.

 

Anyway, I though I would ask if anyone can offer some insight on a good way to approach this problem or suggest an entirely different structure if necessary. The framework is not going to employ a pure entity-component model, but I'm looking to create shallow inheritance hierarchies with a good degree of composition.


2D Platformer AI

09 May 2013 - 04:03 AM

Good day everyone,

 

I have been developing a game which can be described as a 'side-scrolling tower defence' or 'reverse platformer', in which players take on the role of the traditional 'bad guy' and deploy traps, obstacles an minions to a side-on level in an attempt to prevent the 'hero' from reaching the end. Obviously the AI for the 'hero' is going to prove extremely important.

 

I think I've formed a reasonable high-level view of how to approach the problem, though I'm certainly no expert and welcome being told otherwise. It's the implementation of these concepts I'm struggling with the most, however, and I was hoping I may be able to find some assistance here.

 

The goal of the AI remains the same at all times, to reach the end of the level. In doing so it must navigate the geometry of the level and, to the best of its ability, avoid taking damage or being killed by the array of obstacles placed by the player. In consideration of the problem, I decided that the AI needed to create a plan. This is because it needs to consider whether jumping to a platform presents an ongoing path, or whether jumping now will place the character in more danger than jumping later. Once again, I'm new to AI programming so I fully acknowledge I may be over-thinking or poorly designing my approach here.

 

How I'm currently approaching the problem can be considered in a number of layers:

 

  1. A heuristic. Currently this is simply 'positive movement on the x axis multiplied by 2'. In the future, levels may include a simple A* graph, the heuristic of which being reducing distance toward the 'goal node'. This allows for more complex, multi-route levels.
  2. What could be termed a 'navigation mesh'. At the completion of the game's 'build phase' the level geometry is scanned and a series of 'walkable lines', or 'platforms', are created to inform the AI of walkable areas.
  3. The AI, when recalculating its plan, determines which platforms it can reach from its current platform, then extrapolates similarly from each of these, excluding back-tracking and known dead-ends, until it has a plan at least 700 logical units in either direction. It should only back-track if it has no route forward, and when a platform has no route forward it is listed as a dead-end to back-and-forth over the same area.
  4. As these paths are generated they're assigned a cost based upon movement required and extra cost for jumping or sliding. The cost is meant to simulate both the 'effort' and 'difficulty' of the plan. They're also assigned a score based on the aforementioned heuristic. When all the paths have been found they're sorted by score - cost. I can happily fiddle with the sorting later.
  5. This is where it begins to, perhaps, exceed my knowledge and experience. The next step is to generate a plan, or series of plans, for the first few paths, or onward until a path is found that doesn't result in death. I'm having a great deal of difficulty determining how to generate this plan. Does one simply simulate every possible action at timed intervals and choose the best result, or does one attempt to direct simulation toward the goal using various formulae to calculate stopping distances, run-up requirements, etc? Do you then randomly vary that plan to find the optimal solution? How do you choose when to jump, or what if the hero requires a run-up to make a jump? If this approach makes sense, do you have any recommendation on how to implement it?
  6. These plans are then sorted based upon the (score-cost) of their underlying paths, with additional penalties imposed by taking damage or needing to avoid additional hazards.

Any advice you could give regarding the approach would be truly appreciate, and I must admit this process has proven rather disheartening thus-far. There is obviously a great deal of room for improving efficiency in this model, but flexibility and a 'human-like' process are important. I know that I could bake jump nodes into the navigation data, but I feel this would compromise these important characteristics and prove a sub-optimal solution.

Thanks for any help you can give, once more.

 

Nathan Runge

 

Attached: 2 screenshots from a prototype showing the platform detection.

 

Addendum 1

The hero character has a small selection of options available: Move Left, Move Right, Jump, Duck, Do Nothing. Ducking while moving initiates a slide. 'Do Nothing' will slow the hero to a standstill if the character has momentum. Moving left and right is at a much slower rate if airborne. 

 

Addendum 2

I'm considering using a GOAP-like planning system to determine actions, as this would provide the AI with ways to chain together the actions needed to achieve the task. A number of problems arise, however. The first being that planning systems need to work backward from the goal. That makes checking for mobile hazards and obstacles a bit more challenging. The second question is how far you would break down actions? Would you break them down to the 'jump', 'run', 'duck' level, or something more complex such as 'run up', 'jump to platform', 'avoid obstacle', 'slide under trap'. My inclination would certainly be the latter.


War of the Words

31 May 2008 - 06:42 PM

I never thought I would find myself in a reputable forum unleashing a 'Microsoft is evil' rant upon an unsuspecting public, but here I am, about to plunge into the icy depths of mainstream hate, considering what my chances are of finding a working piece of software at the bottom. The situation I find myself in is, apparently, a common one. Microsoft Word 2007 has, arbitrarily, decided it shall no longer recognise the peripheral of the mouse. Being a little selective in its technological xenophobia it'll happily allow clicks from 'the mouse' to toggle its menu buttons. Fearing possible hidden agendas, however, it has decided to restrict all 'clicks' from accessing its most precious resource - text. Microsoft Word, having received reliable intelligence from Microsoft Customer Support that 'the mouse' may attempt to instigate a coup de tat through careful manipulation of 'the options', has enforced a further 'no-click-zone' in the cyberspace over every non-general menu item. Microsoft Customer Support, a member of the Coalition of Microsoft, has lent its support to the operation, stating to the 'User: Nathan' that no problem exists. Microsoft Customer Service is threatening to enforce heavy economic sanctions, in the form of a $50 'service fee', on any user attempting to access 'text' in sovereign Word territory. Currently plans for an invasion via 'The Registry' are being explored. So, not wishing to part with $50 to speak to some technical support chap who'll probably tell me to turn it on and off again, does anyone have a clue how to fix this problem? (Problem being: Can't click/select/manipulate text in Word 2007 and the standard fix is not an option seeing as I cannot click in the options menu either.)

Prayers for a Fellow Developer

13 May 2008 - 09:11 PM

Good day, I understand this is probably a little unorthodox and I don't want to be at all controversial, it's just a request addressed to those of any faith. Last year I came to this site for a second time, confident now that I had the abilities to actually assist in the development process and I put myself out there. I quickly got a response from a project which I joined. On that project I met a man by the name of Vibhas, and even though I no longer work on that project, I've spent many an hour talking to him since and continue to count myself his friend, and a colleague on two other project. I just found out though that he was in an accident on the highwaylast night. He was carpooling, and his two friends were killed on impact. He's now in hospital with severe head injuries, as well as broken bones all over his body. I don't know if he's stable or conscious but, being a Christian, I wanted to ask for as many prayers as possible for his recovery physically, mentally and emotionally. It matters not which faith you belong to, and even crossed fingers would be appreciated. I know I'll be praying tonight.

IP Thief

18 April 2008 - 07:07 PM

G'day All I was recently on an independent project whose team boasted a member of a professional studio. While I was understandably sceptical about this, the entire team assured me it was true. This person also produced legal documentation testifying to her employment at this company. Nevertheless, I did my research when she started attempting to recruit some of the team as freelancers on a project for said company. It all seemed too good to be true. Eventually I managed to uncover a vast web of lies. She was good, she was well practiced it seems. She made a few critical mistakes, however, and I now have a large dossier detailing her fraud. Trouble is, she has access to hundreds, if not thousands of pieces of artwork, hundreds of pages of written work, models, designs and ideas. While she obviously does not have legal rights to use them, enforcing those rights is difficult. I believe I have enough evidence to prosecute her for fraud and shall shortly have her contact details from her ISP. The trouble is, the company she claimed to work for is not interested, and she resides in a foreign country to most of the team, making prosecution economically infeasible. So legal advice is not really what I need. What I was wondering is whether there is a body that may be able to assist with this matter? In addition, is there a way I can distribute this information in a manner that will ensure she will no longer plague independent teams? So far I am aware of 5 different projects she has defrauded. I thank you for any advice you may be able to offer.

PARTNERS