Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2015-12-23 20:39:27

Andyamakeer
Member
Joined: 2015-12-23
Posts: 6

Threadding

Hello World!

I would like to ask if is there a way for making a multithreadding performance to my bot. Like, the bot is working, but it just do 1 action per step for each player. I would like to do all actions simuntaneously. Thanks //forums.everybodyedits.com/img/smilies/wink

Offline

#2 2015-12-23 20:47:24, last edited by Zumza (2015-12-23 20:49:54)

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,645

Re: Threadding

So many ways to do it in .NET
But I suggest you to don't make 30 threads... Try rethink your algorithm.
If you're looking to a specific amount of time between checks the best option is Timers( e.g. of an implement http://stackoverflow.com/questions/1253 … nt-a-timer ).
Else you may also want to take a look on Tasks https://msdn.microsoft.com/en-us/librar … .110).aspx


Everybody edits, but some edit more than others

Offline

#3 2015-12-23 23:03:21, last edited by Tomahawk (2015-12-23 23:03:35)

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,837

Re: Threadding

Be careful not to go too deep into Stack Overflow looking for the perfect multithreading - it quickly becomes a bit of a nightmare if you're trying to synchronise data across threads, or want to stop one after it's started.

You can only multithread across as many threads as your CPU has cores (don't quote me) - otherwise it just really quickly switches between threads. Try using the thread pool.


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

Tomahawk1450908201569770

Board footer

Powered by FluxBB

[ Started around 1714966323.8858 - Generated in 0.023 seconds, 12 queries executed - Memory usage: 1.38 MiB (Peak: 1.48 MiB) ]