flutter3d_game library
What a game on flutter3d adds to an application: the devices it is played with, the run being played, the screens a player uses that are not the game, and what a level's simulation moves, drawn.
It stands on flutter3d_app and flutter3d_sim, and re-exports
neither. A file that loads a level or opens a device imports
flutter3d_app; one that steps a simulation imports flutter3d_sim; one
that reads a touch stick or saves a run imports this. The modeller and the
lessons use the first two and never this one, which is the line this
package exists to draw.
- Input that has forgotten which device it came from: TouchControls,
DesktopInput, PadInput and the Bindings between a device and a
GameAction, with Accommodations and GameConfig beside them. - The run. RunSession loads a level, restarts it, moves to the next, saves and resumes; RunTimeline scrubs and branches what a run has recorded, and registerTimelineExtensions lets a tool attached to a running game ask it to.
- The screens that are not the game: SettingsOverlay with volumes, gamepad and accessibility sliders and a rebinding list, SaveFile, SettingsFile and DemoFile, AutomapView, TapToRestart and the credits. What a particular game says is passed in: the credits are a widget, and the rebindable actions are the caller's.
- What a level's simulation moves, drawn: ActorVisuals and FixtureVisuals, with the look decided by the game through ActorAppearance and FixtureAppearance, and SoundOcclusion for a wall between a listener and a source.
- The walk a level starts with: LevelWalk, a body that collides, jumps and runs, turns where it is dragged and carries a camera at eye height, and openRegistryFor, which accepts every type a level names before a game has taught it any.
What is deliberately not here: the title card and the loss screen, which are the face of a particular game, and a state-management choice for the run — RunSession is an ordinary class.
Classes
- Accommodations
- What the player has already told the operating system.
- ActorAppearance
- What a monster is made of, which is the one thing the bridge cannot know.
- ActorVisuals
- Where the monsters are, and which way they are facing.
- AutomapPainter
- The painting, public so a test can ask it what it would draw.
- AutomapView
- The automap, drawn: floor where the player has walked, walls where it stopped, an arrow where they stand.
- Bindings
- What each thing on a device does, and the only place that answers it.
- Credit
- One piece of work the game did not make, and what is owed for it.
- CreditsSection
- Who made the art, wherever the game is shown.
- DemoFile
- Where the last run is kept as what the player did.
- DesktopInput
-
Feeds an
InputStatefrom a keyboard and a captured mouse. - DragLook
- Looking around by dragging, where there is no pointer to lock.
- FixtureAppearance
- The half of a fixture's look that only the game can know.
- FixtureVisuals
- What the doors, lifts, platforms, buttons, keys and lights look like.
- GameConfig
- Everything a player has changed about how the game behaves for them.
- InputSource
- Something on a device that can be bound: a key, a mouse button, a pad's face button.
- LevelWalk
- A body that walks a level: it collides, jumps and runs, turns where it is dragged, and carries a camera at eye height.
- LightFixtureBuild
- Everything the bridge has already decided by the time a silhouette is built.
- OpenKind
- A kind for a type the application has not been taught yet.
- PadAxisPair
- A signed axis routed to two actions, one per direction.
- PadInput
-
Feeds an
InputStatefrom a gamepad. - PadPresses
- The pad, as a screen reads it rather than as the game does.
- PadRoutes
- Where each of a pad's analogue controls goes, for one kind of game.
- PadStickTarget
- What a PadStickUse is allowed to do with a deflection.
- PadStickUse
- What a stick's two axes are for.
- Playing
- How this build is played.
- Rebinding
- Moving a control to somewhere the player can reach.
-
RunFailed<
L> - Nothing is up, and this is why.
-
RunLoading<
L> - Before the first level, and between one and the next.
-
RunPlaying<
L> - A level is up. outcome is the simulation's own answer, republished so a screen can watch one thing.
-
RunSession<
L> - The run: which level is up, what happened to it, and where to go next.
-
RunStatus<
L> - What a game is doing, as far as a screen is concerned.
- RunTimeline
-
Pause, step, rewind and branch, built on a live
RewindBuffer. - SaveFile
- Where a run in progress is kept between launches.
- SettingsCubit
-
The settings screen as a state machine rather than as
setState. - SettingsFile
- Where a game keeps what the player changed.
- SettingsOverlay
-
The gear, and the panel it opens. The mouse twin of
settingsKeys. - SettingsPanel
- Volume sliders and the keys, over the top of the paused game.
- SettingsState
- What the settings screen is doing.
- SoundOcclusion
- How much of a sound survives the walls between its source and the ear.
- TapToRestart
- Covers the game and restarts it when tapped.
- TimelineBranched
- The run was rewound to step and released — everything after step in the buffer was cut, and the run continues from there.
- TimelineCommand
-
One action taken on a RunTimeline, kept so a caller can show a history —
rp-02's "команды видны в истории", the same log an MCP command stream would replay. - TimelinePaused
- The run was paused.
- TimelineResumed
- The run was resumed from a pause.
- TimelineStepped
- One fixed step was taken while paused.
- TorchFire
- One torch's fire.
- TouchAction
- One labelled button on a touch screen.
- TouchButton
- A round button that holds an action down while a finger is on it.
- TouchControls
- A thumb stick and some buttons, drawn over a game that has no keyboard.
- TouchSlot
- One numbered slot, as the row draws it.
- TouchSlots
- The numbered slots, as buttons for a thumb.
- TouchStick
-
A stick under a thumb, reporting into
InputState.setStickAxis. - TouchToggle
- A round button that is set rather than held: tapped once it is on, tapped again it is off.
Constants
-
settableBuses
→ const List<
AudioBus> - The buses a player is offered, in the order the panel shows them.
Functions
-
applySavedVolumes(
GameConfig config, Mixer mixer) → void -
Copies every saved volume into
mixer. -
bugReportTape(
RewindBuffer rewind) → BugReportTape? -
rp-04's game-side half: the last few secondsrewindhas kept, as the state and the tape aDemoneeds — everything except the checkpoints and the free-text fields, which only the caller can supply. -
busesIn(
Iterable< SoundDef> sounds) → List<AudioBus> -
The buses
soundsactually reaches, in the order settableBuses lists. -
clockText(
double? seconds, {bool thousandths = false, String? none}) → String - Minutes and seconds, which is how a time is read rather than how it is counted.
-
configureForTouch(
) → void - Locks to landscape and hides the system bars, on a device played by touch.
-
openRegistryFor(
Level level) → EntityRegistry -
A registry that accepts every type
levelnames and gives none of them a meaning — see OpenKind. -
ownedBindings(
GameConfig config, Bindings defaults()) → Bindings - The one table of controls: the one the devices read and the one the file saves.
-
registerTimelineExtensions(
RunTimeline timeline, {StepTimeTrace? frameTimes, Map< String, Object?> bugReport()?}) → void - Puts a RunTimeline on the VM service, so a running game can be paused, stepped, scrubbed and branched from outside the process it is playing in — a level editor attached over the same channel Flutter DevTools already uses, rather than a simulation embedded inside the editor itself.
-
rewindBufferFromDemo(
{required Demo demo, required int stepsPerSecond, int? keyframeEvery, double? history, required InputState input, required void restore(Snapshot snapshot), required Snapshot save(), required void stepSim(double dt)}) → RewindBuffer -
Rebuilds a
RewindBufferthat reaches every step ofdemo, not only the last few seconds a live RunTimeline keeps —rp-02's "скраббер по всему прогону из.f3drun", built by replaying the whole tape once rather than by teachingRewindBuffera second way to acquire keyframes. -
settingsKeys(
KeyEvent event, SettingsCubit settings, {required void opening(), bool canOpen = true}) → KeyEventResult? - The keys that belong to the settings rather than to the game.
Typedefs
- BugReportTape = ({Snapshot start, InputTape tape})
- The state a bug report's tape starts from, and everything since.