Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Nov 2013
Offline Last Active Yesterday, 01:07 PM

Topics I've Started

Oh Unity, what a strange decision you have made.

17 March 2014 - 04:51 PM

So, in Unity, this is perfectly legal code, no warnings or compiler errors will show up.


(Though this is pseudo as I don't have the code in front of me)

void SomeFunction(Vector3 value0, Vector3 value1, float deltaTime)
    Vector2 interpValue = Vector3.Lerp(value0, value1, deltaTime);

You see, Unity, in it's infinite wisdom, has made it's vector classes auto-convert from Vector2s to Vector3s and back again.  It just sticks a zero in or drops the last value.  Who cares about catching compile time error checking, right?


Do people like that feature?  It drives me batty, a simple mistype can become a mysterious bug, that would normally be caught at compile time.

Path planning with a minimal turn radius

03 January 2014 - 12:41 AM

So this is a small prototype I have made for calculating a path with a minimum turn radius.  I should make the radius a slider, but haven't yet.


I haven't actually optimized it much yet at all.  For example, my checks for whether the path is over a tile are laughably terrible, I haven't swapped to Xu's Circle algorithm yet, or bresenham/Xu's line. 
Also, camera controls are basic RTS style, wasd or arrow keys to move, mouse wheel zoom in/out.

The big obvious known bugs:
1. Weird loopty loops are sometimes chosen as best path (floating point error?)
2. the line check is wonky, and should do width as well, so right now you can pass between two diagonal blocking tiles (xu's line should fix)
3. I got lazy and don't animate the tank moving on the path.
4. Occasionally you can drag the arrow/facing to a place and it chuuugs.  But doesn't enter an endless loop, at least.

Given an arc of radius X, what tiles does it pass over? (2d)

03 December 2013 - 06:43 PM

So I was thinking about this for a pathfinding problem, where I have something traveling along an arc of a circle (centerPt, start angle, end angle, clockwise/CCW) and I have a grid underneath that I use for pathfinding.


Now the brute force way is to obviously just sample the arc at a certain granularity, and find out which tile each sampled point was in/on.


But I was wondering if there was any easier\quicker way to to solve the problem.  A bounding box won't work, as it will pick up tiles\squares that aren't actually on the arc. 

Hex Directional Movement prototype, feedback appreciated

19 November 2013 - 04:57 PM

So this is a quick prototype of trying to do hex pathfinding/movement with facing/direction and a turn radius.

Left click on the tank to select it, hover over a facing in a hex to try to move to it , right click to move there. Click end turn when you want to move again. Scroll wheel to zoom camera out, arrow keys to move the camera.

Green is slow, white is combat/cruise speed, yellow is full speed. You can only go up or down one speed band at a time, so if you're at fullspeed, next turn you can't go slow. I don't have reverse in there -- and I probably should carry over the momentum from turn to turn, and add the ability to turn in place at the appropriate parts in the paths

To be honest, it's a bit mucky, I'm tempted to swap to something like Space Hulk / classic X-com, with a turn as a movement cost, as it might be a little clearer and easier to use.  But it looks like it could be interesting if I wanted to make a car game, autoduel-esque thing.


I'd appreciate any feedback, having stared at it too much, I'm curious how confusing it looks to others.