2018-08-17 03:37:19 +00:00
|
|
|
package balance
|
|
|
|
|
2021-10-05 02:51:31 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"git.kirsle.net/go/render"
|
|
|
|
)
|
2021-06-14 03:25:42 +00:00
|
|
|
|
2022-04-30 03:34:59 +00:00
|
|
|
// Format for level and doodad files.
|
|
|
|
type Format int
|
|
|
|
|
|
|
|
const (
|
|
|
|
FormatJSON Format = iota // v0: plain json files
|
|
|
|
FormatGZip // v1: gzip compressed json files
|
|
|
|
FormatZipfile // v2: zip archive with external chunks
|
|
|
|
)
|
|
|
|
|
2018-08-17 03:37:19 +00:00
|
|
|
// Numbers.
|
|
|
|
var (
|
2018-10-08 17:38:49 +00:00
|
|
|
// Window dimensions.
|
|
|
|
Width = 1024
|
|
|
|
Height = 768
|
|
|
|
|
2021-12-24 05:11:45 +00:00
|
|
|
// Title screen height needed for the main menu. Phones in landscape
|
|
|
|
// mode will switch to the horizontal layout if less than this height.
|
|
|
|
TitleScreenResponsiveHeight = 600
|
|
|
|
|
2018-08-17 03:37:19 +00:00
|
|
|
// Speed to scroll a canvas with arrow keys in Edit Mode.
|
2021-08-16 03:17:53 +00:00
|
|
|
CanvasScrollSpeed = 8
|
|
|
|
FollowActorMaxScrollSpeed = 64
|
2018-09-23 22:20:45 +00:00
|
|
|
|
2019-04-10 01:28:08 +00:00
|
|
|
// Window scrolling behavior in Play Mode.
|
2021-06-14 03:25:42 +00:00
|
|
|
ScrollboxOffset = render.Point{ // from center of screen
|
2021-08-12 03:40:31 +00:00
|
|
|
X: 60,
|
2021-10-05 02:51:31 +00:00
|
|
|
Y: 60,
|
2021-06-14 03:25:42 +00:00
|
|
|
}
|
2019-04-10 01:28:08 +00:00
|
|
|
|
|
|
|
// Player speeds
|
2022-10-10 17:52:28 +00:00
|
|
|
PlayerMaxVelocity float64 = 7
|
|
|
|
PlayerJumpVelocity float64 = -23
|
|
|
|
PlayerAcceleration float64 = 0.04 // 0.12
|
|
|
|
PlayerFriction float64 = 0.1
|
|
|
|
SlipperyAcceleration float64 = 0.02
|
|
|
|
SlipperyFriction float64 = 0.02
|
|
|
|
Gravity float64 = 7
|
|
|
|
GravityAcceleration float64 = 0.1
|
|
|
|
SwimGravity float64 = 3
|
|
|
|
SwimJumpVelocity float64 = -12
|
|
|
|
SwimJumpCooldown uint64 = 24 // number of frames of cooldown between swim-jumps
|
|
|
|
SlopeMaxHeight = 8 // max pixel height for player to walk up a slope
|
2019-04-10 01:28:08 +00:00
|
|
|
|
2022-09-25 06:54:51 +00:00
|
|
|
// Number of game ticks to insist the canvas follows the player at the start
|
|
|
|
// of a level - to overcome Anvils settling into their starting positions so
|
|
|
|
// they don't steal the camera focus straight away.
|
|
|
|
FollowPlayerFirstTicks uint64 = 60
|
|
|
|
|
2018-09-23 22:20:45 +00:00
|
|
|
// Default chunk size for canvases.
|
2018-10-18 06:01:21 +00:00
|
|
|
ChunkSize = 128
|
2018-09-26 17:04:46 +00:00
|
|
|
|
|
|
|
// Default size for a new Doodad.
|
|
|
|
DoodadSize = 100
|
2019-07-03 23:22:30 +00:00
|
|
|
|
|
|
|
// Size of Undo/Redo history for map editor.
|
|
|
|
UndoHistory = 20
|
Eraser Tool, Brush Sizes
* Implement Brush Sizes for drawtool.Stroke and add a UI to the tools panel
to control the brush size.
* Brush sizes: 1, 2, 4, 8, 16, 24, 32, 48, 64
* Add the Eraser Tool to editor mode. It uses a default brush size of 16
and a max size of 32 due to some performance issues.
* The Undo/Redo system now remembers the original color of pixels when
you change them, so that Undo will set them back how they were instead
of deleting the pixel entirely. Due to performance issues, this only
happens when your Brush Size is 0 (drawing single-pixel shapes).
* UI: Add an IntVariable option to ui.Label to bind showing the value of
an int reference.
Aforementioned performance issues:
* When we try to remember whole rects of pixels for drawing thick
shapes, it requires a ton of scanning for each step of the shape. Even
de-duplicating pixel checks, tons of extra reads are constantly
checked.
* The Eraser is the only tool that absolutely needs to be able to
remember wiped pixels AND have large brush sizes. The performance
sucks and lags a bit if you erase a lot all at once, but it's a
trade-off for now.
* So pixels aren't remembered when drawing lines in your level with
thick brushes, so the Undo action will simply delete your pixels and not
reset them. Only the Eraser can bring back pixels.
2019-07-12 02:07:46 +00:00
|
|
|
|
|
|
|
// Options for brush size.
|
|
|
|
BrushSizeOptions = []int{
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
4,
|
|
|
|
8,
|
|
|
|
16,
|
|
|
|
24,
|
|
|
|
32,
|
|
|
|
48,
|
|
|
|
64,
|
|
|
|
}
|
|
|
|
DefaultEraserBrushSize = 8
|
|
|
|
MaxEraserBrushSize = 32 // the bigger, the slower
|
2020-09-19 05:35:43 +00:00
|
|
|
|
2022-03-05 23:31:09 +00:00
|
|
|
// Default font filename selected for Text Tool in the editor.
|
|
|
|
// TODO: better centralize font filenames, here and in theme.go
|
2022-03-06 06:44:54 +00:00
|
|
|
TextToolDefaultFont = SansSerifFont
|
2022-03-05 23:31:09 +00:00
|
|
|
|
2022-01-03 06:36:32 +00:00
|
|
|
// Interval for auto-save in the editor
|
|
|
|
AutoSaveInterval = 5 * time.Minute
|
|
|
|
|
2020-09-19 05:35:43 +00:00
|
|
|
// Default player character doodad in Play Mode.
|
|
|
|
PlayerCharacterDoodad = "boy.doodad"
|
|
|
|
|
2022-02-21 01:46:16 +00:00
|
|
|
// Levelpack and level names for the title screen.
|
|
|
|
DemoLevelPack = "assets/levelpacks/001000-TUTORIAL.levelpack"
|
2022-01-03 06:36:32 +00:00
|
|
|
DemoLevelName = []string{
|
|
|
|
"Tutorial 1.level",
|
|
|
|
"Tutorial 2.level",
|
|
|
|
"Tutorial 3.level",
|
|
|
|
}
|
2021-06-07 01:59:04 +00:00
|
|
|
|
|
|
|
// Level attachment filename for the custom wallpaper.
|
|
|
|
// NOTE: due to hard-coded "assets/wallpapers/" prefix in uix/canvas.go#LoadLevel.
|
2021-06-13 21:53:21 +00:00
|
|
|
CustomWallpaperFilename = "custom.b64img"
|
2021-06-07 01:59:04 +00:00
|
|
|
CustomWallpaperEmbedPath = "assets/wallpapers/custom.b64img"
|
2021-06-13 21:53:21 +00:00
|
|
|
|
|
|
|
// Publishing: Doodads-embedded-within-levels.
|
|
|
|
EmbeddedDoodadsBasePath = "assets/doodads/"
|
|
|
|
EmbeddedWallpaperBasePath = "assets/wallpapers/"
|
2021-07-14 02:23:09 +00:00
|
|
|
|
|
|
|
// File formats: save new levels and doodads gzip compressed
|
2022-04-30 03:34:59 +00:00
|
|
|
DrawingFormat = FormatZipfile
|
|
|
|
|
|
|
|
// Zipfile drawings: max size of the LRU cache for loading chunks from
|
|
|
|
// a zip file. Normally the chunker discards chunks not loaded in a
|
|
|
|
// recent tick, but when iterating the full level this limits the max
|
|
|
|
// size of loaded chunks before some will be freed to make room.
|
|
|
|
// 0 = do not cap the cache.
|
|
|
|
ChunkerLRUCacheMax = 0
|
2021-10-05 02:51:31 +00:00
|
|
|
|
|
|
|
// Play Mode Touchscreen controls.
|
|
|
|
PlayModeIdleTimeout = 2200 * time.Millisecond
|
|
|
|
PlayModeAlphaStep = 8 // 0-255 alpha, steps per tick for fade in
|
|
|
|
PlayModeAlphaMax = 220
|
2022-01-19 02:32:15 +00:00
|
|
|
|
|
|
|
// Invulnerability time in seconds at respawn from checkpoint, in case
|
|
|
|
// enemies are spawn camping.
|
|
|
|
RespawnGodModeTimer = 3 * time.Second
|
2022-02-20 02:25:36 +00:00
|
|
|
|
|
|
|
// GameController thresholds.
|
|
|
|
GameControllerMouseMoveMax float64 = 20 // Max pixels per tick to simulate mouse movement.
|
|
|
|
GameControllerScrollMin float64 = 0.3 // Minimum threshold for a right-stick scroll event.
|
2022-03-26 20:55:06 +00:00
|
|
|
|
|
|
|
// Limits on the Flood Fill tool so it doesn't run away on us.
|
|
|
|
FloodToolVoidLimit = 600 // If clicking the void, +- 1000 px limit
|
|
|
|
FloodToolLimit = 1200 // If clicking a valid color on the level
|
2022-04-10 01:21:26 +00:00
|
|
|
|
|
|
|
// Eager render level chunks to images during the load screen.
|
|
|
|
// Originally chunks rendered to image and SDL texture on-demand, the loadscreen was
|
|
|
|
// added to eager load (to image) the whole entire level at once (SDL textures were
|
|
|
|
// still on demand, as they scroll into screen). Control this in-game with
|
|
|
|
// `boolProp eager-render false` and the loadscreen will go quicker cuz it won't
|
|
|
|
// load the whole entire level. Maybe useful to explore memory issues.
|
|
|
|
EagerRenderLevelChunks = true
|
2022-04-10 19:39:27 +00:00
|
|
|
|
|
|
|
// Number of chunks margin outside the Canvas Viewport for the LoadingViewport.
|
2022-05-08 00:16:03 +00:00
|
|
|
LoadingViewportMarginChunks = render.NewPoint(10, 8) // hoz, vert
|
|
|
|
CanvasLoadUnloadModuloTicks uint64 = 4
|
|
|
|
CanvasChunkFreeChoppingBlockTicks uint64 = 128 // number of ticks old a chunk is to free it
|
2018-08-17 03:37:19 +00:00
|
|
|
)
|
2018-10-20 22:42:49 +00:00
|
|
|
|
|
|
|
// Edit Mode Values
|
|
|
|
var (
|
|
|
|
// Number of Doodads per row in the palette.
|
|
|
|
UIDoodadsPerRow = 2
|
Doodad/Actor Runtime Options
* Add "Options" support for Doodads: these allow for individual Actor instances
on your level to customize properties about the doodad. They're like "Tags"
except the player can customize them on a per-actor basis.
* Doodad Editor: you can specify the Options in the Doodad Properties window.
* Level Editor: when the Actor Tool is selected, on mouse-over of an actor,
clicking on the gear icon will open a new "Actor Properties" window which
shows metadata (title, author, ID, position) and an Options tab to configure
the actor's options.
Updates to the scripting API:
* Self.Options() returns a list of option names defined on the Doodad.
* Self.GetOption(name) returns the value for the named option, or nil if
neither the actor nor its doodad have the option defined. The return type
will be correctly a string, boolean or integer type.
Updates to the doodad command-line tool:
* `doodad show` will print the Options on a .doodad file and, when showing a
.level file with --actors, prints any customized Options with the actors.
* `doodad edit-doodad` adds a --option parameter to define options.
Options added to the game's built-in doodads:
* Warp Doors: "locked (exit only)" will make it so the door can not be opened
by the player, giving the "locked" message (as if it had no linked door),
but the player may still exit from the door if sent by another warp door.
* Electric Door & Electric Trapdoor: "opened" can make the door be opened by
default when the level begins instead of closed. A switch or a button that
removes power will close the door as normal.
* Colored Doors & Small Key Door: "unlocked" will make the door unlocked at
level start, not requiring a key to open it.
* Colored Keys & Small Key: "has gravity" will make the key subject to gravity
and set its Mobile flag so that if it falls onto a button, it will activate.
* Gemstones: they had gravity by default; you can now uncheck "has gravity" to
remove their Gravity and IsMobile status.
* Gemstone Totems: "has gemstone" will set the totem to its unlocked status by
default with the gemstone inserted. No power signal will be emitted; it is
cosmetic only.
* Fire Region: "name" can let you set a name for the fire region similarly to
names for fire pixels: "Watch out for ${name}!"
* Invisible Warp Door: "locked (exit only)" added as well.
2022-10-10 00:41:24 +00:00
|
|
|
|
|
|
|
// Size of the DoodadButtons on actor canvas mouseover.
|
|
|
|
UICanvasDoodadButtonSize = 16
|
|
|
|
|
|
|
|
// Threshold for "very small doodad" where the buttons take up too big a proportion
|
|
|
|
// and the doodad can't drag/drop easily.. tiny doodads will show the DoodadButtons
|
|
|
|
// 50% off the top/right edge.
|
|
|
|
UICanvasDoodadButtonSpaceNeeded = 20
|
2018-10-20 22:42:49 +00:00
|
|
|
)
|