GithubHelp home page GithubHelp logo

Comments (5)

paulsonnentag avatar paulsonnentag commented on August 23, 2024

In my opinion we should discard any events if the bot program has already received an event or is currently executing an event routine

from todo.

timgrossmann avatar timgrossmann commented on August 23, 2024

In my opinion we should discard any events if the bot program has already received an event or is currently executing an event routine

I think this would be the best approach, too...
Another idea is, that events get a priority which determines how important they are.
I'm thinking about a case where a marker for "resources" is dropped and after that one of "help me fight" is dropped.

from todo.

perguth avatar perguth commented on August 23, 2024

I could imagine such a case (ignoring technical probs of the issue for now):

// code: go find ressources!
game.on('ressourceFound', e => {
  // code: mine and bring home!
})
game.on('enemyDiscovered', e => {
  // since we want to run away, we ignore `ressourceFound` events:
  game.removeListener('ressourceFound') 
  // since we're running away, we're now looking for allies:
  game.on('allyDiscovered', e => {
    // code: group!
  })
  // code: run!
})

(Along the lines of Node EventEmitters)

from todo.

H3rby7 avatar H3rby7 commented on August 23, 2024

I was also thinking about this issue. My Idea would be to have the robot/unit "know" its current subroutine. When a new event occurs the programmer has access to that information and can decide himself in the event handling how he wants to continue. In your example @timgrossmann

Unit State

  • current order: "get ressources"

Event (enemy detected)

  • has information on the unit and the Unit state
  • when handling this event can check for the current order of the unit

Inside Event: event.ENEMY_DETECTED

if (unit.getCurrentOrder() === action.GATHER_RESSOURCES) {
  unit.issueOrder(action.FLEE)
}

This way we pass the problem and soultion and power to the programmer. He could also not check for the event and always take the newest event, or check if an order is present and just continue. As he pleases.

from todo.

H3rby7 avatar H3rby7 commented on August 23, 2024

Addressing the multiple Actions event I would suggest to have a list of events that happened in the entity as suggested here in the Object>Unit section. There is an example there.
Again this empowers the coder to chose which event to handle.

from todo.

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.