Entry 69 with projectile flinging

Between moving houses, doing garden work, and working on my secret project™ I’ve slacked off on blog posts. Admittedly, most of work is (as I mentioned) tedious tweaking and bugfixing.

Predictaments

One almost-mandatory feature is anticipation/prediction of enemy position before a projectile is fired. It is easy to just fire at the enemy where it is now (and hope for the best). However, enemy location almost always changes while the projectile is in flight.

A naive way of firing is to not predict anything and let it land behind the enemy and still register a hit. This is how I did it at first, but it looks retarded. It almost hits the next mob with the time it takes for certain projectiles to finally arrive. A less naive, but weird way is adjusting the projectile as it flies. So if the mob moves, we change the angle slightly. This works fine in most cases, but is very obvious when firing a stream of projectiles or when mobs get extra close to a tower. So this won’t do.

Here’s how it’s done proper. So if the enemy was at green position I when the projectile was fired from brown location I, then we have to aim at position II. This means guessing that the enemy would have moved that distance (orange arrow). Guessing is relatively simple — look at the enemy’s angle and offset the target by a distance proportional to the full distance to the enemy. In this case, this might be a 20% adjustment — so if the total distance is 200 units, the the projectile is fire 40 units ahead of the mob.

As a side note, I could just use the A* path the units are following, but this seems too complex. Besides, firing ahead without fancy path-finding looks natural. If the mob turns, the projectile “misses”. (It doesn’t technically miss, since it always lands on the target as long as it is alive so that I can avoid any precision errors and not worry about 100% precise math/prediction.)

Vulcano tower

I’ve been long thinking how to make the vulcano tower work best. The way Phil drew it from out early concept stage is that is has four separate turrets pointing in different directions. Utilizing this is sightly tricky, because all my towers have a single “head” (turret or otherwise) and all the variables are specific to that one. So basically I made it possible for towers to have more than one head, so to speak. This just means that every tower except vulcano have one head, and vulcano has four. Now I can deal with each one separately — find target, fire, Consuelo resources, set cooldowns, etc.

I made each head/turret only fire in it’s pointing direction (blue cones). So if enemies are in that region, they can fire. This means the tower can be firing up to four projectiles at the same time.

This makes it an excellent tower for tight turns, but not as useful for straight paths. And it is now definitely unique and a worthwhile upgrade from the basic earth tower.

Collectors

My thoughts on collectors can be summarized as “unnnghhrrrr”. Not sure when else to post this, but I’m having fun posting them in every third blog posts with a commentary of “well, we changed collectors”.

The important bit is that they are technically implemented… mostly. I just need to finish them up, polish them up, and then do all the fluffy user interface bits.

I also added some sounds, but you’ll have to take my word for that one  ^_^ .

This entry was posted in Uproot DevDiary.

Leave a Reply

Your email address will not be published. Required fields are marked *