Ballistica Logo

bascenev1lib package

Subpackages

Submodules

bascenev1lib.gameutils module

Various utilities useful for gameplay.

class bascenev1lib.gameutils.SharedObjects[source]

Bases: object

Various common components for use in games.

Category: Gameplay Classes

Objects contained here are created on-demand as accessed and shared by everything in the current activity. This includes things such as standard materials.

property attack_material: Material

A bascenev1.Material applied to explosion shapes, punch shapes, etc. An object not wanting to receive impulse/etc messages can disable collisions against this material.

property death_material: Material

A bascenev1.Material that sends a ba.DieMessage() to anything that touches it; handy for terrain below a cliff, etc.

property footing_material: Material

Anything that can be ‘walked on’ should have this bascenev1.Material applied; generally just terrain and whatnot. A character will snap upright whenever touching something with this material so it should not be applied to props, etc.

classmethod get() SharedObjects[source]

Fetch/create the instance of this class for the current activity.

property object_material: Material

A bascenev1.Material that should be applied to any small, normal, physical objects such as bombs, boxes, players, etc. Other materials often check for the presence of this material as a prerequisite for performing certain actions (such as disabling collisions between initially-overlapping objects)

property pickup_material: Material

A bascenev1.Material; collision shapes used for picking things up will have this material applied. To prevent an object from being picked up, you can add a material that disables collisions against things containing this material.

property player_material: Material

a bascenev1.Material to be applied to player parts. Generally, materials related to the process of scoring when reaching a goal, etc will look for the presence of this material on things that hit them.

property railing_material: Material

A bascenev1.Material with a very low friction/stiffness/etc that can be applied to invisible ‘railings’ useful for gently keeping characters from falling off of cliffs.

property region_material: Material

A bascenev1.Material used for non-physical collision shapes (regions); collisions can generally be allowed with this material even when initially overlapping since it is not physical.

bascenev1lib.mainmenu module

Session and Activity for displaying the main menu bg.

class bascenev1lib.mainmenu.MainMenuActivity(settings: dict)[source]

Bases: Activity[Player, Team]

Activity showing the rotating main menu bg stuff.

on_transition_in() None[source]

Called when the Activity is first becoming visible.

Upon this call, the Activity should fade in backgrounds, start playing music, etc. It does not yet have access to players or teams, however. They remain owned by the previous Activity up until bascenev1.Activity.on_begin() is called.

class bascenev1lib.mainmenu.MainMenuSession[source]

Bases: Session

Session that runs the main menu environment.

on_activity_end(activity: bs.Activity, results: Any) None[source]

Called when the current bascenev1.Activity has ended.

The bascenev1.Session should look at the results and start another bascenev1.Activity.

on_player_request(player: SessionPlayer) bool[source]

Called when a new bascenev1.Player wants to join the Session.

This should return True or False to accept/reject.

class bascenev1lib.mainmenu.NewsDisplay(activity: Activity)[source]

Bases: object

Wrangles news display.

bascenev1lib.maps module

Standard maps.

class bascenev1lib.maps.BigG[source]

Bases: Map

Large G shaped map for racing

defs = <module 'bascenev1lib.mapdata.big_g' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/big_g.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Big G'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.Bridgit[source]

Bases: Map

Map with a narrow bridge in the middle.

dataname = 'bridgit'
defs = <module 'bascenev1lib.mapdata.bridgit' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/bridgit.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Bridgit'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.Courtyard[source]

Bases: Map

A courtyard-ish looking map for co-op levels.

defs = <module 'bascenev1lib.mapdata.courtyard' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/courtyard.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

is_point_near_edge(point: Vec3, running: bool = False) bool[source]

Return whether the provided point is near an edge of the map.

Simple bot logic uses this call to determine if they are approaching a cliff or wall. If this returns True they will generally not walk/run any farther away from the origin. If ‘running’ is True, the buffer should be a bit larger.

name = 'Courtyard'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.CragCastle[source]

Bases: Map

A lovely castle map.

defs = <module 'bascenev1lib.mapdata.crag_castle' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/crag_castle.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Crag Castle'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.DoomShroom[source]

Bases: Map

A giant mushroom. Of doom!

defs = <module 'bascenev1lib.mapdata.doom_shroom' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/doom_shroom.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

is_point_near_edge(point: Vec3, running: bool = False) bool[source]

Return whether the provided point is near an edge of the map.

Simple bot logic uses this call to determine if they are approaching a cliff or wall. If this returns True they will generally not walk/run any farther away from the origin. If ‘running’ is True, the buffer should be a bit larger.

name = 'Doom Shroom'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.FootballStadium[source]

Bases: Map

Stadium map for football games.

defs = <module 'bascenev1lib.mapdata.football_stadium' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/football_stadium.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

is_point_near_edge(point: Vec3, running: bool = False) bool[source]

Return whether the provided point is near an edge of the map.

