Skip to content

246. Optimal culling

While trying to figure out how bot tanks saw each other, I revisited culling (deciding which objects to draw), and it proved an exciting adventure that resulted in some blazingly fast code, which I’m happy to share with you now.

Read more…

Advertisements

245. WoT – Self driving tanks that don’t collide

A playable demo is coming soon, but I have to sort out a few things first.

Initially, I’m going to have the enemy tanks drive around in random directions. Obviously, I don’t want all the tanks to drive through each other, or to drive off the edge of the map, so I need to program some behaviour for them.

Like this (a test with many tanks so there are lots of collisions).

(I realise the other tanks don’t avoid my tank, and drive straight through it, but that’s because I still have to program special behaviour for that, like shooting at me!).

Read more…

244. WoT – Shooting Damage

Now that I have shooting controls and a way of knowing where a shot hits, I can think about damage.

There’s a video at the end of the explanation.

Read more…

243. WoT – Shooting controls

This is just a short post, showing the addition of shooting controls.

As explained previously,

  • the left hand joystick moves and rotates the tank
  • the second joystick rotates the turret and tilts the barrel

The blue button on the right puts you into aiming mode. You are literally inside the barrelĀ (which is why there is a green shape all the way round the screen) looking out in the direction the shot will go, and you can still use the joysticks to aim. Pressing the blue button then fires, and takes you out of aiming mode. You can get out of aiming mode without shooting, by simply swiping on the screen.

I like that this is extremely simple but looks good and seems to work well.

Now to work on damage…

 

242. WoT – Controls

I haven’t forgotten about shooting, but having figured out how I’m going to do that (and not wanting to start all the testing required), I’ve gone back to adding in movement controls, as I summarised in my last post.

The yellow dot shows the movement of my finger.

The annoying thing is that adding in my own tank at bottom of screen cuts my speed by about 7 frames per second..

So now, back to shooting.

241. WoT – shooting!

I was going to add buildings, but I think I might be able to make the trees work in a game, and also, there is less programming work with trees, because tanks can just drive straight through them, while they have to dodge round buildings.

So I’m going to look at shooting – or more specifically, how we can find out where our shot hits a tank, and what damage it does.

This is a long post, with no pictures, and quite intricate in places, but if you haven’t done this kind of thing before, you should find it interesting, even if you have to re-read parts more than once (I am no different – I take time to understand this stuff, and then make all sorts of mistakes programming it).

Read more…

240. WoT – Culling trees

In my last post, I found that I could improve speed a lot by not drawing trees that weren’t going to seen (ie all the trees that aren’t in front of the camera).

This post is about how I did it. While the result is quite simple, I took the long way to get there, and I didn’t find it easy.

Read more…