johnroper100 / CrowdMaster

Crowd Simulation for the Masses
http://crowdmaster.org
GNU General Public License v3.0
133 stars 24 forks source link

Fixed position formations #7

Closed Peter-Noble closed 7 years ago

Peter-Noble commented 8 years ago

Please see my folk and pull request for relevant updates.

Agents can now request specific positions in formations (by index number of the vertex in the guide mesh) but to make this useful each agent needs to request a different position. I think an option would be to have the generation script assign a vertex index to each agent as an agent variable (a dictionary called agvars stored in each agent object for things like this. At the end of each frame the resulting variables in agvars are moved to access to be used) based on where the script places the agent. The attached file demonstrates how it might be used. The input string would look something like: Formation.A.fixedDist(State.userObject.vars["targetID"]). I don't really understand how the generation script is working so I can't finish formation for the moment.

FixedPositionFormations.zip

johnroper100 commented 8 years ago

Currently in https://github.com/johnroper100/CrowdMaster/blob/master/cm_agent_generation/generation.py all the generation code is stored. You can see in this issue https://github.com/johnroper100/CrowdMaster/issues/5 that with the merge the agent vexation has stopped working. I am working on this. If you have any ideas about the error message it would be great. Currently, all the generator does is duplicate the agent group and set a random location, rotation, and scale (neither work, see the issue).

johnroper100 commented 8 years ago

I want to try to get the add-on to a state where it is easy to understand by any user, but still (hopefully) get to a point where it has the power of MASSIVE. For one, I have updating the description of each node. Currently, many are the same and this is confusing to say the least.

johnroper100 commented 8 years ago

So for now, my first goal is just to get the random agent generation working and have the agents added to the agent list automatically. After that, I am going to work on agent generation in a row/array like an army and we can try to apply the positions to your positional code.

johnroper100 commented 8 years ago

https://upload.wikimedia.org/wikipedia/commons/c/cf/Christlarena2.jpg

This is the type of scene I would like to create.

johnroper100 commented 8 years ago

Also, I would like it if the node tree could be greatly simplified for this sort of thing. I wish it could be as simple as 2-5 nodes. Take a look at these MASSIVE videos to see how the node trees are set up there.

Peter-Noble commented 8 years ago

Sounds good. If you could get the generator so that it's fairly easy to set up a stadium that would be amazing! Can I suggest that we create another issue or a wiki page for gathering ideas for simplifying and performance issues?

johnroper100 commented 8 years ago

Yes. The page is https://github.com/johnroper100/CrowdMaster/wiki/Ideas-about-performance-and-simplification

johnroper100 commented 8 years ago

After looking at some examples, I see how the formation mesh is used.

johnroper100 commented 8 years ago

Now how can I setup a mesh whenever a formation of agents is generated my my code?

Peter-Noble commented 8 years ago

Maybe we could just write a function which creates a new node tree for the formation controller and then in the generation code make a mesh by adding vertices at the same positions as the agents.

johnroper100 commented 8 years ago

That could work

johnroper100 commented 8 years ago

@Peter-Noble look at these formations: https://www.youtube.com/watch?v=CkLoZCuy1Rw&app=desktop

Peter-Noble commented 8 years ago

So to do it like that we could add another field to the generator which is a guide object and then agents are generated wherever there is a vertex in the guide object. Then assign an agent variable equal to the index of the vertex they were assigned at and use shape keys to change the shape of the mesh. If we did that we wouldn't be too far off what Miarmy can do and it would be easy to add another option to the generator when the formation type is set to shape.

Peter-Noble commented 7 years ago

This isn't really an issue anymore but a feature request. I've broken down the feature request into tasks in the "Quick Projects" section.