Skip to content

Add new EMAddPointsUnit and EMResetPointsUnit units #5

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

Closed
wants to merge 6 commits into from

Conversation

jsm174
Copy link
Contributor

@jsm174 jsm174 commented Jun 23, 2022

This PR adds two new units EMAddPointsUnit and EMResetPointsUnit that was designed with the assistance of @Scottacus64.

EMAddPointsUnit

Screen Shot 2022-07-01 at 7 52 44 AM

This unit accepts Point Value, Positions, Duration (in ms), and Block Points values.

Point Value is used to calculate the amount of points to add for each pulse of the unit.

Examples:

Score 50 points while the score motor is not running:

  • Start the score motor
  • Wait for the delay and trigger a pulse with 10 points
  • Wait for the delay and trigger a pulse with 10 points
  • Wait for the delay and trigger a pulse with 10 points
  • Wait for the delay and trigger a pulse with 10 points
  • Wait for the delay and trigger a pulse with 10 points
  • Wait for the delay and trigger a pulse with 0 points
  • Stop the score motor

Score 50 points while the score motor is running:

  • Do nothing

Score 100 points while the score motor is not running:

  • Trigger a pulse with 100 points

Score 100 points while the score motor is running and Block Points disabled:

  • Trigger a pulse with 100 points

Score 100 points while the score motor is running and Block Points enabled:

  • Do nothing

The Duration and Positions are used to calculate delays.

score_motor

The examples were based on a Gottlieb score motor with 6 positions.

EMResetPointsUnit

Screen Shot 2022-07-01 at 7 52 59 AM

This unit accepts Point Value, Positions, and Duration (in ms) values. It can be used to simulate the values of a resetting score reel.

Point Value is used as a starting point. For each pulse, all digits are incremented until they reach 0.

Example:

Score reel shows 2041 points:

  • Start the score motor
  • Wait for the delay and trigger a pulse with 3052 points
  • Wait for the delay and trigger a pulse with 4063 points
  • Wait for the delay and trigger a pulse with 5074 points
  • Wait for the delay and trigger a pulse with 6085 points
  • Wait for the delay and trigger a pulse with 7096 points
  • Wait for the delay and trigger a pulse with 8007 points
  • Wait for the delay and trigger a pulse with 9008 points
  • Wait for the delay and trigger a pulse with 9 points
  • Wait for the delay and trigger a pulse with 0 points
  • Wait for the delay and trigger a pulse with 0 points
  • Wait for the delay and trigger a pulse with 0 points
  • Wait for the delay and trigger a pulse with 0 points
  • Stop the score motor

This example is based on a Gottlieb score motor with 6 positions.

@jsm174 jsm174 changed the title Add new EMAddPointsUnit and enhance SwitchLampUnit Add new EMAddPointsUnit and EMResetPointsUnit units Jun 29, 2022
@jsm174 jsm174 requested a review from freezy June 30, 2022 12:11
@freezy
Copy link
Member

freezy commented Jun 30, 2022

Awesome PR and brilliant description. ❤️

I'm still not 100% convinced that the pulse logic should sit in UVS. Can you point me to the implementation you did where it sits at the score reel component? I'd like to understand the messiness you've mentioned and weight it against the additional complexity this brings to the author.

@jsm174
Copy link
Contributor Author

jsm174 commented Jun 30, 2022

Thank you. Couldn't have figured this all out with @Scottacus64.

I feel that the EMAddPoints and EMResetPoints units are so closely related that I wanted their look and code to be similar. I wish I could avoid passing in the current points for EMResetPoints, but since only the score reel display component knows its frame data, I'm not sure how to capture this cleanly and again keep the units look and code similar.

As for the proof of concept you mentioned, it is at:

freezy/VisualPinball.Engine@6db0559 and f580566

I wasn't sure how to get the ClearDisplay state updates back to scripting. So I used EventHandlers. Since the Unit's Process method can execute the triggers, I used queues and waits. So I just feel like this code isn't good, and forces all score reels to use a score motor concept.

FWIW, the score reels work fine as they are (minus the sometimes out of sync issue we need to look at). These new nodes are just to help provide the illusion of EM authenticity.

@Scottacus64
Copy link

Great write up! A score of 100 would not go through the score motor but would be a direct actuation of the 100 reel coil by the 100 point coil via some playfield switch. A score of 500 would go through the score motor though.

The EM Add Points "started" and "stopped" are great additions because these can be used by authors to block other scoring while the score motor is running.

How are we going to handle scores other than a multiple of five? These are usually x,x,x,pause,pause but can be x,pause,x,pause,x as well (at least according to one of my sources).

In the EM Reset Points node we need to add a pause between the first five and second five pulses since the score motor has six positions. Also the node would need to know to exit if all scores are at zero after the first five pulses. Lastly this is modeled after a Gottlieb/early Bally score motor. Some later Bally and William score motors used more than six positions to a single run but for our purposes this would add a lot of unnecessary complexity since all of them use five consecutive pulses to score a multiple of five times a given score and from what I've seen, cluster the scoring of 2x and 3x in the cluster of five.

@jsm174
Copy link
Contributor Author

jsm174 commented Jun 30, 2022

A score of 100 would not go through the score motor but would be a direct actuation of the 100 reel coil by the 100 point coil via some playfield switch. A score of 500 would go through the score motor though.

Okay, we should fix EMAddPoints then because all points for an EM are going to be funneled through this.

How are we going to handle scores other than a multiple of five? These are usually x,x,x,pause,pause but can be x,pause,x,pause,x as well (at least according to one of my sources).

We should try to get this built in as well. We can discuss via Discord.

In the EM Reset Points node we need to add a pause between the first five and second five pulses since the score motor has six positions.

I will go through and double check the timing.

Also the node would need to know to exit if all scores are at zero after the first five pulses.

Currently the unit handles that. If the output point value is greater than 0 at the end of the 6 pulses, it will perform another 6 pulses.

Lastly this is modeled after a Gottlieb/early Bally score motor. Some later Bally and William score motors used more than six positions to a single run but for our purposes this would add a lot of unnecessary complexity since all of them use five consecutive pulses to score a multiple of five times a given score and from what I've seen, cluster the scoring of 2x and 3x in the cluster of five.

We could always add another input to the node that is the count of positions, instead of hardcoding 6 into the units.

@Scottacus64
Copy link

Scottacus64 commented Jun 30, 2022

Okay, we should fix EMAddPoints then because all points for an EM are going to be funneled through this.

An alternative would be to have "EM add points" just be something like "EM Score Motor" and only use it when the score motor is invoked. We could use the native player score increase to handle single point values and if needed add an "If" blocker node should scoring need to be blocked by the score motor running.

@jsm174
Copy link
Contributor Author

jsm174 commented Jun 30, 2022

Closing this PR for now as we should not being doing mech logic in Visual Scripting.

@jsm174 jsm174 closed this Jun 30, 2022
@jsm174
Copy link
Contributor Author

jsm174 commented Jul 1, 2022

Even though closed, I did take one more stab at getting this closer to the above comments.

Please re-review the initial comment.

(Edit: Had to reopen/close for latest commits to show)

@jsm174 jsm174 reopened this Jul 1, 2022
@jsm174 jsm174 closed this Jul 1, 2022
@jsm174
Copy link
Contributor Author

jsm174 commented Jul 7, 2022

Removed switch lamp updates since that was merged in #6

@jsm174 jsm174 reopened this Jul 7, 2022
@jsm174 jsm174 force-pushed the feature/em-units branch from acd7bdc to bcfb0a3 Compare July 7, 2022 15:47
@jsm174
Copy link
Contributor Author

jsm174 commented Aug 28, 2022

Closing this PR again as it is now superseded by #8

@jsm174 jsm174 closed this Aug 28, 2022
@jsm174 jsm174 deleted the feature/em-units branch August 28, 2022 18:33
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.

3 participants