Quick reference for HELLDECK's core APIs. For tutorials and examples, see DEVELOPER.md.
Main orchestrator for game logic and state management.
class GameEngine(
repo: ContentRepository,
rng: SeededRng,
selector: ContextualSelector,
augmentor: Augmentor?,
modelId: String,
cardGeneratorV3: CardGeneratorV3?
)Methods:
suspend fun next(req: Request): Result- Generate next game cardfun recordOutcome(templateId: String, reward01: Double)- Record round result for learningfun getOptionsFor(card: FilledCard, req: Request): GameOptions- Get game-specific options
Data Classes:
data class Request(
val sessionId: String,
val gameId: String? = null,
val players: List<String> = emptyList(),
val spiceMax: Int = 3,
val localityMax: Int = 3,
val recentFamilies: List<String> = emptyList(),
val avoidTemplateIds: Set<String> = emptySet()
)
data class Result(
val filledCard: FilledCard,
val options: GameOptions,
val timer: Int,
val interactionType: InteractionType
)Data access layer for templates, lexicons, and stats.
class ContentRepository(context: Context)Methods:
fun initialize()- Initialize repository and load assetsfun templates(): List<Template>- Get legacy templatesfun templatesV2(): List<TemplateV2>- Get V2 blueprint templatesfun wordsFor(slot: String): List<String>- Get lexicon words for slot typeval statsDao: TemplateStatsDao- Access to template statistics
Thompson Sampling-based template selection algorithm.
class ContextualSelector(rng: SeededRng)Methods:
fun pick(ctx: Context, pool: List<TemplateV2>): TemplateV2- Select template using UCBfun update(templateId: String, reward: Double)- Update template statistics
Quality-first LLM card generation using gold standard examples.
class LLMCardGeneratorV2(
llm: LocalLLM?,
context: Context,
templateFallback: CardGeneratorV3
)Methods:
suspend fun generate(request: GenerationRequest): GenerationResult?- Generate LLM-powered card with fallback chain
Data Classes:
data class GenerationRequest(
val gameId: String,
val players: List<String>,
val spiceMax: Int, // Controls temperature: 1→0.5, 2→0.6, 3→0.75, 4→0.85, 5+→0.9
val sessionId: String,
val roomHeat: Double = 0.6
)
data class GenerationResult(
val filledCard: FilledCard,
val options: GameOptions,
val timer: Int,
val interactionType: InteractionType,
val usedLLM: Boolean,
val qualityScore: Double = 0.0
)Generation Flow:
- Check if LocalLLM is ready
- Build quality-focused prompt with gold examples from
gold_cards.json - Up to 3 attempts, 2.5s timeout each
- Parse and validate response (quality score ≥0.6, no clichés)
- Fallback chain: Gold Cards → CardGeneratorV3
Blueprint-based card generation with quality gating. Used as fallback when LLM is unavailable.
class CardGeneratorV3(repo: RepositoriesV3, rng: SeededRng)Methods:
fun generate(req: GameEngine.Request, rng: SeededRng): GenerationResult?- Generate quality-gated cardfun goldOnly(req: GameEngine.Request, rng: SeededRng): GenerationResult?- Use gold fallback only
High-quality curated cards for prompts and fallbacks.
object GoldCardsLoader {
fun load(context: Context): Map<String, List<GoldCard>>
fun getExamplesForGame(context: Context, gameId: String, count: Int = 5): List<GoldCard>
fun getRandomFallback(context: Context, gameId: String): GoldCard?
}Core Entities:
TemplateEntity- Game card templatesTemplateV2Entity- Blueprint-based templatesLexiconEntity- Word lists for slot fillingPlayerEntity- Player data and statisticsRoundEntity- Round historyTemplateStatEntity- Template learning statsGameSessionEntity- Session tracking
TemplateStatsDao:
interface TemplateStatsDao {
suspend fun get(templateId: String): TemplateStatEntity?
suspend fun upsert(stat: TemplateStatEntity)
suspend fun getAll(): List<TemplateStatEntity>
}HelldeckAppUI:
@Composable
fun HelldeckAppUI(vm: GameNightViewModel, modifier: Modifier = Modifier)Scene Composables:
HomeScene(vm: GameNightViewModel)- Main menu with game selectionRoundScene(vm: GameNightViewModel)- Game round interface with timer and interactionsOnboardingFlow(onComplete: () -> Unit)- Interactive tutorial for new usersRollcallScene(vm: GameNightViewModel)- Player attendance managementPlayersScene(vm: GameNightViewModel)- Player management and profilesFeedbackScene(vm: GameNightViewModel)- Post-round rating interfaceSettingsScene(vm: GameNightViewModel)- App configurationStatsScene(vm: GameNightViewModel)- Player statistics and game history
Enhanced Button Components:
PrimaryButton(onClick, text, modifier, enabled, loading, icon)- Animated primary action button with hapticsSecondaryButton(onClick, text, modifier, enabled)- Outlined secondary buttonTextButton(onClick, text, modifier, enabled)- Text-only buttonToggleButton(selected, onClick, text, modifier)- Toggle state button with animationsIconButton(onClick, icon, modifier, enabled)- Icon-only button with scale feedbackFloatingActionButton(onClick, icon, modifier)- Floating action button
Interactive Components:
BigZones(onLeft, onCenter, onRight, onLong)- Three-zone touch interfaceFeedbackStrip(onLol, onMeh, onTrash, onComment)- Round feedbackEmojiPicker(show, onDismiss, onPick)- Emoji avatar selectionSpiceSlider(value, onValueChange, modifier)- Spice level selector with visual feedbackInteractionRenderer(roundState, onEvent, modifier)- Master dispatcher for game interactions
Runtime configuration management.
object Config {
val current: ConfigData
fun load(context: Context)
}ConfigData Structure:
data class ConfigData(
val generator: GeneratorConfig,
val scoring: ScoringConfig,
val debug: DebugConfig
)Blueprint V3 (templates_v3/*.json):
{
"id": "unique_id",
"game": "GAME_ID",
"family": "template_family",
"weight": 1.0,
"spice_max": 2,
"locality_max": 2,
"blueprint": [
{"type": "text", "value": "Static text"},
{"type": "slot", "name": "slot1", "slot_type": "lexicon_name"}
],
"constraints": {"max_words": 24, "distinct_slots": true}
}Lexicon V2 (lexicons_v2/*.json):
{
"slot_type": "category_name",
"entries": [{
"text": "entry",
"tags": ["tag1"],
"tone": "playful",
"spice": 1,
"locality": 1,
"pluralizable": false,
"needs_article": "a"
}]
}Device lockdown for dedicated gameplay.
object Kiosk {
fun enableImmersiveMode(decorView: View)
fun startLockTask(activity: ComponentActivity)
fun stopLockTask(activity: ComponentActivity)
fun isKioskModeConfigured(context: Context): Boolean
}class HelldeckDeviceAdminReceiver : DeviceAdminReceiver()Vibration and camera flash feedback.
object HapticsTorch {
fun buzz(context: Context, durationMs: Long, intensity: VibrationIntensity)
fun flash(context: Context, durationMs: Long, intensity: FlashIntensity)
}object GameFeedback {
fun triggerFeedback(context: Context, event: GameEvent)
fun triggerRoundResultFeedback(context: Context, result: RoundResult)
}VOTE_PLAYER- Vote for player (Roast Consensus, Hot Seat Imposter)TRUE_FALSE- Binary choice (Confession or Cap)AB_VOTE- A/B option selection (Poison Pitch, Majority Report, Over/Under)JUDGE_PICK- Judge selection (Fill-In Finisher, Title Fight)REPLY_TONE- Text reply tone (Text Thread Trap)TABOO_CLUE- Taboo word game (Taboo Timer)ODD_EXPLAIN- Odd one out explanation (Odd One Out, The Unifying Theory)SALES_PITCH- Sales pitch (Hype or Yike)SPEED_LIST- Quick listing (Scatterblast)HIDE_WORDS- Hide words in story (Alibi Drop)MINI_DUEL- Mini-duel format (Title Fight)PREDICT_VOTE- Predict room vote (Majority Report)REALITY_CHECK- Self-rating vs group rating (Reality Check)
PlayerVote(players: List<String>)- List of players to vote forAB(optionA: String, optionB: String)- Two-choice optionsTaboo(word: String, forbidden: List<String>)- Target word and forbidden termsScatter(category: String, letter: String)- Category and starting letterReplyTone(tones: List<String>)- Available reply tone optionsOddOneOut(items: List<String>)- Three items to choose fromOverUnder(line: Int, actual: Int?)- Betting line and actual value (if revealed)RealityCheck(subjectScore: Int, groupScore: Int?)- Self-rating and group ratingNone- No special options
Brainpack file management for learning data.
object ExportImport {
fun exportBrainpack(context: Context, filename: String): Uri
fun importBrainpack(context: Context, uri: Uri): ImportResult
}GameEngineException- Game logic errorsTemplateEngineException- Template processing errorsDatabaseException- Data layer errorsConfigurationException- Configuration errors
- Developer Guide - Setup, examples, and tutorials
- User Guide - Game rules and player documentation
- Content Authoring - Creating templates and lexicons
- Troubleshooting - Common issues and solutions
- Architecture - System design and patterns