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

New psionic ablility: Precognition #2131

Merged
merged 59 commits into from
Dec 19, 2024
Merged

Conversation

ewokswagger
Copy link
Contributor

@ewokswagger ewokswagger commented Nov 6, 2024

About the PR

Adds a new psionic power: Precognition. Precogs can tap into the nosphere to predict the future giving mysterious omens of things to come. When used you will get a message corresponding to the next station event within 5 minutes. There may be a chance that the result will be random to simulate unreliable readings.

Why / Balance

Psionics are part of DeltaV's unique identity but can sometimes feel stale and ancillary. Psionic powers could use some more variety and give supporting systems more uses, and this ability could open the door to more roleplay and gameplay possibilities. People could play as oracles predicting the future and warning of ill tides and give fun interactions with reporters and chaplains. Telepathic chat can be a hub of rumors both current and future. A local seer may be consulted to warn the station of harm.

Technical details

TODO:

  • Event scheduler changes
    • NextEvent
      • Component
        • Id
        • Time
      • System
        • Store new event
        • Return old event
        • Store new time
    • Schedulers
      • Prototypes
        • GlimmerEvent (Explicitly excluded due to lack of glimmer prediction)
        • BasicStationEvent
        • RampingStationEvent
        • MeteorSwarm
        • KesslerSyndrome
        • SpaceTrafficControlEvent
        • SpaceTrafficControlFriendlyEvent
      • NextEvent handling
        • Update
          • Gen events based on next event time
          • Integrate with NextEvent
            • Get stored event
            • Update with new time and event
          • RampingStationEventScheduler
        • Init
          • Gen event for initial NextEvent
          • RampingStationEventScheduler
    • Event Manager
      • Allow argument for gen events on a passed time
      • Method to return a generated event without running
  • Precognition Ability
    • Sprite
    • Messages
      • Prototypes
      • Descriptions
    • Ability
      • Psionic Powers
      • Action
        • Basics
        • Do after
      • Functionality
        • Get next event
        • Deliver message
        • Random

Having the ability be able to predict the next event requires the next event to be pre-generated so that the precognition ability can access it. To hold this data a new component NextEventComponent will be attached to event schedulers and will contain two fields, EntProtoId NextEventId and TimeSpan NextEventTime. NextEventSystem will provide a method UpdateNextEvent which updates the id and time with the given arguments and returns the previously stored id.

NextEvent components were attached to the various event scheduler prototypes that will be using the new system. The RampingStationEventSchedulerSystem and BasicStationEventSchedulerSystem were updated to check if the scheduler has the NextEvent comp and will change its logic to utilize them. All the event schedulers are variations of the BasicStationEventScheduler and use BasicStationEventSchedulerSystem except for RampingStationEventScheduler.

