Coder Social home page Coder Social logo

Comments (6)

lavinoys avatar lavinoys commented on May 30, 2024 2

@dgant @Bytekeeper
thanks. i solved
code

from jbwapi.

dgant avatar dgant commented on May 30, 2024 1

The most likely reason that this would happen is issuing a train command on consecutive frames. I took a quick peek at your code:

if (commandCenter.type == UnitType.Terran_Command_Center
            && commandCenter.canTrain()
            && commandCenter.trainingQueue.size <= 0
            && self.minerals() >= 50
        ) {
            commandCenter.train(UnitType.Terran_SCV)
        }

This can cause the command center to queue SCVs even when you don't expect it. The reason is because of latency.

Suppose you're running your bot in single player, which has 2 frames of latency. That means that when you tell your bot to train an SCV, the game does not follow the command until 2 frames later:

  • Frame 100: trainingQueue.size ==0 so you tell Command Center to train an SCV
  • Frame 101: trainingQueue.size ==0 so you tell Command Center to train an SCV
  • Frame 102: The Command Center starts training an SCV. trainingQueue.size == 1
  • Frame 103: The Command Center starts training an SCV. trainingQueue.size == 2

Here are two ways to avoid this situation:

  1. Enable latency compensation. This causes (J)BWAPI to present a fictional game state that looks like the game would if there were no latency
  2. Don't issue commands to units you've commanded too recently, perhaps by using unit.getLastCommandFrame()

But if you've encountered an issue not described here, please let us know how to reproduce it.

from jbwapi.

lavinoys avatar lavinoys commented on May 30, 2024

@dgant
Hello. Thank you for your reply. I read your reply carefully.

  1. reply
  • how can i settings "latency frames = 6, turn size = 2", Do I have to modify it within the code?
    Or do I have to modify it within BWAPI?
  1. reply
    If you use this command, you cannot request the following command

from jbwapi.

lavinoys avatar lavinoys commented on May 30, 2024

My English is not good enough.
Thank you for your understanding.

from jbwapi.

lavinoys avatar lavinoys commented on May 30, 2024

I solved it this way. Is this right?
this code

if (isTwiceReq) { isTwiceReq = false return } else { isTwiceReq = true }

from jbwapi.

Bytekeeper avatar Bytekeeper commented on May 30, 2024

@lavinoys You could join our SSCAIT Discord. You will find a link at the bottom of the "readme" of jbwapi here, in the documentation section. A lot of bot authors are hanging around there and might be able to help. (Ok most likely @dgant will answer there as well :) )

from jbwapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.