Simple bot logic uses this call to determine if they are approaching a cliff or wall. If this returns True they will generally not walk/run any farther away from the origin. If ‘running’ is True, the buffer should be a bit larger.

name = 'Football Stadium'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.HappyThoughts[source]

Bases: Map

Flying map.

defs = <module 'bascenev1lib.mapdata.happy_thoughts' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/happy_thoughts.py'>
classmethod get_music_type() MusicType[source]

Return a music-type string that should be played on this map.

If None is returned, default music will be used.

classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Happy Thoughts'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.HockeyStadium[source]

Bases: Map

Stadium map used for ice hockey games.

defs = <module 'bascenev1lib.mapdata.hockey_stadium' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/hockey_stadium.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Hockey Stadium'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.LakeFrigid[source]

Bases: Map

An icy lake fit for racing.

defs = <module 'bascenev1lib.mapdata.lake_frigid' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/lake_frigid.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Lake Frigid'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.MonkeyFace[source]

Bases: Map

Map sorta shaped like a monkey face; teehee!

defs = <module 'bascenev1lib.mapdata.monkey_face' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/monkey_face.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Monkey Face'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.Rampage[source]

Bases: Map

Wee little map with ramps on the sides.

defs = <module 'bascenev1lib.mapdata.rampage' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/rampage.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

is_point_near_edge(point: Vec3, running: bool = False) bool[source]

Return whether the provided point is near an edge of the map.

Simple bot logic uses this call to determine if they are approaching a cliff or wall. If this returns True they will generally not walk/run any farther away from the origin. If ‘running’ is True, the buffer should be a bit larger.

name = 'Rampage'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.Roundabout[source]

Bases: Map

CTF map featuring two platforms and a long way around between them

defs = <module 'bascenev1lib.mapdata.roundabout' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/roundabout.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Roundabout'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.StepRightUp[source]

Bases: Map

Wide stepped map good for CTF or Assault.

defs = <module 'bascenev1lib.mapdata.step_right_up' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/step_right_up.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Step Right Up'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.ThePad[source]

Bases: Map

A simple square shaped map with a raised edge.

defs = <module 'bascenev1lib.mapdata.the_pad' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/the_pad.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'The Pad'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.TipTop[source]

Bases: Map

A pointy map good for king-of-the-hill-ish games.

defs = <module 'bascenev1lib.mapdata.tip_top' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/tip_top.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Tip Top'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.TowerD[source]

Bases: Map

Map used for runaround mini-game.

defs = <module 'bascenev1lib.mapdata.tower_d' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/tower_d.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

is_point_near_edge(point: Vec3, running: bool = False) bool[source]

Return whether the provided point is near an edge of the map.

Simple bot logic uses this call to determine if they are approaching a cliff or wall. If this returns True they will generally not walk/run any farther away from the origin. If ‘running’ is True, the buffer should be a bit larger.

name = 'Tower D'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

class bascenev1lib.maps.ZigZag[source]

Bases: Map

A very long zig-zaggy map

defs = <module 'bascenev1lib.mapdata.zig_zag' from '/home/runner/work/ballistica/ballistica/src/assets/ba_data/python/bascenev1lib/mapdata/zig_zag.py'>
classmethod get_play_types() list[str][source]

Return valid play types for this map.

classmethod get_preview_texture_name() str[source]

Return the name of the preview texture for this map.

name = 'Zigzag'
classmethod on_preload() Any[source]

Called when the map is being preloaded.

It should return any media/data it requires to operate

bascenev1lib.tutorial module

Wrangles the game tutorial sequence.

class bascenev1lib.tutorial.ButtonPress(button: str, delay: int = 0, release: bool = True, release_delay: int = 0)[source]

Bases: object

run(a: TutorialActivity) None[source]
class bascenev1lib.tutorial.ButtonRelease(button: str, delay: int = 0)[source]

Bases: object

run(a: TutorialActivity) None[source]
class bascenev1lib.tutorial.Player[source]

Bases: Player[Team]

Our player type for this game.

class bascenev1lib.tutorial.Team[source]

Bases: Team[Player]

Our team type for this game.

class bascenev1lib.tutorial.TutorialActivity(settings: dict | None = None)[source]

Bases: Activity[Player, Team]

on_begin() None[source]

Called once the previous Activity has finished transitioning out.

At this point the activity’s initial players and teams are filled in and it should begin its actual game logic.

on_player_join(player: Player) None[source]

Called when a new bascenev1.Player has joined the Activity.

(including the initial set of Players)

on_player_leave(player: Player) None[source]

Called when a bascenev1.Player is leaving the Activity.

on_transition_in() None[source]

Called when the Activity is first becoming visible.

Upon this call, the Activity should fade in backgrounds, start playing music, etc. It does not yet have access to players or teams, however. They remain owned by the previous Activity up until bascenev1.Activity.on_begin() is called.

set_stick_image_position(x: float, y: float) None[source]

Module contents

Library of stuff using the bascenev1 api: games, actors, etc.