I will refer to RampingStationEventSchedulerSystem and BasicStationEventSchedulerSystem similarly since they both have similar logic flow but slightly different names here and there (RampingStationEventScheduler could probably be made into a variant of BasicStationEventSchedulerSystem but it's not upstream). Started will now check if there is a NextEvent and will update NextEvent at the start since we have shifted the timeframe to be looking for the next event. In Update check for NewEvent and will then get EventManagerSystem to generate an event without running it. It will then call
UpdateNextEvent to update it with the generated event and next event time which is time till next event + current round time.

EventManagerSystem has had its generate event separated from running events so that the scheduler systems can call that to generate events without running them. TryGenerateRandomEvent will return false if it fails but outs the event otherwise. RunRandomEvent will now instead call on TryGenerateRandomEvent. Various methods in EventManagerSystem have had overloaded versions with a TimeSpan? eventRunTime so that the scheduler systems can generate for events in the future.

The precognition ability will look though all the NextEvent components and will compare the times to find the one that is the soonest in the future and will return a message based on a localization table.

Media

2024-11-19.21-13-14.mp4

image

Requirements

Breaking changes

I have included overloads to changed methods to allow for backwards compatibility but I have made changes to the following methods

  • EventManagerSystem
    • RunRandomEvent now calls a new TryGenerateRandomEvent to generate an event to run
    • TryGenerateRandomEvent
      • logic that was used in RunRandomEvent
      • Added argument for TimeSpan? eventRunTime
      • Overloaded version with no TimeSpan? eventRunTime calls TryGenerateRandomEvent with null eventRunTime
    • TryBuildLimitedEvents
      • Added argument for TimeSpan? eventRunTime
      • Overloaded version with no TimeSpan? eventRunTime calls TryGenerateRandomEvent with null eventRunTime
    • AvailableEvents
      • Added argument for TimeSpan? eventRunTime
      • Overloaded version with no TimeSpan? eventRunTime calls TryGenerateRandomEvent with null eventRunTime
  • BasicStationEventSchedulerSystem
    • ResetTimer(eventScheduler) happens before getting new event in path where entity has nextEventComponent
  • RampingStationEventSchedulerSystem
    • PickNextEventTime(uid, component) happens before getting new event in path where entity has nextEventComponent
      Changelog

🆑 SolStar, chamomileteatime

  • add: New psionic ability: Precognition - See into the future to get a hint about the next random event.

@ewokswagger ewokswagger marked this pull request as ready for review November 8, 2024 07:24
@ewokswagger ewokswagger marked this pull request as draft November 8, 2024 07:25
@LadyDanger2743
Copy link

This is fascinating. I'm personally a huge fan of more psionic options.

@github-actions github-actions bot added the Changes: C# Changes any cs files label Nov 11, 2024
* Add NextEventComponent

* Check for schedulers NextEventComponent

* Seperate gernateing event to its own method

* Add NextEventSystem and use in BasicStationEventSchedulerSystem
@github-actions github-actions bot added the Changes: YML Changes any yml files label Nov 11, 2024
ewokswagger and others added 14 commits November 11, 2024 18:24
* Check for schedulers NextEventComponent

* Seperate gernateing event to its own method

* Add NextEventSystem and use in BasicStationEventSchedulerSystem

* Format code

* Add nextEvent time perdiction

* Use RunTime instead of float minutes

* Bug fixes

* Add NextEvent to Ramping and Meteors

* Fix timing on BasticStationEvents

* initialize NextEventComponent when created

---------

Signed-off-by: SolStar <[email protected]>
This reverts commit 656ca26, reversing
changes made to 36f45be.
@github-actions github-actions bot added Changes: Localization Changes any ftl files Changes: Documentation Changes any xml or md files Changes: Sprite Changes any png or json in an rsi labels Nov 12, 2024
@ewokswagger ewokswagger marked this pull request as ready for review November 20, 2024 02:21
@ewokswagger ewokswagger requested review from IamVelcroboy and a team as code owners November 20, 2024 02:21
@ewokswagger
Copy link
Contributor Author

I think you mixed up the urist swarm and immovable rod

You're right should be good now

@ewokswagger
Copy link
Contributor Author

@LadyDanger2743 Would you like to look over the design/balance for the ability? I'll list the stats I can think of here.
Cooldown: 4 minutes
Do After: 8.35 seconds (same length of sound fx)
Random chance: 20%
Random message: equal chance for any event message
Window of time for considered events: 30-600 seconds

@Bonktrauma
Copy link
Contributor

Any update on this?

@ewokswagger
Copy link
Contributor Author

Review hell but I plan on trying to move some of these changes upstream so I can implement this a bit more cleanly

Resources/Prototypes/DeltaV/GameRules/events.yml Outdated Show resolved Hide resolved
Resources/Prototypes/GameRules/roundstart.yml Outdated Show resolved Hide resolved
Resources/Prototypes/GameRules/roundstart.yml Outdated Show resolved Hide resolved
Resources/Prototypes/DeltaV/Actions/types.yml Outdated Show resolved Hide resolved
@ewokswagger ewokswagger requested a review from a team as a code owner December 11, 2024 09:33
@github-actions github-actions bot added the size/L 256-1023 lines label Dec 11, 2024
@ewokswagger
Copy link
Contributor Author

No clue what is causing that error

@ewokswagger
Copy link
Contributor Author

Oh i see its another file

@ewokswagger
Copy link
Contributor Author

@deltanedas can you also remove the Changes: Documentation tag? It was added accedently

@Lyndomen
Copy link
Contributor

taking in for direction review!

@ewokswagger
Copy link
Contributor Author

The levers that are easy to change are the cooldown, do after, effects, random chance, the weights for random messages including which one have random messages, event messages, excluding a category of events from being detected ie. random shuttles, excluding specific events mostly works but since it only has a limited memory it won't look far past that excluded event if that makes any sence.

Copy link
Contributor

@Lyndomen Lyndomen left a comment

Choose a reason for hiding this comment

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

Hi! Direction has wrapped up, I've tested this, and we've combed through all the info here. I am DELIGHTED to approve this. In my opinion, the atmosphere and mechanics of this ability far surpass all other psionic powers we have. Thank you to all the contributors who worked on this.

Copy link
Member

@deltanedas deltanedas left a comment

Choose a reason for hiding this comment

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

ill clean up nitpicks later

@deltanedas deltanedas enabled auto-merge (squash) December 19, 2024 03:29
@deltanedas deltanedas merged commit d5716a8 into DeltaV-Station:master Dec 19, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: C# Changes any cs files Changes: Documentation Changes any xml or md files Changes: Localization Changes any ftl files Changes: Sprite Changes any png or json in an rsi Changes: YML Changes any yml files S: Needs Review size/L 256-1023 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants