Game state¶
PySTK also exposes the internal state of the game.
- class pystk.WorldState¶
- static set_ball_location(position: float3, velocity: float3 = [0.0, 0.0, 0.0], angular_velocity: float3 = [0.0, 0.0, 0.0]) None ¶
Specify the soccer ball / hockey puck position (SOCCER mode only).
- static set_kart_location(kart_id: int, position: float3, rotation: Quaternion = [0.0, 0.0, 0.0, 1.0], speed: float = 0) None ¶
Move a kart to a specific location.
- update(self: pystk.WorldState) None ¶
Update this object with the current world state
- property ffa pystk.FFA ¶
Free for all match info
- property items List[pystk.Item] ¶
State of items
- property karts List[pystk.Kart] ¶
State of karts
- property players List[pystk.Player] ¶
State of active players
- property soccer pystk.Soccer ¶
Soccer match info
- property time float ¶
Game time
- class pystk.Track¶
- update(self: pystk.Track) None ¶
- property length float ¶
length of the track
- property path_distance numpy.ndarray[numpy.float32] ¶
Distance down the track of each line segment (float N x 2)
- property path_nodes numpy.ndarray[numpy.float32] ¶
Center line of the drivable area as line segments of 3d coordinates (float N x 2 x 3)
- property path_width numpy.ndarray[numpy.float32] ¶
Width of the path segment (float N)
- class pystk.Player¶
- property camera pystk.Camera ¶
Camera parameters of the player
- property kart pystk.Kart ¶
Kart of the player
- class pystk.Camera¶
- class Mode¶
- CLOSEUP = 1¶
- FALLING = 4¶
- LEADER_MODE = 3¶
- NORMAL = 0¶
- REVERSE = 2¶
- property name str ¶
- property value int ¶
- property aspect float ¶
Aspect ratio
- property fov float ¶
Field of view
- property mode pystk.Camera.Mode ¶
Camera mode
- property projection readonly_memoryview ¶
Projection matrix (float 4x4)
- property view readonly_memoryview ¶
View matrix (float 4x4)
- class pystk.Item¶
- class Type¶
- BANANA = 1¶
- BONUS_BOX = 0¶
- BUBBLEGUM = 4¶
- EASTER_EGG = 6¶
- NITRO_BIG = 2¶
- NITRO_SMALL = 3¶
- property name str ¶
- property value int ¶
- property id int ¶
Item id compatible with instance data
- property location float3 ¶
3D world location of the item
- property size float ¶
Size of the object
- property type pystk.Item.Type ¶
Item type
- class pystk.Kart¶
- property attachment pystk.Attachment ¶
Attachment of kart
- property distance_down_track float ¶
Distance traveled on current lap
- property finish_time float ¶
Time to complete race
- property finished_laps int ¶
Number of laps completed
- property front float3 ¶
Front direction of kart 1/2 kart length forward from location
- property id int ¶
Kart id compatible with instance labels
- property jumping bool ¶
Is the kart jumping?
- property lap_time float ¶
Time to completion for last lap
- property lives int ¶
Lives in three strikes battle
- property location float3 ¶
3D world location of the kart
- property max_steer_angle float ¶
Maximum steering angle
- property name str ¶
Player name
- property overall_distance float ¶
Overall distance traveled
- property player_id int ¶
Player id
- property powerup pystk.Powerup ¶
Powerup collected
- property race_result bool ¶
Did the kart finish the race?
- property rotation Quaternion ¶
Quaternion rotation of the kart
- property shield_time float ¶
Second the shield is up for
- property size float3 ¶
Width, height and length of kart
- property velocity float3 ¶
Velocity of kart
- property wheel_base float ¶
Wheel base
- class pystk.Powerup¶
- class Type¶
- ANVIL = 10¶
- BOWLING = 3¶
- BUBBLEGUM = 1¶
- CAKE = 2¶
- NOTHING = 0¶
- PARACHUTE = 9¶
- PLUNGER = 5¶
- RUBBERBALL = 8¶
- SWATTER = 7¶
- SWITCH = 6¶
- ZIPPER = 4¶
- property name str ¶
- property value int ¶
- property num int ¶
Number of powerups
- property type pystk.Powerup.Type ¶
Powerup type
- class pystk.Attachment¶
- class Type¶
- ANVIL = 1¶
- BOMB = 2¶
- BUBBLEGUM_SHIELD = 6¶
- NOTHING = 9¶
- PARACHUTE = 0¶
- SWATTER = 3¶
- property name str ¶
- property value int ¶
- property time_left float ¶
Seconds until attachment detaches/explodes
- property type pystk.Attachment.Type ¶
Attachment type
- class pystk.Soccer¶
- property ball pystk.SoccerBall ¶
Soccer ball information
- property goal_line List[List[float3[2]][2]] ¶
Start and end of the goal line for each team
- property score int[2] ¶
Score of the soccer match