Technomancy
← Home

Advanced Movement and Basic AI

June 18, 2019

In my last post, I summed up the progress of my game up to current times and then explained the next couple of pieces that I’d be tackling. Now, I’ll go over these pieces in detail and what the status is on everything.

Wall Jumping

Previously, if you were to try and do a wall jump (pressing the jump button again while touching a wall and being in air), it would add a force in the direction that the player is facing with no restrictions at all. This essentially allowed for spamming the jump while facing a wall to scale up the wall (…which is not intended). The refinement that I made was to only allow wall jumping if the player is facing far enough away from the surface that they are jumping from. Let me illustrate: Wall Jumping 2.0

I won’t bore you with all the annoying Trig and dot product maths…

Basic AI

I have added in a very very basic AI Character into the game. It is basically the same character as you (same movement and attacks) and has the ability to sense nearby players in their field of view and will attack until they die, kill you, or run out of power (Actually they will still try to attack even if they are out of power but it just won’t do anything… I add a fix for that later). Here is a visual of what the AI is seeing. AI Vision

Bug Fixes

Memory Leak

I have fixed the memory leak that was causing the shield to crash the game after using it for a while. All I really did was double-check my memory allocations and make sure the memory was being freed properly before the shield was destroyed. Here is where all the memory allocations are located in the shield code:

class AHexPoint {
public:
  // Basic 3D space storage things here
};

class AHexEdge {
public:
  // Other garbage ...
  // Memory Allocation here
  AHexPoint *start;
  // Memory Allocation here
  AHexPoint *end;
};

class AHexagon
{
public:
  // Other garbage ...
  // Memory Allocation here
  TArray<AHexEdge*> edges;
};

TMap<int, TMap<int, AHexagon*>> hexagons;
// The master list of hexagons that get
// deallocated when the shield object
// is destroyed

And here are the deconstructors that freed up the memory:

AHexEdge::~AHexEdge()
{
  delete start;
  delete end;
}

AHexagon::~AHexagon()
{
  for (AHexEdge* e : edges) {
    delete e;
  }
}

When the TMap of hexagons are called to be deleted, these relevant deconstructors are called.

Other bugs

  • small UI fix that reset the crosshair charging bar after doing a charged attack.

What’s Next?

Since I’ve worked out the base of the main game mechanics (movement and attacking and such), the next couple of things I will be working on are more in the visuals and world-building realm.

First, I’ll be making a better player model that will better represent what the final character will look like. After that I’m going to try and build what would be considered the starting area of the game. The style I’m going for is going to be a futuristic world that has fallen into a wasteland after the results of some apocalyptic or dystopian event. Finally, I’ll be adding a game menu that will later be used for hosting and joining multiplayer games.

As Always, you can see the latest updates for yourself by downloading the game on the homepage.

Thanks for reading!

Nick.

© 2020 Technomancy - Powered by..... uhhh... me?