Recent

Author Topic: When to use ChatGpt...  (Read 305 times)

TBMan

  • Sr. Member
  • ****
  • Posts: 285
When to use ChatGpt...
« on: October 16, 2025, 09:44:35 pm »
Choose your battles wisely, lol. I'm working on a football game similar to the old NFL Challenge.  It's a coach sim, not something like the Madden game. I wanted to do play color commentary, but I didn't feel like typing a gazillion array entries so I made a few samples of what I wanted, gave chatGpt the data structures and BOOM. Got it in under 30 seconds. Amazing stuff.

Here's my "Verbosity" unit for the game right now:

Code: Pascal  [Select][+][-]
  1. unit Verbosity;
  2.  
  3. interface
  4. const
  5.   Maxverbosity = 10;
  6.  
  7. Type
  8.     VPlayResultType = (VNone,Vrun,VpassComplete,VpassIncomplete,Vfumble,VfieldGoal,
  9.                       VFieldGoalMissed,Vsacked,VKick,VInterception,vPickSix,vTouchdown,VLast);
  10.  
  11. var
  12.  
  13.   Vplay:VPlayResultType;
  14.  
  15.   Commentary:array[vnone..vlast,0..MaxVerbosity-1] of string;
  16.  
  17. procedure buildVerbosity;
  18. Function getcommentary(Comment:VPlayResultType):string;
  19.  
  20. implementation
  21.  
  22. procedure buildVerbosity;
  23. var
  24.   j:integer;
  25.   c:VPlayResultType;
  26. begin
  27. fillchar(commentary,sizeof(commentary),0);
  28. // --- Run plays ---
  29. Commentary[vRun,0] := 'He powers ahead for a few yards.';
  30. Commentary[vRun,1] := 'A strong run up the middle.';
  31. Commentary[vRun,2] := 'He finds a crease and pushes forward.';
  32. Commentary[vRun,3] := 'Bounces to the outside and gains ground.';
  33. Commentary[vRun,4] := 'The defense closes in quickly, short gain.';
  34. Commentary[vRun,5] := 'He bursts through the line for good yardage!';
  35. Commentary[vRun,6] := 'Cuts back inside and breaks a tackle.';
  36. Commentary[vRun,7] := 'Met in the backfield for a loss.';
  37. Commentary[vRun,8] := 'Dragged down after a tough run.';
  38. Commentary[vRun,9] := 'Weaves through defenders for extra yards.';
  39.  
  40. // --- Pass completed ---
  41. Commentary[vPassComplete,0] := 'Caught near the sideline for a solid gain.';
  42. Commentary[vPassComplete,1] := 'He threads it in for the completion!';
  43. Commentary[vPassComplete,2] := 'Quick slant — caught and tackled immediately.';
  44. Commentary[vPassComplete,3] := 'He hits his man in stride!';
  45. Commentary[vPassComplete,4] := 'Nice grab over the middle.';
  46. Commentary[vPassComplete,5] := 'Perfect throw and catch for a first down!';
  47. Commentary[vPassComplete,6] := 'The receiver makes a great adjustment.';
  48. Commentary[vPassComplete,7] := 'He hauls it in despite tight coverage.';
  49. Commentary[vPassComplete,8] := 'Short pass turns into a decent gain.';
  50. Commentary[vPassComplete,9] := 'Beautiful timing on that route.';
  51.  
  52. // --- Pass incomplete ---
  53. Commentary[vPassIncomplete,0] := 'Overthrown and incomplete.';
  54. Commentary[vPassIncomplete,1] := 'He had a man open but missed him.';
  55. Commentary[vPassIncomplete,2] := 'The pass falls harmlessly to the turf.';
  56. Commentary[vPassIncomplete,3] := 'Defender gets a hand on it — incomplete.';
  57. Commentary[vPassIncomplete,4] := 'Receiver couldn’t hang on.';
  58. Commentary[vPassIncomplete,5] := 'Thrown out of bounds to avoid the sack.';
  59. Commentary[vPassIncomplete,6] := 'Tight coverage, incomplete.';
  60. Commentary[vPassIncomplete,7] := 'He threw it too low to handle.';
  61. Commentary[vPassIncomplete,8] := 'Just off the fingertips — incomplete.';
  62. Commentary[vPassIncomplete,9] := 'No connection on that play.';
  63.  
  64. // --- Fumble ---
  65. Commentary[vFumble,0] := 'The ball is out!';
  66. Commentary[vFumble,1] := 'He loses the handle — it’s a fumble!';
  67. Commentary[vFumble,2] := 'The defense pounces on the loose ball!';
  68. Commentary[vFumble,3] := 'Stripped from behind, the ball’s loose!';
  69. Commentary[vFumble,4] := 'Big hit — and the ball comes free!';
  70. Commentary[vFumble,5] := 'He coughs it up under pressure!';
  71. Commentary[vFumble,6] := 'That one just slipped away!';
  72. Commentary[vFumble,7] := 'He fumbles it on contact!';
  73. Commentary[vFumble,8] := 'Scramble for the ball!';
  74. Commentary[vFumble,9] := 'Turnover on the ground!';
  75.  
  76. // --- Field Goal made ---
  77. Commentary[vFieldGoal,0] := 'The kick is up — and it’s good!';
  78. Commentary[vFieldGoal,1] := 'Splits the uprights with ease.';
  79. Commentary[vFieldGoal,2] := 'Drilled right down the middle!';
  80. Commentary[vFieldGoal,3] := 'Plenty of leg — it’s good!';
  81. Commentary[vFieldGoal,4] := 'He nails it from long range!';
  82. Commentary[vFieldGoal,5] := 'That one sneaks just inside the post.';
  83. Commentary[vFieldGoal,6] := 'Clean contact — good from distance.';
  84. Commentary[vFieldGoal,7] := 'Right through the uprights!';
  85. Commentary[vFieldGoal,8] := 'A clutch kick — it’s good!';
  86. Commentary[vFieldGoal,9] := 'Three points on the board.';
  87.  
  88. // --- Field Goal missed ---
  89. Commentary[vFieldGoalMissed,0] := 'The kick was short!';
  90. Commentary[vFieldGoalMissed,1] := 'The kick was wide right!';
  91. Commentary[vFieldGoalMissed,2] := 'The kick was wide left!';
  92. Commentary[vFieldGoalMissed,3] := 'The kick hit the crossbar!';
  93. Commentary[vFieldGoalMissed,4] := 'He hooked it badly — no good.';
  94. Commentary[vFieldGoalMissed,5] := 'It drifts wide — missed!';
  95. Commentary[vFieldGoalMissed,6] := 'Off the upright — no good!';
  96. Commentary[vFieldGoalMissed,7] := 'He pushed it right.';
  97. Commentary[vFieldGoalMissed,8] := 'Didn’t have the distance.';
  98. Commentary[vFieldGoalMissed,9] := 'No good from that range.';
  99.  
  100. // --- Sacked ---
  101. Commentary[vSacked,0] := 'He’s brought down for a sack!';
  102. Commentary[vSacked,1] := 'The pocket collapses — down he goes.';
  103. Commentary[vSacked,2] := 'Blitz gets there — sack!';
  104. Commentary[vSacked,3] := 'Nowhere to go, he’s taken down.';
  105. Commentary[vSacked,4] := 'He’s dragged down behind the line.';
  106. Commentary[vSacked,5] := 'Swarmed by the defense for a loss.';
  107. Commentary[vSacked,6] := 'He’s sacked before he can throw.';
  108. Commentary[vSacked,7] := 'Pressure off the edge — sack!';
  109. Commentary[vSacked,8] := 'He’s hit hard and dropped!';
  110. Commentary[vSacked,9] := 'Big defensive play — sack!';
  111.  
  112. // --- Kickoff ---
  113. Commentary[vKick,0] := 'A deep kick to start the drive.';
  114. Commentary[vKick,1] := 'He boots it far upfield.';
  115. Commentary[vKick,2] := 'Fielded and returned.';
  116. Commentary[vKick,3] := 'High kick!';
  117. Commentary[vKick,4] := 'Short kick!';
  118. Commentary[vKick,5] := 'A booming kick!';
  119. Commentary[vKick,6] := 'Returner takes it up the sideline.';
  120. Commentary[vKick,7] := 'Kick lands and takes a bounce.';
  121. Commentary[vKick,8] := 'Decent return after the kick.';
  122. Commentary[vKick,9] := 'Kick coverage team gets downfield quickly.';
  123.  
  124. // --- Interception ---
  125. Commentary[vInterception,0] := 'Intercepted!';
  126. Commentary[vInterception,1] := 'He jumps the route and picks it off!';
  127. Commentary[vInterception,2] := 'The pass is intercepted by the defense!';
  128. Commentary[vInterception,3] := 'He threw it right to the defender!';
  129. Commentary[vInterception,4] := 'Picked off deep downfield!';
  130. Commentary[vInterception,5] := 'Deflected and intercepted!';
  131. Commentary[vInterception,6] := 'Bad decision — it’s intercepted!';
  132. Commentary[vInterception,7] := 'Defense snags the turnover!';
  133. Commentary[vInterception,8] := 'He undercut the route perfectly.';
  134. Commentary[vInterception,9] := 'Picked and taken back the other way!';
  135.  
  136. // --- Pick Six (interception returned for a touchdown) ---
  137. Commentary[vPickSix,0] := 'Intercepted — and he’s taking it all the way back!';
  138. Commentary[vPickSix,1] := 'Picked off! He’s got open field ahead — touchdown!';
  139. Commentary[vPickSix,2] := 'He jumps the route and takes it to the house!';
  140. Commentary[vPickSix,3] := 'Interception! He breaks a tackle — he’s gone!';
  141. Commentary[vPickSix,4] := 'What a play! The defense scores on the interception!';
  142. Commentary[vPickSix,5] := 'He reads the quarterback perfectly and scores!';
  143. Commentary[vPickSix,6] := 'That’s a defensive touchdown — pick six!';
  144. Commentary[vPickSix,7] := 'He cuts across the field — end zone! Pick six!';
  145. Commentary[vPickSix,8] := 'The crowd erupts as he returns it for six!';
  146. Commentary[vPickSix,9] := 'Touchdown defense! Unbelievable return on the interception!';
  147.  
  148.   // --- Touchdown ---
  149. Commentary[vTouchdown,0] := 'Touchdown! He crosses the goal line!';
  150. Commentary[vTouchdown,1] := 'He’s in for the score!';
  151. Commentary[vTouchdown,2] := 'Touchdown! What a play!';
  152. Commentary[vTouchdown,3] := 'He breaks free and dives into the end zone!';
  153. Commentary[vTouchdown,4] := 'Touchdown pass — perfect connection!';
  154. Commentary[vTouchdown,5] := 'He shakes off the defender and scores!';
  155. Commentary[vTouchdown,6] := 'He finds the end zone untouched!';
  156. Commentary[vTouchdown,7] := 'The crowd goes wild — touchdown!';
  157. Commentary[vTouchdown,8] := 'He stretches for the pylon — touchdown!';
  158. Commentary[vTouchdown,9] := 'Touchdown! Six points on the board!';
  159.  
  160.  
  161. end;
  162.  
  163.  Function getcommentary(Comment:VPlayResultType):string;
  164.  var
  165.    j:integer;
  166.  
  167.  begin
  168.    j := random(MaxVerbosity);
  169.  result := commentary[Comment,j];
  170.  
  171.  end;
  172.  
  173. end.
  174.  

If I feel a need to expand the range of events, I can just either add it myself or get it generated. Saves so much time.
« Last Edit: October 16, 2025, 11:19:09 pm by TBMan »
I love programming.

Some things I've done using PTCgraph:

NFL Retro Football (almost finished):
https://www.youtube.com/watch?v=78mTtsd7ppk


Solitaire games:
https://www.youtube.com/watch?v=zmtxI7FdWuQ&list=PLa4BPpFl34iVhFwX1JZwVm3vE5ay_i3R2

 

TinyPortal © 2005-2018