Skip to main content

A python module for reading/creating/writing .brs files for Brickadia.

Project description

A .brs reader/writer for brickadia

Brickadia is a multiplayer brick building game

Made for version 14 saves (Brickadia Early Access)

Example Usage:

Display info about a save:

import brs
save = brs.readBRS("foobar.brs")
print(save)

Make a save from scratch, with bricks showing the default colorset

import brs

save = brs.BRS.default(brs.User("Speedy Boi", "54937200-3f6e-4d8e-8e65-0e7c0bfcc117"))

#create asset
default_asset = brs.Asset("PB_DefaultBrick", 0)
save.brick_assets.append(default_asset)

for i, col in enumerate(save.colors):
    brick = brs.Brick()
    brick.brick_index = i
    brick.asset = default_asset
    brick.size = brs.Size(5, 5 ,6)  #size of a 1x1 brick
    brick.position = brs.Position((i%12) * 10, (i//12) * 10, 0)
    brick.orientation = brs.Orientation(brs.Direction.Z_POSITIVE, brs.Rotation.DEG_0)
    brick.collision = brs.Collision()   # all True by default
    brick.visibility = True
    brick.material = save.materials[3]  # 4th material is BMC_Plastic
    brick.physical_material = save.physical_materials[0]    # BPMC_Default
    brick.material_intensity = 5        # doesnt matter for plastic
    brick.color = col
    brick.owner = save.brick_owners[0]
    
    # dont forget to increment brick count
    brick.owner.brick_count += 1
    # add the brick to the save
    save.bricks.append(brick)

save.to_file("all_colors.brs")

Make a new component from scratch and add it to a brick:

import brs
...
brick = save.bricks[0]  # take some brick to add a "Component_Target" component to

# create a new Component_Target component with one Property "OnTime" of type Float
new_component = brs.Component()
new_component.index = len(save.components)
new_component.name = "Component_Target"
new_component.version = 1
on_time = brs.Property("OnTime", brs.PropertyType.FLOAT)
new_component.properties = [on_time]

# add component to save
save.components.append(new_component)

# make a component instance and set values
component_instance = brs.ComponentInstance(new_component)
component_instance.property_values = {on_time: 1.234}

# attach the component instance to the brick
brick.components[new_component] = component_instance

# add the brick to the component
new_component.bricks.append(brick)
...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brs-1.0.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brs-1.0.0-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file brs-1.0.0.tar.gz.

File metadata

  • Download URL: brs-1.0.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for brs-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f6d8d67a78771168087a2465ec05fe920e53583f0be109b43044508759f66e63
MD5 8512dcdbb521f323c259bc4ad6f325a6
BLAKE2b-256 0f0460f3f3ac1d82be6546d9f299dfabceb5bc822dc82848a9640cb51dc034a3

See more details on using hashes here.

File details

Details for the file brs-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: brs-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for brs-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32aa08406c97d61ccc4643f3d88f89abdf6460504ca25dcb9abc6f771e3229dc
MD5 53ee3b69cd7ed76595bf73155b8875d2
BLAKE2b-256 b7d57e4319e495649b32789c840084a2689e938548effc16422798b4405649d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page