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

Sphere selectors #39

Closed
jakubg1 opened this issue Mar 27, 2021 · 5 comments
Closed

Sphere selectors #39

jakubg1 opened this issue Mar 27, 2021 · 5 comments
Assignees
Labels
A: Game Data Issue with game data. D: Change/Suggestion A change to an existing feature. R: Implemented A suggestion has been added into the code.

Comments

@jakubg1
Copy link
Owner

jakubg1 commented Mar 27, 2021

Allow to create, based on some criteria such as position or color, an instance of a class that would contain a list of spheres with which you can do varius stuff, such as change their color or destroy them.
This would be useful for most powerups which mess with spheres. Currently, all that stuff is in Session.lua which isn't the best place to store all these functions.

@jakubg1 jakubg1 added R: Open D: Change/Suggestion A change to an existing feature. labels Mar 27, 2021
@jakubg1 jakubg1 removed the R: Open label Apr 16, 2021
@jakubg1 jakubg1 added the A: Modding Issue which will impact modders if worked on. Potentially a breaking change. label Aug 16, 2021
@jakubg1 jakubg1 added this to the Full 1.0 release milestone Mar 6, 2022
@TF3RDL
Copy link

TF3RDL commented Nov 6, 2022

This can hopefully improve flexibility on powerups that affect spheres in any way (like color replacer should affect two colors and leave wild spheres intact when they hit a wild ball per #65)

@jakubg1
Copy link
Owner Author

jakubg1 commented Nov 18, 2022

That's good you mentioned color replacers, they may be a bit of a problem because there would need to be various parameters for sphere selectors which exist in one context but not in the other, such as color. That remains to be seen, though.

@jakubg1
Copy link
Owner Author

jakubg1 commented Nov 30, 2023

Under the hood, sphere destruction should support #121.
Example sphere selectors:

sphere_selectors/color_bomb_1.spsel:

{
    "conditions": [
        {
            "type": "color",
            "colors": [1]
        },
        {
            "type": "isOffscreen",
            "value": false
        }
    ]
}

or alternatively:

{
    "condition": "$expr{[color] == 1 && ![isOffscreen]}"
}

sphere_selectors/fireball.spsel:

{
    "conditions": [
        {
            "type": "distance",
            "max": 75
        }
    ]
}

or alternatively:

{
    "condition": "$expr{[distance] < 75}"
}

sphere_selectors/lightning.spsel:

{
    "conditions": [
        {
            "type": "distanceX",
            "max": 50
        }
    ]
}

or alternatively:

{
    "condition": "$expr{[distanceX] < 50}"
}

sphere_selectors/everything.spsel:

{
    "conditions": []
}

or alternatively:

{
    "condition": "$expr{true}"
}

Problem with Expressions: how do we calculate only necessary variables?

@jakubg1
Copy link
Owner Author

jakubg1 commented Jan 21, 2024

Another approach:
sphere_selectors/color_bomb_1.json:

{
  "operations": [
    {"type": "add", "condition": "$expr{[sphere.color] == 1 && ![sphere.isOffscreen]}"}
  ],
  "scoreEvent": "score_events/color_bomb.json"
}

sphere_selectors/fireball.json:

{
  "operations": [
    {"type": "add", "condition": "$expr{[sphere.distance] < 100}"}
  ],
  "scoreEvent": "score_events/fireball.json"
}

sphere_selectors/lightning.json:

{
  "operations": [
    {"type": "add", "condition": "$expr{[sphere.distanceX] < 50}"}
  ],
  "scoreEvent": "score_events/lightning.json"
}

sphere_selectors/everything.json:

{
  "operations": [
    {"type": "add", "condition": true}
  ]
}

And hypothetical sphere_selectors/limited_color_bomb_2.json:

{
  "operations": [
    {"type": "add", "condition": "$expr{[sphere.color] == 2 && ![sphere.isOffscreen]}"},
    {"type": "pickRandomly", "count": 20}
  ],
  "scoreEventForSphere": "score_events/color_bomb.json"
}

The difference between scoreEvent and scoreEventForSphere fields being that the former is executed once for the entire batch, and the latter is executed for each sphere separately (these fields should actually belong to powerup effect config instead, lol)

@jakubg1 jakubg1 added A: Game Data Issue with game data. and removed A: Modding Issue which will impact modders if worked on. Potentially a breaking change. A: Code labels May 19, 2024
@jakubg1
Copy link
Owner Author

jakubg1 commented May 20, 2024

Implemented: 45dc56b

@jakubg1 jakubg1 closed this as completed May 20, 2024
@jakubg1 jakubg1 self-assigned this May 20, 2024
@jakubg1 jakubg1 added the R: Implemented A suggestion has been added into the code. label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: Game Data Issue with game data. D: Change/Suggestion A change to an existing feature. R: Implemented A suggestion has been added into the code.
Projects
None yet
Development

No branches or pull requests

2 participants