RoboTank

by smcpeak

RoboTank is a tank that drives and shoots automatically, following the lead of a manually piloted commander vehicle.

Content
3 years ago
0.15 - 1.1
5.05K
Combat

i RoboTanks get stuck on cliffs and water. Make collision box much smaller?

4 years ago
(updated 4 years ago)

I quick test this mod, their main enemy is them self, the cliff, and puddle of water.
So, how about reduce their collision box ? It will lower the probability of them being stuck ?
Tbh, i have no idea how collision box work, maybe it also reduce the probability of them get a hit thus make them virtually OP ?

But in the other hand, the alien they literally on top each other in massive number and yet didn't get stuck ?
And yet we can still shoot at it ?

4 years ago

I do not understand the problem you are describing. Perhaps you could attach a screenshot?

A lone RoboTank should only be blocked by things that would block a normal tank.

In tightly packed groups, RoboTanks can become "stuck" due to trying to avoid colliding with each other. You should leave at least 1 or 2 tank lengths of space between them in your formation.

4 years ago
(updated 4 years ago)

Better to explain in videos :
https://youtu.be/3TEwkL7wHqw

Things happens, unseen cliff, unseen puddle of water covered by ores or trees, or simply a bad decision from a genius commander like me 😁

Can't the pathfinding mimic what the Total Automization Mod does ?
https://mods.factorio.com/mod/Total_Automization

Here i test the Total Automatization pathfinding with the exact same cliff, same destination:
https://youtu.be/MO6lS0sDRnw
They arrive at destination smoothly, avoiding cliff, and even form a line, just like my robotank formation.

Aside from the pathfinding, one of the trick i notice is that they overlap with each other,
Thus why the thread is asking about collision box size.

Before you saying, "Then use that mod"
No, that mod is a remote warfare, they can't follow player,
Your mod is an awesome bodyguard in tank form.πŸ‘

4 years ago

These videos make the problems you're describing much easier to understand, thanks!

The main problem I see is the fact that the RoboTanks do not avoid running into cliffs (or water). I think making the collision box smaller would not help very much since they would still run into cliff and shore lines. What I personally do is carry a lot of cliff explosives with me and have my construction robots destroy the cliffs near my squad. A long-standing TODO of mine is to have the RoboTanks automatically navigate around water and cliffs, but it is a fair amount of work.

Another problem is that they run into each other if you maneuver too quickly. A smaller collision box might help with that, although like you say, it raises balance issues. What I do is maneuver more slowly, especially when turning. This too could be improved in the RoboTank driving logic, but it is somewhat complex because the problem specifically arises due to having to predict curved (rather than just linear) motion.

From the behavior I see in the video, Total Automatization is using the Biter AI to drive its vehicles. I chose not to use that AI mainly because the units (e.g., biters) do not maintain formation while moving, yet fighting while moving is essential to mobile warfare in general, and particularly in Factorio 0.17 with the changes to how spitter and worm attacks work (namely, with an area-of-effect), making it suicidal to stay in one place while under attack. Biter AI also does not have any notion of velocity or turn speed, so letting it drive the tanks would cause them to move and turn in an unnatural way.

So, to move this discussion forward: if the request is simply to make the collision box smaller, my current answer is "no" because I don't think it will significantly help. However, if you're interested in hacking on the code, I could tell you how to do that in your own copy so you can experiment and report back. (If you then find it actually does help, I'd consider at least making it a configuration option.)

Alternatively, we can focus this thread on a problem rather than a particular solution, in which case the candidates I see are "RoboTanks do not avoid cliffs" and "RoboTanks do not avoid each other while turning". Which of those do you see as most important? Or is there a different problem that is more important than either of those?

4 years ago
(updated 4 years ago)

Sure, if you're telling me how to reduce their colision box,
(and how to debug overlay thing to see the the collision box), i would do it.
At least we can see how the collision box will lessen the collision between them self (Or not), or the overall fighting balance.

Regarding the priority problem, entity like cliff and puddle water is definitely the main concern by far compare to "collide with each other"
There is a mod that i plan to use to generate a choke point map.
https://mods.factorio.com/mod/ChokePoint
Robotank would be dead in the water if used on that generated map.

So, what i'm thinking is this.
You already have a mechanism to tell robotank how to get out when they get stuck (reverse then do something),
Plus you already have a set of parameter what consider being in "stuck" state, it's pretty good.

So, what if, when they get stuck, just switch to biter AI instead using the current mechanism.
After all the main goal is to reach the player, not to retain formation.
Only after they unstuck and near player they switch to RoboTank AI again to form formation.

Also, Total Automatization use "Unit Control" mod as their engine,
https://mods.factorio.com/mod/Unit_Control
From the same mod author btw, Klonan.
So perhaps you can use it so you didn't have to write Biters AI thing ?

4 years ago

To see the collision boxes, open the debug menu (F4), then check the box "show-collision-rectangles". (F4 again to close the debug menu.)

To change the collision boxes for RoboTanks:

  1. In the Factorio/mods directory, unpack RoboTank_1.1.1.zip, then move the zip file somewhere else. You should then have a subdirectory called RoboTank_1.1.1 in the mods directory, and inside RoboTank_1.1.1 there should be a file called data.lua, among others.

  2. Edit the data.lua file with any text editor. Look for the string "local robotank_entity =" (that is line number 100). After that line, add a line like this:

robotank_entity.collision_box = { { -0.9, -1.3 }, { 0.9, 1.3 } };

The above is the default collision box, so nothing will be different. To make it smaller, try, for example:

robotank_entity.collision_box = { { -0.1, -0.1 }, { 0.1, 0.1 } };

Regarding your idea to switch to the Biter AI when the tank becomes stuck, I was thinking along similar lines. I will investigate doing that. Be aware that, as this is just a random hobby for me, it may be a while before I start working on it. :) Also, I think Unit_Control just uses Biter AI under the hood, but I'll look into it as well.

Meanwhile, I'm changing the title of this thread to indicate that its focus is on the problem that tanks get stuck on cliffs and water.

4 years ago

OK, i will try collision box thing
Thanks πŸ‘

Also, no need to rush, or even working on it, it's just suggestion after all. 😊

New response