-
Notifications
You must be signed in to change notification settings - Fork 178
N edited this page Mar 13, 2026
·
2 revisions
Balatro has a global variable G which is the singleton instance of the Game class. This list is not comprehensive.
-
G.E_MANAGERis the event manager. -
G.P_CENTERSholds the game's center objects (prototypes for jokers, consumables, vouchers, decks, enhancements, editions, and boosters). It is indexed with the object's key. For example,G.P_CENTERS.c_strengthis the center for Strength. -
G:update(dt)is called once per frame. This usesG.STATEandG.STATE_COMPLETEto run a state machine. -
G.Cholds colors. G.GAME
-
G.E_MANAGERis the event manager. -
G.P_SEALSholds the seal prototypes, much likeG.P_CENTERS. -
G.P_TAGSholds the tag prototypes, much likeG.P_CENTERS. -
G.P_STAKESholds the stake prototypes, much likeG.P_CENTERS. -
G.P_BLINDSholds the blind prototypes, much likeG.P_CENTERS. -
G.P_CARDSholds the playing card prototypes, much likeG.P_CENTERS. -
G.P_CENTERSholds the game's center objects (prototypes for jokers, consumables, vouchers, decks, enhancements, editions, and boosters). It is indexed with the object's key. For example,G.P_CENTERS.c_strengthis the center for Strength. -
G.P_CENTER_POOLSholds definitions for objects grouped by pool, indexed by numbers. For example,G.P_CENTER_POOLS.Tagholds the tags, andG.P_CENTER_POOLS.Tag[1]is a specific tag. -
G.P_JOKER_RARITY_POOLSis likeG.P_CENTER_POOLSbut for specific joker rarities. -
G.P_LOCKEDholds every locked object. -
G.ASSET_ATLASandG.ANIMATION_ATLAShold sprite atlases that look like the following:
{
name = string,
image = love_image,
type = string,
px = number,
py = number
}-
G.STATE_COMPLETEis set to true once the most recent transition inG.STATEhas been run. -
G.STATEholds the current interaction state in the game's state machine. -
G.STATESnames every possible interaction state in the game's state machine. -
G.SPEEDFACTORis the speed at whichG.TIMERS.TOTALruns. -
G.STEAMis used to interact with the Steam API. -
G.DEBUGcan be set to true to view debugging information. -
G.FILE_HANDLERmanages saving the game every 10 seconds. -
G.VERSIONis the version string for the current build of the game. -
G.TIMERShas various timers that run at different rates and reset at different times. The event manager uses these, as well as many animations. -
G.FRAMES.MOVEholds the current physics frame number. -
G.FRAMES.DRAWholds the current frame number. -
G.SETTINGSholds the various configuration options: -
-
G.SETTINGS.languagehas the current language code.
-
-
-
G.SETTINGS.GAMESPEEDhas the current gamespeed option.
-
-
-
G.SETTINGS.pausedis set to true when the game is paused.
-
-
-
G.SETTINGS.CUSTOM_DECKholds collab selections.
-
-
G.COLLABSis where collabs are defined. -
G.METRICSholds player stats:
G.METRICS = {
cards = {
used = {},
bought = {},
appeared = {},
},
decks = {
chosen = {},
win = {},
lose = {}
},
bosses = {
faced = {},
win = {},
lose = {},
}
}-
G.PROFILESholds the save profiles. Typically onlyG.PROFILES[G.SETTINGS.profile]is relevant. -
G.CARD_Wholds the width of a standard card. -
G.CARD_Hholds the height of a standard card. -
G.STAGEholds the current game screen (menu vs. gameplay). -
G.STAGE_OBJECTStracks which objects belong to the current stage so they can be deleted correctly. -
G.STAGESnames every possible game screen. -
G.TAROT_INTERRUPTholds the state to return to after the current tarot card is done processing. -
G.ARGSis used to move data around the game. It does a lot of miscellaneous things. -
G.FUNCSprimarily holds functions used as callbacks from within UI definitions. -
G.Iholds every object the engine needs to generically process. -
G.I.NODEholds everyNode, but no subclasses. -
G.I.MOVEABLEholds everyMoveable, but no subclasses. -
G.I.SPRITEholds everySpriteandAnimatedSprite, but no subclasses. -
G.I.UIBOXholds everyUIBox, but no subclasses. -
G.I.POPUPholds every drag popup. This appears to be unused. -
G.I.CARDholds everyCard,Blind, andCard_Character, but no subclasses. -
G.I.CARDAREAholds everyCardArea, but no subclasses. -
G.I.ALERTis unused. -
G.MOVEABLESholds every moveable. -
G.ANIMATIONSholds everyAnimatedSprite. -
G.Cholds colors. -
G.UITnames every possible type of UI node. -
G.handlistorders the pokers hands from best to worst. -
G.ROOMis the UI node for the entire window. -
G.ROOM_ATTACHis the moveable forG.ROOM. -
G.CONTROLLERis the singletonControllerobject which handles input. -
G.playing_cardscontains every spawned in playing card, regardless of area. -
G.HUDis the HUD'sUIBox. -
G.HUD_blindis theUIBoxfor the blind's information when facing it. -
G.HUD_tagsis theUIBoxfor tags. -
G.hand_text_areais a collection of convenience accessors intoG.HUD.
G.hand_text_area = {
chips = ...,
mult = ...,
ante = ...,
round = ...,
chip_total = ...,
handname = ...,
hand_level = ...,
game_chips = ...,
blind_chips = ...,
blind_spacer = ...
}-
G.MAJORSappears to be unused. -
G.MINORSappears to be unused. -
G.CANVASis the Love canvas the game gets rendered to. -
G.SEEDis largely inconsequential. You wantG.GAME.pseudorandom.seedinstead. -
G:save_progress()saves the unlocked/discovered/alerted badge state of centers, blinds, tags, and seals. -
G:save_notify()saves unlock notifications. -
G:save_settings()saveG.SETTINGS. -
G:save_metrics()saveG.METRICS. -
G:prep_stage(...)sets upG.ROOM. -
G:splash_screen()shows the intro animation. -
G:main_menu(...)shows the main menu. -
G:load_profile(_profile)selects one of the profiles. -
G:start_run(...)starts a new run or continues a run in progress. Additionally, it creates the variousCardAreas needed in game, as well as the UI elements in the HUD. -
G:init_game_object()return the initial state ofG.GAME. -
G:set_language()initializes localization information. -
G:set_globals()initializes many globals withinG. -
G:update(dt)is called once per frame. This usesG.STATEandG.STATE_COMPLETEto run a state machine. -
G:draw()draws everything in the game.
-
G.jokersMain Joker area. -
G.consumeablesMain consumable area. -
G.handArea for playing cards held in hand. -
G.playArea for playing cards played. Also used for some animations. -
G.deckArea for playing cards currently in the deck. -
G.discardInvisible area playing cards go after being played or discarded. Also used for some animations. -
G.vouchersVoucher area. Added by SMODS. -
G.shop_jokersMain shop area for Jokers, Consumables, Playing Cards, etc. -
G.shop_boosterShop area for Booster packs. -
G.shop_vouchersShop area for Vouchers. -
G.pack_cardsArea for cards in a booster. -
G.title_topTitle screen area.
G.GAME holds game state for the current run. This is reset when starting a new run. Note that it is serialized when saving and reloading the game.
-
G.GAME.wonis true if this run was won. -
G.GAME.round_scoresholds statistics for the end screen. -
G.GAME.joker_usageappears to be unused. -
G.GAME.consumeable_usageholds statistics for effects like Fortune Teller and Satellite. -
G.GAME.hand_usageholds statistics for effects like Obelisk. -
G.GAME.last_tarot_planetholds the Fool card. -
G.GAME.win_anteholds the ante at which finisher blinds will appear. -
G.GAME.stakeholds the currently applied stake. -
G.GAME.modifiersholds game rules. These are usually set by stakes or challenges. -
G.GAME.starting_paramsholds the standard variables set by decks, stakes, and challenges. These are copied elsewhere inG.GAMEwhen starting the game. -
G.GAME.banned_keysholds keys of objects that aren't allowed to spawn. -
G.GAME.roundholds the current round number. -
G.GAME.probabilities.normalholds the 1 for any 1 in x odds. -
G.GAME.bosses_usedholds the boss blinds encountered this run to prevent them from spawning again too quickly. -
G.GAME.pseudorandomholds the RNG state for the game. -
G.GAME.pseudorandom.seedholds the game seed. -
G.GAME.starting_deck_sizeholds the starting deck size used by Erosion. -
G.GAME.ecto_minusholds the hand size decrease on Ectoplasm. -
G.GAME.pack_sizeis used to pass a booster's size to the function that creates it. -
G.GAME.skipscounts the number of skipped blinds. -
G.GAME.STOP_USEis set to a number greater than 0 when no inputs should be processed, -
G.GAME.edition_rateis a multiplier to the 4% rate of editions spawning. -
G.GAME.joker_rateis a weight for jokers spawning in the shop. -
G.GAME.tarot_rateis a weight for tarot cards spawning in the shop. -
G.GAME.planet_rateis a weight for planets spawning in the shop. -
G.GAME.spectral_weightis a weight for spectral cards spawning in the shop. -
G.GAME.playing_card_rateis a weight for playing cards spawning in the shop. -
G.GAME.consumeable_bufferis used during calculation to prevent too many consumables from being spawned. -
G.GAME.joker_bufferis used during calculation by Riff-Raff to prevent too many jokers from being spawned. -
G.GAME.discount_percentis set by Clearance Sale and Liquidation. -
G.GAME.interest_capis the amount of money needed to get max interest. -
G.GAME.interest_amountis the amount of interest earned per $5. -
G.GAME.inflationis used in the Inflation challenge. -
G.GAME.hands_playedcounts played hands. -
G.GAME.unused_discardscounts unused discards. -
G.GAME.perishable_roundsdetermines how quickly perishable cards perish. -
G.GAME.rental_ratedetermines how expensive rental cards are at the end of a round. -
G.GAME.blindis the blind currently being faced off against. -
G.GAME.chipsis the current total round chips. -
G.GAME.chips_textisG.GAME.chipsas a readable string. -
G.GAME.voucher_textappears to be unused. -
G.GAME.dollarsis the current money amount. -
G.GAME.max_jokerstracks Invisible Joker's unlock condition. -
G.GAME.bankrupt_atis set to -20 by Credit Card. -
G.GAME.current_boss_streaktracks the "most bosses in a row" statistic. -
G.GAME.base_reroll_costis lowered by Reroll Surplus and Reroll Glut. -
G.GAME.blind_on_deckis the type of the "up next" blind ("Small", "Big", or "Boss"). -
G.GAME.sortis the selected hand sorting method. -
G.GAME.previous_roundappears to be unused. -
G.GAME.previous_round.dollarsappears to be unused, but tracks the amount of money after the most recent cash out. -
G.GAME.tagsholds the current tags. -
G.GAME.tag_tallyis used to give each tag a unique ID number. -
G.GAME.pool_flagsis used for Gros Michel/Cavendish. -
G.GAME.used_jokersholds currently spawned centers to avoid spawning duplicates. -
G.GAME.used_vouchersholds vouchers redeemed this run. -
G.GAME.current_roundholds various transient numbers that rapidly change during gameplay. -
G.GAME.round_resetsis used to resetG.GAME.current_round. -
G.GAME.round_resets.blind_statesholds the skip status of each blind. -
G.GAME.round_bonusgives extra hands and discards for one round. Unused in vanilla. -
G.GAME.shop.joker_maxholds the number of card slots in the shop. -
G.GAME.cards_playedtracks playing card statistics. -
G.GAME.handsholds poker hand levels and their chip/mult values.
Game Objects
- API Documentation
- SMODS.Achievement
- SMODS.Atlas
- SMODS.Attribute
- SMODS.Blind
- SMODS.CanvasSprite
- SMODS.Center
- SMODS.Challenge
- SMODS.DeckSkin
- SMODS.DrawStep
- SMODS.DynaTextEffect
- SMODS.Font
- SMODS.Gradient
- SMODS.https
- SMODS.JimboQuip
- SMODS.Keybind
- SMODS.Language
- SMODS.ObjectType and SMODS.ConsumableType
- SMODS.PokerHand
- SMODS.Rank and SMODS.Suit
- SMODS.Rarity
- SMODS.Scoring_Parameter and SMODS.Scoring_Calculation
- SMODS.Seal
- SMODS.Shader and SMODS.ScreenShader
- SMODS.Sound
- SMODS.Stake
- SMODS.Sticker
- SMODS.Tag
Guides
- Your First Mod
- Mod Metadata
- The Mod Object
- Calculate Functions
- Perma-bonuses
- Object Weights
- Logging
- Event Manager
- Localization
- Text Styling
- UI Structure
- Utility Functions
- All About
G - Internal Documentation
Release Notes
Found an issue, or want to add something? Submit a PR to the Wiki repo.