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

[GH-709] implement dynamic obstacles #715

Merged
merged 37 commits into from
Jul 8, 2024

Conversation

agustinesco
Copy link
Contributor

@agustinesco agustinesco commented Jun 25, 2024

Important

Merge alongside this client pr

Motivation

We need a feature to add dynamic walls they'll work as a normal obstacle but they can be deactivated so player can go through them
Also when an obstacle change state we should trigger a mechanic

Closes #709

Summary of changes

  • Expanded obstacle entity to have
    • status: current obstacle status
    • type: either dynamic or static, this field define behavior
    • statuses_cycle: a map of statuses changes to define dynamic obstacle behavior

How to test it?

Replace the obstacle with the same name in the config.json file with:

{
        "name": "middle stone north",
        "position": {
          "x": 0.0,
          "y": 0.0
        },
        "radius": 0.0,
        "shape": "polygon",
        "type": "dynamic",
        "vertices": [
          {
            "x": -956.0,
            "y": -779.0
          },
          {
            "x": -761.0,
            "y": -727.0
          },
          {
            "x": 219.0,
            "y": -1232.0
          },
          {
            "x": 105.0,
            "y": -1632.0
          },
          {
            "x": -503.0,
            "y": -1416.0
          },
          {
            "x": -995.0,
            "y": -989.0
          }
        ],
        "status": "underground",
        "statuses_cycle": {
          "underground": {
            "transition_time_ms": 3000,
            "on_activation_mechanics": {},
            "next_status": "raised",
            "time_until_transition_ms": 10000,
            "make_obstacle_collisionable": false
          },
          "raised": {
            "transition_time_ms": 3000,
            "on_activation_mechanics": {
              "polygon_hit": {
                "damage": 10,
                "vertices": [
                  {
                    "x": -956.0,
                    "y": -779.0
                  },
                  {
                    "x": -761.0,
                    "y": -727.0
                  },
                  {
                    "x": 219.0,
                    "y": -1232.0
                  },
                  {
                    "x": 105.0,
                    "y": -1632.0
                  },
                  {
                    "x": -503.0,
                    "y": -1416.0
                  },
                  {
                    "x": -995.0,
                    "y": -989.0
                  }
                ]
              }
            },
            "next_status": "underground",
            "time_until_transition_ms": 10000,
            "make_obstacle_collisionable": true
          }
        }
      },

then go to this link and play a match, you should see an obstacle change colors:

  • red means the obstacle is down and can be go through
  • yellow means the obstacle is transitioning from an state to another, no change in behavior
  • green means the obstacle is collisionable and can't be pass through, also the mechanic in the config file should be triggered

If you wanna trigger this pr in the unity client you must delete this component from the obstacleCollider prefab:

image

and when the obstacle is down you should be able to go through the obstacle in the client too

Checklist

  • Tested the changes locally.
  • Reviewed the changes on GitHub, line by line.
  • This change requires new documentation.
    • Documentation has been added/updated.

@agustinesco agustinesco changed the title [GH-709] implement dinamyc obstacles [GH-709] implement dynamic obstacles Jun 25, 2024
@agustinesco agustinesco marked this pull request as ready for review June 26, 2024 19:53
AminArria
AminArria previously approved these changes Jul 5, 2024
Copy link
Contributor

@AminArria AminArria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I didn't test in Unity (had an issue with it on my laptop, not related to PR)

tvillegas98
tvillegas98 previously approved these changes Jul 5, 2024
Copy link
Contributor

@tvillegas98 tvillegas98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job you did here @agustinesco ! Left some comments about the config and about a possible refactor

apps/arena/lib/arena/entities.ex Outdated Show resolved Hide resolved
apps/arena/lib/arena/entities.ex Show resolved Hide resolved
apps/arena/lib/arena/game/skill.ex Show resolved Hide resolved
tvillegas98
tvillegas98 previously approved these changes Jul 5, 2024
Copy link
Contributor

@tvillegas98 tvillegas98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @agustinesco !

* north-eastern spike

* add south-western spikes

* fix clipping for top obstacle

* Fix base statuses for spikes

---------

Co-authored-by: tvillegas98 <tvillegas@fi.uba.ar>
Co-authored-by: agustinesco <agustinesco@outlook.es>
@tkz00 tkz00 marked this pull request as draft July 8, 2024 18:12
@tkz00 tkz00 marked this pull request as ready for review July 8, 2024 18:34
Copy link
Contributor

@tvillegas98 tvillegas98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job fixing the bottlenecks!

Copy link
Contributor

@alfopisano alfopisano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! Tested locally and on my iOS device

@tvillegas98 tvillegas98 merged commit 6b7c5b2 into main Jul 8, 2024
3 checks passed
@tvillegas98 tvillegas98 deleted the gh-709-implement-dinamyc-obstacles branch July 8, 2024 22:08
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

Successfully merging this pull request may close these issues.

Implement Walls
5 participants