[−][src]Crate babalcore
Structs
FakeInput | A fake input used for tests, to simulate user inputs. |
InputJump | Used to handle jump input. This is to encapsulate all the nitty-picky logic about considering a button is still pressed a fraction of seconds after it has been pressed, etc. It does not actually poll and/or listens to the real hardware, it just keeps track of what's happening with push/pop operations. |
InputSteer | An object to tract steering, that is, going left, or going right. This does not actually poll/reacts to the physical controllers, it just collects "go right" or "go left" informations then aggregates and consolidates them. |
Level | Contains the level definition, where are slabs, and of what type. |
Player | |
PointsCounter | |
Row | |
Slab | |
TimeTracker |
Enums
PlayerEvent | Events which can be triggered by the player. |
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
ABSOLUTE_LENGTH_MAX | Indices for rows can not be bigger than this. It is insanely big though, at 100 slabs per sec, it represents 1 million seconds, which is more than 10 days of continuous play. |
BASE_KEYBOARD_ACC_VALUE | When first pressing a key, this value is put in the accumulator. This is to avoid waiting for the first repeat to actually do something. |
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. |
PLAYER_EVENT_FALL | |
PLAYER_EVENT_JUMP | |
PLAYER_EVENT_LAND | |
PLAYER_EVENT_START | |
SLIDING_LENGTH_MAX | History about one level will be kept only below this limit. Above it, the initial slabs will disappear. This should really not be a problem as for a complete restart, we can reinitialize with a seed, and otherwise it stills allows going back in time by 10k slabs, which means several minutes even 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 | A trait to abstract the input query interface, it is mostly used for testing the game logic without having real inputs. |
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. |