Skip to content

Implement Display scoring support #8

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

Merged
merged 9 commits into from
Sep 15, 2022
Merged

Implement Display scoring support #8

merged 9 commits into from
Sep 15, 2022

Conversation

jsm174
Copy link
Contributor

@jsm174 jsm174 commented Aug 26, 2022

This PR is to support freezy/VisualPinball.Engine#421 and freezy/VisualPinball.Engine#435.

It adds the following units:

  • ClearDisplayUnit
  • AddPointsDisplayUnit
  • DisplayScoreEventUnit

ClearDisplayUnit

Screen_Shot_2022-08-26_at_5 30 52_PM

This unit can be used to clear a display. For a ScoreReelDisplayComponent, if it is connected to a ScoreMotorComponent, the reels will be advanced in a sequence.

For example, if the score is 4805, the score advance sequence will be: 5906, 6007, 7008, 8009, 9000, 0.

AddPointsDisplayUnit

Screen_Shot_2022-08-26_at_5 31 51_PM

This unit accepts an incoming points amount, and if the display is connected to a ScoreMotorComponent increases the score appropriately. For example, if the points are 500, and the Score Motor is not running, the score reels will be advanced 5 times, (100 points per advance).

DisplayScoreEventUnit

This unit receives updated score events from the connected display. The score can then be saved into a Player variable, or used to drive an additional display.

Screen_Shot_2022-08-26_at_5 33 31_PM

Since only ScoreReelDisplayComponent can keep track of scores, we needed to add a Display Type to Visual Scripting Displays:

Screen_Shot_2022-08-26_at_5 35 11_PM

@jsm174 jsm174 requested a review from freezy August 26, 2022 22:22
@jsm174
Copy link
Contributor Author

jsm174 commented Aug 28, 2022

After discussions on Discord, @freezy suggested using the existing Update Display unit instead of an additional Add Points unit.

I've refactored the code accordingly, and it really makes everything a lot cleaner.

We are now only adding two nodes, Display Update Event and Clear Display.

Display Update Event triggers when the display has been updated. If the display is a Score Reel, it will have a Numeric output which is the Score Reel's internal score. This internal score can then be used to set the player's score variable.

Note, the internal score may be greater than the amount of reels.

Here is an example of updating reels, capturing the score, and then sending that score to a segment display:

Screen Shot 2022-08-28 at 1 51 54 PM

The Display Type setting that was added to Visual Scripting Displays has been removed too.

@jsm174
Copy link
Contributor Author

jsm174 commented Aug 28, 2022

@freezy when you have free time, can we get a Display Update Event icon with the lightning bolt?

Copy link
Member

@freezy freezy left a comment

Choose a reason for hiding this comment

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

Looking good!

I guess now we need an "interruptor" node so we can turn off some lights in Volley when the motor is running?

@jsm174
Copy link
Contributor Author

jsm174 commented Sep 3, 2022

I think we can look at the motor running switch to accomplish that.

1 similar comment
@jsm174
Copy link
Contributor Author

jsm174 commented Sep 3, 2022

I think we can look at the motor running switch to accomplish that.

@freezy
Copy link
Member

freezy commented Sep 3, 2022

Yes, the interruptor would take in the motor switch and the light status and its output is then wired to the light.

@jsm174
Copy link
Contributor Author

jsm174 commented Sep 3, 2022

Interesting. I was thinking of just taking the lighting graph and toggling the specific light variables volley uses.

That would be a useful unit.

@freezy freezy merged commit 8e546ca into master Sep 15, 2022
@freezy freezy deleted the feature/score-motor branch September 15, 2022 06:49
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.

2 participants