# How to run concurrent sketches

**URL:** https://discourse.processing.org/t/how-to-run-concurrent-sketches/26816
**Category:** Project Guidance
**Created:** [January 6, 2021, 3:21am UTC](https://discourse.processing.org/t/how-to-run-concurrent-sketches/26816 "2021-01-06T03:21:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Cooper.Davies](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@Cooper.Davies](https://discourse.processing.org/u/Cooper.Davies)
#### Post date: [January 6, 2021, 3:21am UTC](https://discourse.processing.org/t/how-to-run-concurrent-sketches/26816/1 "2021-01-06T03:21:22Z")

</div>

The question I have regarding processing is how would I go about managing multiple rendering frames concurrently. For more context, what I am trying to create is a genetic algorithm to play a game which I will create using processing. To speed up the training time of the learning, I want to concurrently run a sketch multiple times, and have each sketch controlled by an agent.

My immediate thought is to simply have an external program execute a sketch multiple times but I am a little worried about how to handle the sketch input in this scenario.

Could anyone please point me in the right direction for how to achieve this?

---

<div class="post-metadata">

### Author: ![ErraticGenerator](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/erraticgenerator/32/11304_2.png) [@ErraticGenerator](https://discourse.processing.org/u/ErraticGenerator)
#### Post date: [January 9, 2021, 5:22am UTC](https://discourse.processing.org/t/how-to-run-concurrent-sketches/26816/2 "2021-01-09T05:22:02Z")

</div>

Have you thought about offscreen graphics buffer with `createGraphics()`? Or, run multiple sketches and set up communication with OSC, etc.

---

<div class="post-metadata">

### Author: ![Cooper.Davies](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@Cooper.Davies](https://discourse.processing.org/u/Cooper.Davies)
#### Post date: [January 16, 2021, 6:45am UTC](https://discourse.processing.org/t/how-to-run-concurrent-sketches/26816/3 "2021-01-16T06:45:36Z")

</div>

I was probably not going to run graphics unless enabled (place all calls to render within a conditional). Reading into OSC that looks to be interesting. If I’m reading OSC correct it seems to be a streaming format. I’ll look into create data streams and see if I can implement it this way. Thanks!
