Author Topic: Advanced Modes vs Standard PyProcGames modes, and Player stats  (Read 955 times)

uncivil engineer

  • Wizard
  • *****
  • Posts: 118
  • Alan
    • View Profile
I wonder if you could give a break down in the difference between the advanced modes used in PyProcGamesHD and the standard modes?

From what I can tell, advanced modes have to be initialized in the modes folder in the __init__ file.  When the game starts, all the advanced modes are loaded. 

In particular, I am having an issue with my skill shot mode.  I want to start it at the beginning of every ball, and I tried putting it in the base game mode ball start event.  I got an error that the mode was already in the que when I tried this.  However, when I let the PyProcGamesHD controller add it during the beginning of the game, I can't re-add it in at the beginning of the next ball.  How should I go about implementing my skill shot?

On the issue of player stats:  Is there a place where you intended that the state be defined?  Or do you just add them to the add player event as needed?

Less than 3 hours of coding, and I am already deep enough in that I can run a complete game...


  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Advanced Modes vs Standard PyProcGames modes, and Player stats
« Reply #1 on: June 18, 2015, 07:09:41 AM »
Excellent to hear that you're moving through this so quickly. Thank you for your questions and feedback, too. They'll help to improve the documentation some day :)

AdvancedMode "types".

An AdvancedMode is automatically added and removed from the mode queue depending on its type. It's type can be one of the following:

ball: added on evt_ball_starting, removed on evt_ball_ending

game: added on evt_game_starting, removed on ending.

system: added on reset. Removed and re-added on reset.

custom: not auto-added or auto-removed. You have to add and remove the mode yourself.

You set the type in the call to super in the mode definition.  Here's an example of a SkillshotMode that's a Ball type (added on ball start, removed at ball end, re-added on next ball start)

Code: [Select]
class SkillshotMode(AdvancedMode):
This is the skillshot- it lights the sequence of lights and
registers hits on the targets on the left hand side.
def __init__(self, game):
super(SkillShotMode, self).__init__(game=game, priority=10, mode_type=AdvancedMode.Ball)
# etc.

Notice the mode_type in the super class call to init.

As for player stats, add them wherever you like or deep appropriate but of course you are right: this is why evt_player_added exists --to set default player stats for a given mode at the time of a player's creation.

Hope this helps!

- Michael
« Last Edit: June 18, 2015, 07:12:08 AM by MOcean »