Baseball game dev diary: V1.0.0.202012171941 Addition of the game log (with video!)

I decided to call this version the first release as it's technically simulating complete games now.

This turned out to be a significant update in terms of the amount of work involved to get the game log to a reasonably informative state. Due to the sequence of updates to data and outputting of data, lots of debugging and rearranging of code was required for things to display correct without compromising the integrity of the code (in other words – no band aids allowed!). The whole game can now be traced through the game log, play by play. Functionality will be added later to be able to export as a text file. Each plate appearance is also documented temporarily in the plate appearance log (ie ball 1, ball 2, strike 1, strike 2, strike 3 etc). The result of the plate appearance is output to both the plate appearance log and the game log. The PA log will strictly be for batter stuff only – ie steals, wild pitches etc when they are implemented will go in the game log only. 

After clicking through some batters without the game log showing (checkbox switches it on and off) I decided that the play result text box on the main form should stay, even though it duplicates the game log. The way it is now is a very brief summary of the play (eg ball 1, strike 2, xxx walks, xxx strikes out. One out). Very simple and effective and informative when the game log form is not showing.

The player summary output was a last-minute addition, chucked in after I was satisfied the game log was done. I had wanted to do this for weeks but never got around to it. It only took about five minutes (well fifteen actually, because I got distracted and tidied up some other code).

  1. Added a second form for the game log (txtGameLog) that displays when Start button is clicked. Read-only property set to true so that it can be copied/pasted but not modified. 
  2. BuildPlayResultString procedure created to build the text that becomes the play summary. This keeps it separate from any result calculations and also gives the ability to stop creating the game log when simming if it becomes a time waster.
  3. Checkbox added to toggle visibility of game log. 
  4. Changed CheckEndOfInning procedure to a function that returns true or false and added a public Boolean variable called endOfInning. Various uses for this, at the very least output Start of inning x to the game log. 
  5. Modified code to output beginning of each half-inning to game log to include ‘away team’ and ‘home team’ instead of just Start of. Tidied up code that generates inningtext and rounded inning number (now has its own function).
  6. Added procedure to output end of game details to game log.
  7. Added a listboxes for game log and plate appearance log (they don’t do anything yet).
  8. Added to sim to top of last procedure a call to output data post-pitch, as it did not update until next batter was clicked. 
  9. Adds to game log only for a play (not balls/strikes). Pitch results are added to the plate appearance log, which is cleared after each batter. 
  10. Added ‘1 out, 2 out, 3 out, xxx scores etc’ to play outcome text in game log. Does not include batter as ‘xxx scores’ on a home run (code checks if base 4 is batter).
  11. playResult variable moved to public scope to avoid passing it many times between procedures.
  12. Discovered that reset button does not disable base buttons so added a call to toggle the bases to the ButtonsToggleStartGame procedure.
  13. Message box for player summary output (when base is clicked) replaced with text box. Added listboxes in preparation for when players have more attributes. Presently the player summary textbox shows the same info the message box did. It also automatically populates with batter info when next batter is clicked. 

Comments

Popular posts from this blog

MLB (Road to) The Show attribute progression

MLB The Show 21: create a stadium prediction & using created stadiums in online games

V1.1.4.202103032300 Basic player creator, line score tidy up and additional play results, including errors