Will we be able to create own mods for the flowfield?

Discussion in 'Planetary Annihilation General Discussion' started by syox, March 23, 2013.

  1. syox

    syox Member

    Messages:
    859
    Likes Received:
    3
    I am here mostly thinking of using the flowfield in a logistics mod, for automated bots.

    Or automatic mex generation.

    Good think would be you can't use something like this as userscript cuz it has to be serversides.
  2. syox

    syox Member

    Messages:
    859
    Likes Received:
    3
    Answer?
  3. Pawz

    Pawz Active Member

    Messages:
    951
    Likes Received:
    161
    Um how the heck would 'using the flowfield' even mean anything?

    You can get from A to B very efficiently using lots of units. The underlying tech doesn't really make any difference in terms of a mod...
  4. syox

    syox Member

    Messages:
    859
    Likes Received:
    3
    Create own flowfield is the goal.
    For logistics there could be 3 flowfields:
    one for the refill stations like mexes or something
    one for the "where to bring stuff" to
    one dynamicly for the carry units to not have too much of them in one place.

    With this and automated fill up or fetch commands i could maybe create a logistics mod that doesnt need much of an AI or so. And i want to do that ;)

    Edit maybe the title of the thread is missleading.
  5. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    I think you're misunderstanding what flow fields are for. They're the how of getting from point A to point B, but not the why or where. Both of those questions are answered before the flow field is generated. And all flow fields are dynamic.
  6. syox

    syox Member

    Messages:
    859
    Likes Received:
    3
    Ok let me explain.

    I am now talking about the mod i maybe will try to make:
    Its about logistics, fuel and ammo.

    All units have an internal storage of energy and or mass.
    They use that for stuff they do, like driving building, existing ...

    Then there are little worker bots, or maybe this role would be filled in by the engineers.
    They have a huge storage. Only they can fetch Mass or energy from mexes or generators or storages. And also only they can afterwards distribute it to other units/buildings.

    Now comes the Flowfield, for each point where mass energy is needed i would create a goal, with maybe a lower number (0 mean ultimate goal) for higher priorities.
    Filled/not empty Workes will 'ride' this flowfield to there destination and automaticly refill the internal storage of stuff at the goal.

    If they are empty the switch to the Generation flowfield where every Generator(mass, energy, storage) is a goal, with lower number(0 as above) for generators that can support more workers. If the worker reach such a generator they will fill up automatically.

    To not have all workers just support one route. i would use maybe a third flowfield wich adds cost if many workes occupie a small area , but lowers cost if there are many generators or consumers. To distribute the workers over the area.

    Do you still think this is undoable?
    Well maybe a AI system is kind of easier on the pc ressource side. But i dont know that. All i asked was if modders could create own flowfields, does not necessary relay to this idea. Also for other movementtypes or such.
  7. thapear

    thapear Member

    Messages:
    446
    Likes Received:
    1
    Please stop asking for stuff to do with flowfields yourself. The flowfield system is just a different approach to finding paths in an RTS. It is not a tool for the user to use to make units behave a certain way. If you want units to move to from A to B, but go through C, place a waypoint at C...


    The massive amount of people asking for control over flowfields will probably make Uber think twice before showing this kind of stuff again...
  8. syox

    syox Member

    Messages:
    859
    Likes Received:
    3
    So modding of the game only is, making stupid unit models and web ui?

    Also i dont want to change the flowfield engine itself i just want to use it.

    And read my post above and explain me why i cant achieve that with flowfields?
  9. shinseitom

    shinseitom Member

    Messages:
    57
    Likes Received:
    0
    This response pains me.

    "Please stop asking for stuff to do with animation/physics yourself. The animation/physics system is just a different approach to visualizing movement/computing ballistics. It is not a tool for the user to make units behave a certain way. Insert semi-annoying alternative."

    This is what I hear. I agree that some of the requests and questions are from people who don't understand what this does, but others are coming up with legitimate cases where they would want control or at least the ability to tinker/mod around, and shutting them down like this is ridiculous. If you are going to say it doesn't apply to what they're thinking up, at least try to explain it to them. This is obviously new tech and it just hasn't clicked for some yet.

    As an answer, a flowfield can be viewed as a very high-level A* (D*?) pathfinding algorithm. You have a start point, an end point, and the "land" in-between. The "land" has a cost associated with it (mud is slower, mountain impassable, plain perfect) and the units simply try to go on the (generally) lowest cost path in the (generally) shortest amount of time. These "fields", from what I got from the video, are updated as needed and are nothing more than an extremely sophisticated array of cost values related strictly to movement. That's all.

    What you want seems to be an automatic ai that checks the closest resource generator/depot and if it has too many units drawing resources, to check another and on and on until it decides to go to one. None of that really has to do with the flowfields until it has already decided and created the internal move order. At that point though you don't have anything to "mod" about the flowfield, as it's only used for efficient movement to a target destination.

    Please, devs, if my interpretation is wrong correct me.
  10. TheLambaster

    TheLambaster Active Member

    Messages:
    489
    Likes Received:
    131
    @ syox:

    I don't quite understand what you have in mind... but what does the flowfield have to do with distributing those workers evenly across all places where they are needed? I mean, I see where you are coming from... but the flowfield is only supposed to efficiently guide units from one point to another and not to spread them between k possible goals... I think what you want to achieve has to be done in a completely different way. You need a mechanism that detects where your workers are and where they are needed and then allocates them in a sensible way across those places.
    But as I said, I don't quite understand what you have in mind, so maybe what I wrote here is irrelevant to your idea or even all out wrong.


    I second this...
  11. menchfrest

    menchfrest Active Member

    Messages:
    476
    Likes Received:
    55
    From what I got from your OP was that we actually have 2 problems in one. One is task allocation (who does what/ends up at what goal), and one is path planning/execution (how do I get from where I am to where I need to be).

    The flowfields are a solution to the path planning/exectution problem, A to B in a nice collision free fashion.

    You could try to get it to go from where it is to the "cheapest" of several potential goals, there are some concerns and issues you need to consider though. One, that is not likely to be built in functionality, I think it'd take some serious rewriting of the flowfields themselves, and gets expensive because you almost have to have a global flowfield. Second, you can't make any guarantees to how many will end up where(at least not without adding more non intended behavior),

    The amount of modding that the flowfield would need to make it handle who does what, I think it'd be easier to write a small script/AI that'd handle assignment, and issue normal move orders (which would use the regular flowfields).
  12. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    There are likely to be several sets of flow fields being generated and updated in real time, perhaps one for each set of units or unit types currently in motion. The flow field for Unit 1 going from point A to point B is going to be a different flow field from Unit 2 going from point C to point D. Their cost fields may even be completely separate if they're a different kind of unit. A spider unit that isn't affected by cliffs might just go straight over it (zero cost), where as a track unit will see it as impassible.

    It's possible these cost fields will be used as part of the AI, but that's a question for sorian.

    So the direct answer to the question of will you be able to use custom flow fields to keep units from wandering in areas near each other or near high value items is both yes and no. No because that's not what flow fields are for, they direct the flow of units from a specific location to another specific location. And yes because if you have a custom AI to direct individual units to high value locations apart from each other the act of giving them orders to path / patrol creates flow fields.

    The answer to the question of if you'll be able to create cost fields to help direct custom AI behaviors, but that's a larger question about what level of automation do we want to allow players to have. Flow fields themselves and the cost fields used to generate them won't be available to the clients as well as they only exist on the server. It us certainly not outside the realm of plausible ideas for a server side AI mod, but I can't speak to what kind of tools we'll have there for modding... because I don't know.

    Damn it Jim, I'm a technical artist, not an AI programmer!
  13. yogurt312

    yogurt312 New Member

    Messages:
    565
    Likes Received:
    2
    What we've been shown of the flowfields looks a bit like this:
    [​IMG]

    The cost creates barriers or areas of increased difficulty of travel leaving to this nice picture of what is essentialy equivalent distance. Now i'm no programmer (i've done enough programming to understand most of the concepts), but i believe what the units see looks more like this:

    [​IMG]

    And that block tank there is sitting there thinking "blue is better than purple! I'll go that way!"

    The reason i bring this up is because a lot of people still seem to have trouble grasping the full concept of flow feilds.
  14. syox

    syox Member

    Messages:
    859
    Likes Received:
    3
    Ok i see where you comming from. This will as explained above only work if the engine supports more than one goal at once.
  15. nachtnebel

    nachtnebel New Member

    Messages:
    7
    Likes Received:
    0
    As far as I can tell from my - rather limited - experience with flow field like systems supporting more than just one goal at the same time isn't something flow fields are made for.
  16. menchfrest

    menchfrest Active Member

    Messages:
    476
    Likes Received:
    55
    It's like trying to use a wrench as a hammer, you could.., but ewww... Many things in theory could work, but why would you when the right thing is so much better and less likely to break?
  17. syox

    syox Member

    Messages:
    859
    Likes Received:
    3
    Depends on the iteration over the costfield. If you do it per the minimal integrated costs(first all neighbors of 0-fields, then 1i-costfields, then 2-i-costfields,...), its doable.

    The thing is i will have to do the pathing anyways.
  18. redn4x

    redn4x New Member

    Messages:
    13
    Likes Received:
    0
    Yes you can. You can create dozens of goals and then every unit will walk to the one nearest to it. This can be done in one flow field. In syox example, you have a dozen workers and a dozens resource spots that need to be mined. You construct your flow field, and it will show the shortest distance to any resource spot. If you are unlucky, all of the units will move to one mine.
    Now extend that a bit. Instead of single resource spots, you assign values to the ground to where resources are needed and where they are available. Transport units with empty storage will run to the resource spots and full units will run to buildings that have a demand. This has somewhat of a resemblance to charged particles moving in an electric field moving charge around.
  19. menchfrest

    menchfrest Active Member

    Messages:
    476
    Likes Received:
    55

    This would work, but it would work very poorly, everything would always go to the closest goal, so farther goals may never get reached if new closer ones are popping up. It would run, and if you ran it for a long enough time, it might actually work assuming you can source way more supplies than you need, because you will essentially have to push carriers out by over-saturating the nearby regions.

    This would also negate the advantage of having flow fields over sectors instead of over the entire planet.

    It would work, but it is the wrong tool for the problem trying to be solved.
  20. kvalheim

    kvalheim Post Master General

    Messages:
    1,726
    Likes Received:
    645
    MISSING THE POINT :D
    Something PA fans seem to do a lot regarding livestreams

    The flowfield isn't anything special or tangible you can particularly mod. It's deeply built in to the game because it's the basics for finding a patch from point A to point B. I don't know what you particularly hope to do by changing it.
    It's like trying to mod the lighting engine or rendering. You -could- if you have a lot of technical knowhow, but there's very little point.
    plus, the flowfields are serverside, so that makes even less reasoning

Share This Page