Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new actions #52

Open
valko073 opened this issue Mar 27, 2019 · 1 comment
Open

Adding new actions #52

valko073 opened this issue Mar 27, 2019 · 1 comment

Comments

@valko073
Copy link

Hi guys, first of all I wanted to thank you for this awesome framework!

I am curious if there is a way of adding new actions for the agents, i.e. a second type of attack which has different properties and effects.

@merrymercy
Copy link
Collaborator

merrymercy commented Mar 30, 2019

Hi,

You have to hack the engine. I can point you to some related code.

  1. Here we record the action for agents
    if (act < type.turn_base) { // move
    move_buffer_bound.push_back(MoveAction{agent, act - type.move_base});
    } else if (act < type.attack_base) { // turn
    turn_buffer_bound.push_back(TurnAction{agent, act - type.move_base});
    } else { // attack
    attack_buffer.push_back(AttackAction{agent, act - type.attack_base});
    }
  2. Here we compute the results of attack actions
    // attack
    #pragma omp parallel for reduction(merge: render_attack_buffer)
    for (int i = 0; i < attack_size; i++) {
    Agent *agent = attack_buffer[i].agent;
    if (agent->is_dead())
    continue;

Current actions are numbered by the order of (move, turn, attack). If you want to add another type of attack, you can put them after the current actions, i.e. (move, turn, attack, new attack)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants