greentfrapp/pysc2-RLagents

Marines did not move at all

vwxyzjn opened this issue · 6 comments

Hi,

I am conducting similar research on defeating the roaches and I was trying to run your code... But the marines just stay at where they were, and almost it almost seemed that the game just froze. Check out the following picture.

image

I simply use python PySC2_A3Cagent.py to run it. Should I pass some kind of parameters?

Thanks.

Nope no parameters are needed. I think it might be a Windows thing, probably the threading. I've only tried it on Mac and Linux so far. I'll try to install SC2 on my Windows setup and run the script. Can I check if there are any error messages? I assume the Remaining Time counter in the screenshot doesn't run either right?

@greentfrapp Thanks for replying. There is no console message at all actually. So no, the remaining time counter did not show up.

image

Oh I meant the Remaining Time counter in the Starcraft 2 screens. Anyway thanks for highlighting this! I'll look into it but it might take awhile because I seem to be having trouble installing Starcraft2 on my Windows. Meanwhile, let me know if you manage to figure out the problem!

@greentfrapp I made it working.

image

It was the multiprocessing that's doing the harm. If I change num_workers = 1 instead of multiprocessing.cpu_count(), then your program is able to run.

    with tf.device("/cpu:0"): 
        global_episodes = tf.Variable(0,dtype=tf.int32,name='global_episodes',trainable=False)
        trainer = tf.train.AdamOptimizer(learning_rate=1e-4)
        master_network = AC_Network('global',None) # Generate global network
        num_workers = 1 # Set workers to number of available CPU threads
        workers = []
        # Create worker classes
        for i in range(num_workers):
            workers.append(Worker(i,trainer,model_path,global_episodes))
        saver = tf.train.Saver(max_to_keep=5)

Okay great! Thanks! I'll try to push a version that fixes that soon. Meanwhile, I recommend that you try to set num_workers to > 1 at least, to take advantage of the asynchronous component.

Hi @vwxyzjn, can you try the latest PySC2_A3C_AtariNet.py script and see if that works in Windows? I've replaced the multiprocessing module with psutil for retrieving the cpu_count. Sorry I haven't been able to install SC2 on my Windows yet so I haven't been able to try that out on Windows.