[][src]Crate babalcore

Structs

InputJump
InputSteer
Level
Player
Row
Slab
TimeTracker

Enums

Skill

Different skills.

SlabDef

Different defs of slabs (those rectangles the ball can roll on). A def is what defines a slab, it will be translated into a kind at runtime. Typically some defs can be "a random slab", or even "a slab that varies with time", etc.

SlabKind

Different kind of slabs (those rectangles the ball can roll on).

Constants

BASE_KEYBOARD_ACC_VALUE
DEFAULT_KEYBOARD_SENSIBILITY

Keyboard sensibility, one way to think of it is "how many pixels should be a corresponding mouse move, if it lasted 1 second". So moving the mouse of 1000 pixels in 1 second is equivalent to keeping a move arrow pressed for 1 second. Setting it to negative value will invert keyboard.

DEFAULT_MOUSE_SENSIBILITY

Default mouse sensibility, as this is an arbitrary unit, default is 1. Setting it to a negative value will invert mouse.

DEFAULT_STICKINESS_SECS_F64

By default, the stickiness is set to 1/10th of a second. This means that if player pushes a jump control less than 1/10th of a second before it can actually jump, the jump is still recorded as valid.

INTENSITY_MAX

Maximum intensity.

INTENSITY_MIN

Minimum intensity.

LENGTH_MAX

A maximum length, in theory this could be infinite, in practice I prefer a limit that triggers before player computer/phone runs out of memory. So 10k is already quite a lot, possibly about an hour of continuous play at high speed.

TIME_TRACKER_MAX_SEC

Maximum number of seconds we can track. This is related to the limit of a mantissa in 64-bit IEEE numbers, which is about 10^15. Since we count in msec, we have to divide to take away 3 digits. This is still several centuries.

WIDTH_MAX

A maximum width, most playable values should range from 6 to 12, so 32 is already a lot. To simplify/optimize code, program uses fixed size rows, set to the WIDTH_MAX. With slabs of 4 or 8 bytes, it means only 256 bytes (worst case) for a row. With this setting, a 10_000 rows level, playable for about an hour, at 3 slabs/sec still fits into 30Mb of memory.

Traits

InputQuery
LevelQuery

Functions

format_type_of

Return a string describing the type.

unwrap_now

Return the time contained in the option if it is defined. If not (None was passed) returns the result of an actual call to Instant::now(). This is useful for testing: in mainstream production code, just pass None, but for testing it is possible to pass fake instants.