Unity as a simulator

Hey guys,

I’m trying to create smart agents to do some tasks. In order to evaluate each agent, I want to start a specific scene, parametrize it according to the specific agent, run a simulation, and get a score based on the agent’s performance in the scene.

  1. How can I achieve this behavior in Unity? I have a main scene which generates the parameters to create an agent, and a scene to test an agent. From the main scene - create a test scene for each agent, wait for the test to finish, get the score of each agent (computed in the testing scene), repeat. Note that there are a lot of different agents, and testing a few scenes in parallel is preferable.

  2. How can this be achieved outside of Unity? Suppose my agents are generated in a different software, and I want to use Unity as a service (start the Unity process, run the simulation, get a score, terminate the process. Repeat).

Thanks in advance!

No idea what “simulation” means in this context, but you probably want to work through a few different tutorial videos for games that use features of Unity that your simulation anticipates needing: physics or whatever, for example.

You can spawn a Unity game with arguments, you can put stuff in files and have Unity go read it, you can start a server in Unity and communicate with it via TCP/IP, pretty much whatever interprocess communication you like.

3 Likes

You might want to check these links Real-time tools for 3D, AR, and VR development | Products and Real-time tools for 3D, AR, and VR development | Products

2 Likes

Thanks for the reply!

The Unity Simulation Service seems pretty similar to what I’m trying to achieve. However I’d like to run it on my own computer on not on Unity’s cloud, I wonder if that’s doable.

Thanks for the reply!

I suppose that suffices. I was wondering if Unity has something built-in which might save some time, especially if I’m going towards a distributed approach.

Also, is there a way to run a Unity process at maximal time scale?
For example, let’s say I have an agent moving forward at 1 meter/second and I want to see how far it will go in 10 seconds. There’s really no reason to actually wait 10 seconds, it is enough to just compute what happens in these 10 seconds - I don’t need to render the simulation graphically.

I would encourage you to ask here https://forum.unity.com/forums/unity-game-simulation.472/