Generic Diablo 2 clone game engine.
Diablo 2 is arguably one of the best action RPG created ever. This is humble attempt to recreate and, hopefully, deconstruct it using Common Lisp programming language and related techniques.
Features
- Support for Tiled map format.
- Support for Aseprite sprite format.
- Support for CastleDB database format.
- Performant Entity-Component-System implementation supporting parent-child entitiy relationships.
- Prefab subsystem allowing creation of new components using predefined file-backed template.
- Simple yet powerful events subsystem.
- Full-blown game character subsystem.
- Simple actions subsystem, providing building blocks for complex character behaviour.
- Basic game session utilities.
- 2D renderer with functional interface.
- Sprite batching subsystem.
- Simple DSL for creating GUI windows by Nuklear library.
- Naïve implementation of A* pathfinding algorithm.
- Powerful debugging facilities, including entity tree dumping and visual debugging.
- Loading assets from zip files.
- Simple yet versatile configuration subsystem.
- Logging subsystem.
Installation
d2clone-kit requires liballegro to function. To install liballegro, refer to your distribution's package manager; for instance, on Debian derivatives (including Ubuntu and Mint):
sudo apt-get install liballegro-acodec5.2 liballegro-audio5.2 \
liballegro-image5.2 liballegro-dialog5.2 liballegro-ttf5.2 \
liballegro-physfs5.2 liballegro-video5.2
Currently the following Common Lisp implementations are tested and supported by d2clone-kit:
You can run it on x86_64 Linux, macOS, and Windows, while SBCL on Linux is the recommended platform.
To install d2clone-kit, clone the repository to your Quicklisp's local-projects
directory (assuming you have Quicklisp installed):
$ git clone https://gitlab.com/lockie/d2clone-kit \
~/quicklisp/local-projects/d2clone-kit
$ sbcl --quit --eval \
"(progn (ql:register-local-projects) (ql:quickload :d2clone-kit))"
Glossary
- action - abstraction of a multi-frame action performed by an entity. Unless stated otherwise, action is represented with its global index.
- isometric coordinates - coordinates in isometric projection.
- orthogonal coordinates - floating point in-game world coordinates. One unit of length corresponds to one map tile width, typically 64 pixels.
- prefab - system-specific object loaded from file and used as a template to create new instances of system's component.
- screen coordinates - integer screen pixel coordinates.
- viewport coordinates - screen pixel coordinates relative to the current camera position.
Legal
d2clone-kit is licensed under the GNU GPL license version 3. See LICENSE.
Diablo® II - Copyright © 2000 Blizzard Entertainment, Inc. All rights reserved. Diablo and Blizzard Entertainment are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.
d2clone-kit and any of its maintainers are in no way associated with or endorsed by Blizzard Entertainment®.
System Information
Definition Index
-
D2CLONE-KIT
- D2C
Generic Diablo 2 clone game engine.
-
EXTERNAL CONSTANT +INVALID-ENTITY+
The invalid entity.
-
EXTERNAL CONSTANT +INVALID-INDEX+
Invalid index marker for SPARSE-ARRAY-INDEX.
-
EXTERNAL CONSTANT +ITEM-PICKUP-RANGE+
Maximum distance at which character could pick up an item.
-
EXTERNAL CONSTANT +TABLE-INDICES+
Specifies the columns to be included in indices for data tables. It is assumed that the columns list is alphabetically sorted.
-
EXTERNAL GLOBAL *DATA-TABLES*
Global data tables read from CastleDB resource files.
-
EXTERNAL GLOBAL *DELTA-TIME*
Delta time between current frame and the previous one, in seconds.
-
EXTERNAL CLASS BINARY-STREAM
Wrapper around liballegro file APIs.
-
EXTERNAL CLASS CHARACTER-STREAM
Wrapper around liballegro file APIs.
-
EXTERNAL CLASS VIRTUAL-BINARY-STREAM
Read-only binary Gray stream based on SIMPLE-ARRAY of UNSIGNED-BYTE.
-
EXTERNAL STRUCTURE ALLEGRO-EVENT
Event class representing low-level liballegro event.
-
EXTERNAL STRUCTURE CAMERA-SYSTEM
Handles camera entity.
-
EXTERNAL STRUCTURE CHARACTER-MOVED
Event class issued when a character is about to move.
-
EXTERNAL STRUCTURE CHARACTER-SYSTEM
Handles sprites that are able to walk and collide with obstacles.
-
EXTERNAL STRUCTURE COLLISION-SYSTEM
Handles object collisions.
To make tile collide (e.g. be non-walkable by characters), set custom boolean property collides to true in Tiled tileset.
-
EXTERNAL STRUCTURE COMBAT-SYSTEM
Handles close combat.
-
EXTERNAL STRUCTURE COMPONENT-CREATED
Event class issued when a new component is created.
-
EXTERNAL STRUCTURE COORDINATE-SYSTEM
Stores orthogonal world coordinates.
-
EXTERNAL STRUCTURE CREDITS-SYSTEM
Handles credits screen.
-
EXTERNAL STRUCTURE DEBUG-SYSTEM
Handles drawing of various debug information.
-
EXTERNAL STRUCTURE ENTITY-DELETED
Event class issued when an entity is about to be deleted.
-
EXTERNAL STRUCTURE ENTITY-DIED
Event class issued when entity's HP reaches zero.
-
EXTERNAL STRUCTURE EVENT
Base event structure.
-
EXTERNAL STRUCTURE GROWABLE-VECTOR
A simple vector of dynamic size.
-
EXTERNAL STRUCTURE HP-SYSTEM
Handles hit points.
-
EXTERNAL STRUCTURE ITEM-SYSTEM
Handles items.
-
EXTERNAL STRUCTURE MANA-SYSTEM
Handles mana points.
-
EXTERNAL STRUCTURE MAP-SYSTEM
Handles map chunks in Tiled format.
The following format features are unsupported yet:
- maps made in Tiled < v0.15
- tile flipping
- external tileset files
- non-staggered maps
- stagger axis other than Y
- odd tile size
Also only integer map coordinates allowed for map chunks, otherwise the screen <-> map conversion maths are badly fucked up.
-
EXTERNAL STRUCTURE MENU-SYSTEM
Handles main menu.
-
EXTERNAL STRUCTURE MOB-SYSTEM
Handles mobs.
-
EXTERNAL STRUCTURE PLAYER-SYSTEM
Handles player character.
-
EXTERNAL STRUCTURE PRIORITY-QUEUE
A simple priority queue with DOUBLE-FLOAT priorities.
-
EXTERNAL STRUCTURE SOUND-SYSTEM
Handles sounds.
-
EXTERNAL STRUCTURE SPARSE-ARRAY-INDEX
A sparse array index shared between several growable vectors.
-
EXTERNAL STRUCTURE SPARSE-MATRIX
A high-watermark sparse matrix, implemented as a dictionary of keys.
-
EXTERNAL STRUCTURE SPRITE-BATCH-SYSTEM
Handles ordered sprite batches.
-
EXTERNAL STRUCTURE SPRITE-STANCE-CHANGED
Event class issued when sprite stance is changed.
-
EXTERNAL STRUCTURE SPRITE-SYSTEM
Handles movable sprites in Aseprite format.
The following format features are unsupported yet:
- color modes other than RGBA
- group layers
- layer blend modes
- linked cels
-
EXTERNAL STRUCTURE SYSTEM
Base structure for all ECS systems.
-
EXTERNAL STRUCTURE UI-SYSTEM
Handles UI windows.
-
EXTERNAL TYPE-DEFINITION ANGLE
Angle value in radians.
-
EXTERNAL FUNCTION A*
- START-X
- START-Y
- GOAL-X
- GOAL-Y
Runs A* algorithm to find path from point START-X, START-Y to GOAL-X, GOAL-Y. Returns simple array containing conses of x and y path node world coordinates.
Note: if goal point is not walkable, this function will stuck.
-
EXTERNAL FUNCTION ABSOLUTE->VIEWPORT
- X
- Y
Converts given integer absolute screen coordinates to viewport coordinates.
-
EXTERNAL FUNCTION ACTION-CHILD
- ACTION
Returns ACTION's child action.
-
EXTERNAL FUNCTION ACTION-ENTITY
- ACTION
Returns the entity ACTION belongs to.
-
EXTERNAL FUNCTION ACTION-PARENT
- ACTION
Returns ACTION's parent action.
-
EXTERNAL FUNCTION ACTION-PRINT
- ACTION
- &OPTIONAL
- STREAM
Prints human-readable representation of ACTION to STREAM.
-
EXTERNAL FUNCTION ACTION-TYPE
- ACTION
Returns keyword designating ACTION type.
-
EXTERNAL FUNCTION ACTIONS-LENGTH
Returns the total current count of actions.
-
EXTERNAL FUNCTION ADD-DEBUG-POINT
- ENTITY
- X
- Y
- R
- G
- B
- &OPTIONAL
- A
Adds point with screen coordinates X, Y and color R, G, B, A to debug buffer ENTITY.
-
EXTERNAL FUNCTION ADD-DEBUG-RECTANGLE
- ENTITY
- X
- Y
- W
- H
- COLOR
Adds rectangle with screen coordinates X, Y, dimensions W, H and color COLOR to debug buffer ENTITY.
-
EXTERNAL FUNCTION ADD-DEBUG-TEXT
- DESIGNATOR
- TEXT
- &REST
- ARGS
Adds debug text TEXT using FORMAT-like arguments ARGS to display on top left corner of the screen. To identify same text line each frame, set keyword DESIGNATOR to same value.
-
EXTERNAL FUNCTION ADD-DEBUG-TILE-RHOMB
- ENTITY
- X
- Y
- COLOR
- MARK
Adds grid rhomb with screen coordinates X, Y and color COLOR to debug buffer ENTITY. If MARK is T, then rhomb is drawn crossed out.
-
EXTERNAL FUNCTION ADD-SPRITE-INDEX-TO-BATCH
- ENTITY
- ORDER
- INDEX
- SCREEN-X
- SCREEN-Y
Adds sprite to sprite batch ENTITY using order ORDER, sprite index INDEX and screen coordinates SCREEN-X, SCREEN-Y.
-
EXTERNAL FUNCTION ADD-SPRITE-TO-BATCH
- ENTITY
- ORDER
- IMAGE-X
- IMAGE-Y
- SCREEN-X
- SCREEN-Y
Adds sprite to sprite batch ENTITY using order ORDER, sprite coordinates IMAGE-X, IMAGE-Y and screen coordinates SCREEN-X, SCREEN-Y.
-
EXTERNAL FUNCTION ATTACK
- ATTACKER-ENTITY
- TARGET-ENTITY
Initiates a close combat attack of TARGET-ENTITY by ATTACKER-ENTITY.
-
EXTERNAL FUNCTION BUILD-DATA-TABLES
- DATA
- TABLE-INDICES
Builds data table indices for given DATA and TABLE-INDICES
See +TABLE-INDICES+
-
EXTERNAL FUNCTION CAMERA-ENTITY
Returns current camera entity.
-
EXTERNAL FUNCTION CAMERA-TARGET
Returns current camera target, i.e. the entity camera tracks.
-
EXTERNAL FUNCTION (SETF CAMERA-TARGET)
- TARGET
Sets current camera target, i.e. the entity camera tracks. Set to NIL to stop camera tracking.
-
EXTERNAL FUNCTION CHARACTER-AT
- X
- Y
Returns character entity at integer map coordinates X, Y or NIL if there's no character there.
-
EXTERNAL FUNCTION COLLIDESP
- X
- Y
- &KEY
- CHARACTER
Returns whether tile located at integer map coordinates X, Y does collide with other objects. CHARACTER, when non-NIL, specifies character entity to check for collisions with other characters.
-
EXTERNAL FUNCTION CREDITS-SCREEN
Returns credits screen UI entity.
-
EXTERNAL FUNCTION CURRENT-ACTION
- ENTITY
Returns current action for ENTITY.
-
EXTERNAL FUNCTION (SETF CURRENT-ACTION)
- ACTION
- ENTITY
Sets ACTION to be current action for ENTITY.
-
EXTERNAL FUNCTION CURRENT-ACTION-OF
- ENTITY
- &KEY
- IS
Returns whether current action of ENTITY has the type IS.
-
EXTERNAL FUNCTION DEADP
- ENTITY
Returns T when ENTITY is dead.
-
EXTERNAL FUNCTION DELETE-ACTION
- ACTION
Deletes ACTION from further processing.
-
EXTERNAL FUNCTION DELETE-CHILD
- PARENT
- CHILD
Deletes relationship between PARENT and CHILD.
See MAKE-ENTITY
-
EXTERNAL FUNCTION DELETE-ENTITY
- ENTITY
Deletes entity ENTITY. Do NOT call this when entity has parent (call DELETE-CHILD first).
See MAKE-ENTITY
See DELETE-CHILD -
EXTERNAL FUNCTION DELETE-ENTITY-ACTIONS
- ENTITY
Deletes all actions of ENTITY.
-
EXTERNAL FUNCTION DEMO
Runs built-in engine demo.
-
EXTERNAL FUNCTION DO-DRAW
- RENDERER
Calls renderer functions scheduled within renderer instance RENDERER in accordance with their respective Z order values.
See MAKE-RENDERER
See RENDER -
EXTERNAL FUNCTION DRAW-ITEM-TEXT
- ITEM-ENTITY
- RENDERER
Draws a text above an item for ITEM-ENTITY with RENDERER.
-
EXTERNAL FUNCTION DRAW-MOB-HEALTH-BAR
- ENTITY
- RENDERER
Draws mob's health bar for the mob ENTITY with RENDERER.
-
EXTERNAL FUNCTION DROP-ITEM
- OWNER-ENTITY
- ITEM
Makes an OWNER-ENTITY drop an item corresponding to keyword ITEM.
-
EXTERNAL FUNCTION DUMP-ENTITIES
- ROOT
- &OPTIONAL
- STREAM
- OFFSET
Dumps entities tree starting from ROOT node to the STREAM.
-
EXTERNAL FUNCTION ENSURE-LOADED
- LOAD-FN
- FILE-NAME
- &REST
- REST
Calls LOAD-FN (which could be #'AL:LOAD-BITMAP, #'AL:LOAD-SAMPLE or similar) with the FILE-NAME argument and REST arguments, if any. If the result of calling of LOAD-FN is null pointer, then the error is raised. Otherwise, it is returned.
-
EXTERNAL FUNCTION ENTITY-VALID-P
- ENTITY
Return T if entity is valid.
-
EXTERNAL FUNCTION EQUIPPED-WEAPON
- ENTITY
Returns keyword corresponding to ENTITY's currently equipped weapon.
-
EXTERNAL FUNCTION EQUIPPED-WEAPON-CLASS
- ENTITY
Returns keyword corresponding to weapon class of ENTITY's currently equipped weapon.
-
EXTERNAL FUNCTION EXIT
Issues liballegro's :DISPLAY-CLOSE event.
-
EXTERNAL FUNCTION FACE-TARGET
- CHARACTER-X
- CHARACTER-Y
- TARGET-X
- TARGET-Y
Returns the angle that the character at CHARACTER-X, CHARACTER-Y should be facing to look at point TARGET-X, TARGET-Y.
-
EXTERNAL FUNCTION FINALIZE-ACTIONS
Finalizes actions subsystem.
-
EXTERNAL FUNCTION FRAME-FINISHED-P
- ENTITY
Returns generalized boolean indicating whether current animation frame of ENTITY is finished and should be switched to the next one. If the latter is the case, return the double float representing the amount of time during which it was.
-
EXTERNAL FUNCTION FRAME-PROPERTY
- ENTITY
- PROPERTY-NAME
- &KEY
- LAYER
Returns current frame's property called PROPERTY-NAME of a sprite component of ENTITY within the LAYER (or the default layer, if not specified). Retruns NIL if no such property exists.
-
EXTERNAL FUNCTION GAME-LOOP
- EVENT-QUEUE
- &KEY
- REPL-UPDATE-INTERVAL
Runs game loop.
-
EXTERNAL FUNCTION GAME-STARTED-P
Returns boolean indicating whether the game session is currently running.
-
EXTERNAL FUNCTION GROUND-LAYER-P
- LAYER
Returns T if map chunk layer LAYER is ground layer (i.e. has "ground" property).
-
EXTERNAL FUNCTION GROWABLE-VECTOR-ADD
- GROWABLE-VECTOR
- VECTOR
Appends contents of given VECTOR to the end of GROWABLE-VECTOR.
-
EXTERNAL FUNCTION GROWABLE-VECTOR-CLEAR
- GROWABLE-VECTOR
Removes all elements from GROWABLE-VECTOR.
-
EXTERNAL FUNCTION GROWABLE-VECTOR-EMPTYP
- GROWABLE-VECTOR
Returns T if GROWABLE-VECTOR is empty.
-
EXTERNAL FUNCTION GROWABLE-VECTOR-FREEZE
- GROWABLE-VECTOR
- &KEY
- ELEMENT-TYPE
Creates SIMPLE-ARRAY of ELEMENT-TYPE holding the same elements that GROWABLE-VECTOR holds.
-
EXTERNAL FUNCTION GROWABLE-VECTOR-GROW
- GROWABLE-VECTOR
- NEW-ALLOCATED-SIZE
Adjusts GROWABLE-VECTOR to have allocated size of NEW-ALLOCATED-SIZE.
-
EXTERNAL FUNCTION GROWABLE-VECTOR-LENGTH
- GROWABLE-VECTOR
Returns GROWABLE-VECTOR length (i.e. current actual element count).
-
EXTERNAL FUNCTION GROWABLE-VECTOR-POP
- GROWABLE-VECTOR
- &OPTIONAL
- INDEX
Removes and returns element with INDEX from GROWABLE-VECTOR. If INDEX is not given, removes and returns last element.
-
EXTERNAL FUNCTION GROWABLE-VECTOR-PUSH
- GROWABLE-VECTOR
- VALUE
Appends VALUE to the end of GROWABLE-VECTOR.
-
EXTERNAL FUNCTION GROWABLE-VECTOR-REF
- GROWABLE-VECTOR
- INDEX
Access GROWABLE-VECTOR by INDEX.
-
EXTERNAL FUNCTION (SETF GROWABLE-VECTOR-REF)
- VALUE
- GROWABLE-VECTOR
- INDEX
Access GROWABLE-VECTOR by INDEX with no bounds checking whatsoever.
-
EXTERNAL FUNCTION (SETF GROWABLE-VECTOR-REF*)
- VALUE
- GROWABLE-VECTOR
- INDEX
Access GROWABLE-VECTOR by INDEX, growing if necessary (when index is greater than current allocated size).
-
EXTERNAL FUNCTION HAS-ACTION-P
- ENTITY
- TYPE
Returns generalized boolean indicating whether action chain of ENTITY contains action with TYPE. If it does, the return value is that action.
-
EXTERNAL FUNCTION HAS-COMPONENT-P
- SYSTEM
- ENTITY
Returns T when ENTITY has the SYSTEM's component in it.
-
EXTERNAL FUNCTION INDEX-VALID-P
- INDEX
Return T if index is valid.
See +INVALID-INDEX+
-
EXTERNAL FUNCTION INITIALIZE-SYSTEMS
Initializes defined ECS systems in specified order.
See DEFSYSTEM
-
EXTERNAL FUNCTION ISOMETRIC->ORTHOGONAL
- X
- Y
Translates isometric coordinates X, Y into ortogonal coordinates.
-
EXTERNAL FUNCTION ISOMETRIC->ORTHOGONAL*
- X
- Y
Translates isometric coordinates X, Y into orthogonal coordinates, taking tile staggering into account.
-
EXTERNAL FUNCTION ISOMETRIC->SCREEN
- X
- Y
Translates isometric coordinates X, Y into screen coordinates.
-
EXTERNAL FUNCTION ISOMETRIC->SCREEN*
- X
- Y
Translates isometric coordinates X, Y into screen coordinates, taking tile staggering into account.
-
EXTERNAL FUNCTION ITEM-AT
- X
- Y
Returns item entity at integer map coordinates X, Y or NIL if there's no character there.
-
EXTERNAL FUNCTION LAYER-PROPERTY
- ENTITY
- PROPERTY-NAME
- &KEY
- LAYER
Returns LAYER's property called PROPERTY-NAME of a sprite component of ENTITY. Returns NIL of no such property exists.
-
EXTERNAL FUNCTION LOG-DEBUG
- MESSAGE
- &REST
- ARGS
Adds formatted message MESSAGE using placeholder arguments ARGS to liballegro debug channel.
-
EXTERNAL FUNCTION LOG-ERROR
- MESSAGE
- &REST
- ARGS
Adds formatted message MESSAGE using placeholder arguments ARGS to liballegro error channel.
-
EXTERNAL FUNCTION LOG-INFO
- MESSAGE
- &REST
- ARGS
Adds formatted message MESSAGE using placeholder arguments ARGS to liballegro info channel.
-
EXTERNAL FUNCTION LOG-WARN
- MESSAGE
- &REST
- ARGS
Adds formatted message MESSAGE using placeholder arguments ARGS to liballegro warn channel.
-
EXTERNAL FUNCTION MAIN-MENU
Returns main menu UI entity.
-
EXTERNAL FUNCTION MAKE-BUTTON-PRESS-SOUND
- ENTITY
Adds button press sound component to ENTITY.
-
EXTERNAL FUNCTION MAKE-ENTITY
- &OPTIONAL
- PARENT
Allocates new entity. When PARENT is set, deleting parent entity automatically deletes it.
See DELETE-ENTITY
-
EXTERNAL FUNCTION MAKE-GROWABLE-VECTOR
- &KEY
- INITIAL-ELEMENT
- INITIAL-ALLOCATED-SIZE
Creates new growable vector with initial allocated size INITIAL-ALLOCATED-SIZE (1 by default) and initial element INITIAL-ELEMENT (NIL by default).
-
EXTERNAL FUNCTION MAKE-ITEM-PICKUP-ACTION
- ENTITY
- &KEY
- PARENT
- TARGET
Creates and returns a new item pickup action belonging to ENTITY with PARENT action and other keyword arguments corresponding to action slots.
-
EXTERNAL FUNCTION MAKE-OBJECT
- SPEC
- &OPTIONAL
- PARENT
Creates a new game object following specification SPEC structured as follows:
'((:system-name1 :component-parameter1 "value1" :component-parameter2 2.0) (:system-name2 :prefab :prefab-name) ;; ... )
The components are initialized in the order specified by system's order.
See SYSTEM-ORDER
-
EXTERNAL FUNCTION MAKE-PRIORITY-QUEUE
- KEY-FN
Creates priority queue using key extraction function KEY-FN.
Note: keys are expected to be DOUBLE-FLOATs.
-
EXTERNAL FUNCTION MAKE-RENDERER
-
EXTERNAL FUNCTION MAKE-SPARSE-ARRAY-INDEX
- &KEY
- INITIAL-ALLOCATED-SIZE
Creates new sparse array index.
-
EXTERNAL FUNCTION MAKE-SPARSE-MATRIX
Creates new sparse matrix.
-
EXTERNAL FUNCTION MOUSE-POSITION
- &OPTIONAL
- EVENT
Get current mouse cursor coordinates using liballegro mouse event EVENT or by calling al_get_mouse_state .
-
EXTERNAL FUNCTION MOVE
- ENTITY
- NEW-TARGET-X
- NEW-TARGET-Y
Sets character ENTITY new movement target to NEW-TARGET-X, NEW-TARGET-Y.
-
EXTERNAL FUNCTION NEW-GAME
Starts new game.
-
EXTERNAL FUNCTION ORTHOGONAL->ISOMETRIC
- X
- Y
Translates orthogonal coordinates X, Y into isometric coordinates.
-
EXTERNAL FUNCTION ORTHOGONAL->SCREEN
- X
- Y
Translates orthogonal coordinates X, Y into screen coordinates.
-
EXTERNAL FUNCTION PACKAGE-VERSION
- FORMAT
- PACKAGE
Returns the PACKAGE version from asdf formatted according to FORMAT. If the package does not exist, then retuns NIL.
-
EXTERNAL FUNCTION PICKUP-ITEM
- ITEM-ENTITY
Does an actual picking up of ITEM-ENTITY by player.
-
EXTERNAL FUNCTION PLAYER-ENTITY
Returns current player entity.
-
EXTERNAL FUNCTION PRIORITY-QUEUE-CLEAR
- QUEUE
Clears priority queue QUEUE.
-
EXTERNAL FUNCTION PRIORITY-QUEUE-FIND
- QUEUE
- ELEMENT
Finds ELEMENT's position in QUEUE. Returns NIL if there's no such element. O(log N) complexity.
-
EXTERNAL FUNCTION PRIORITY-QUEUE-POP
- QUEUE
Removes and returns the first (priority-wise) element in QUEUE.
-
EXTERNAL FUNCTION PRIORITY-QUEUE-PUSH
- QUEUE
- ELEMENT
Adds element ELEMENT to priority queue QUEUE.
-
EXTERNAL FUNCTION PRIORITY-QUEUE-PUSH-MANY
- QUEUE
- ELEMENTS
Adds elements from vector ELEMENTS to priority queue QUEUE.
A bit more performance-friendly than calling PRIORITY-QUEUE-PUSH many times (but complexity is still O(N log N)).
-
EXTERNAL FUNCTION PRIORITY-QUEUE-REMOVE
- QUEUE
- INDEX
Removes element from QUEUE denoted by INDEX.
-
EXTERNAL FUNCTION PRIORITY-QUEUE-TRAVERSE
- QUEUE
- FN
Calls one argument function FN on elements of priority queue QUEUE in appropriate order.
-
EXTERNAL FUNCTION PROCESS-ACTIONS
Processes all actions.
-
EXTERNAL FUNCTION PROCESS-EVENTS
Processes events collected in event queue by systems.
-
EXTERNAL FUNCTION RANGE-VISIBLE-P
- X
- Y
- WIDTH
- HEIGHT
Returns T if any part of rectangular range defined by given viewport coordinates and dimensions is visible on screen.
-
EXTERNAL FUNCTION READ-FILE-INTO-LIST
- PATHNAME
Reads text file specified by PATHNAME into a list line-by-line. Lines are expected to be shorter than 4k chars.
-
EXTERNAL FUNCTION RENDER
- RENDERER
- Z-ORDER
- RENDER-PROC
Schedules function RENDER-PROC to be called in accordance with specified Z-ORDER within renderer instance RENDERER.
See MAKE-RENDERER
See DO-DRAW -
EXTERNAL FUNCTION SCREEN->ISOMETRIC*
- X
- Y
Translates screen coordinates X, Y into isometric coordinates, taking tile staggering into account.
-
EXTERNAL FUNCTION SCREEN->ORTHOGONAL*
- X
- Y
Translates screen coordinates X, Y into orthogonal coordinates, taking tile staggering into account.
-
EXTERNAL FUNCTION SET-HP
- ENTITY
- NEW-HP
Sets current hit points of ENTITY to NEW-HP.
-
EXTERNAL FUNCTION SPARSE-ARRAY-INDEX-DELETE
- SPARSE-ARRAY-INDEX
- SUBSCRIPT
Marks element denoted by SUBSCRIPT as deleted in SPARSE-ARRAY-INDEX.
-
EXTERNAL FUNCTION SPARSE-ARRAY-INDEX-GROW
- SPARSE-ARRAY-INDEX
- NEW-ALLOCATED-SIZE
Adjusts SPARSE-ARRAY-INDEX to have allocated size of NEW-ALLOCATED-SIZE.
-
EXTERNAL FUNCTION SPARSE-ARRAY-INDEX-PUSH
- SPARSE-ARRAY-INDEX
- SUBSCRIPT
Appends new element denoted by SUBSCRIPT to the end of SPARSE-ARRAY-INDEX.
-
EXTERNAL FUNCTION SPARSE-ARRAY-INDEX-REF
- SPARSE-ARRAY-INDEX
- SUBSCRIPT
Access SPARSE-ARRAY-INDEX by SUBSCRIPT.
-
EXTERNAL FUNCTION SPARSE-MATRIX-CLEAR
- SPARSE-MATRIX
Removes all elements from SPARSE-MATRIX.
-
EXTERNAL FUNCTION SPARSE-MATRIX-REF
- SPARSE-MATRIX
- SUBSCRIPTS
Returns SPARSE-MATRIX element identified by list SUBSCRIPTS or NIL if there's no such element.
-
EXTERNAL FUNCTION (SETF SPARSE-MATRIX-REF)
- VALUE
- SPARSE-MATRIX
- SUBSCRIPTS
Sets SPARSE-MATRIX element identified by list SUBSCRIPTS to VALUE. To remove an element from sparse matrix, use SPARSE-MATRIX-REMOVE.
-
EXTERNAL FUNCTION SPARSE-MATRIX-REMOVE
- SPARSE-MATRIX
- SUBSCRIPTS
Removes element identified by list SUBSCRIPTS from SPARSE-MATRIX. Returns number of deleted elements or NIL if there's no such element in matrix.
-
EXTERNAL FUNCTION SPARSE-MATRIX-TRAVERSE
- SPARSE-MATRIX
- FN
Calls two argument function FN on elements of SPARSE-MATRIX in unpsecified order. First argument to FN is subscript, second is the element itself.
-
EXTERNAL FUNCTION SPRITE-DIRECTION
- DIRECTIONS
- ANGLE
Calculates sprite direction from angle value ANGLE assuming total sprite direction count DIRECTIONS. East direction is 0 degree angle; counted clockwise.
-
EXTERNAL FUNCTION STANCE-FINISHED-P
- ENTITY
Returns whether current stance of animation of ENTITY is played through.
-
EXTERNAL FUNCTION STANCE-INTERRUPTIBLE-P
- ENTITY
Returns whether current stance can be interrupted for ENTITY.
-
EXTERNAL FUNCTION START-ENGINE
- GAME-NAME
- NEW-GAME-OBJECT-SPECS
- TABLE-INDICES
- &REST
- CONFIG
Initializes and starts engine to run the game named by GAME-NAME. NEW-GAME-OBJECT-SPECS is list of game object specifications to be created when the new game is started with MAKE-OBJECT. TABLE-INDICES, if non-nil, specifies the columns in indices to build from a data tables read from .cdb file with BUILD-DATA-TABLES. CONFIG plist is used to override variables read from config file.
See MAKE-OBJECT
See BUILD-DATA-TABLES -
EXTERNAL FUNCTION STREAM-SIZE
- STREAM
Returns the file size of BINARY-STREAM and CHARACTER-STREAM.
See BINARY-STREAM
See CHARACTER-STREAM -
EXTERNAL FUNCTION SWITCH-STANCE
- ENTITY
- NEW-STANCE
Immediately switches stance of the sprite ENTITY to NEW-STANCE unless it is already at that stance or the current stance is non-interruptible.
-
EXTERNAL FUNCTION SYSTEM-COMPONENTS
- INSTANCE
Storage for system components.
-
EXTERNAL FUNCTION (SETF SYSTEM-COMPONENTS)
- VALUE
- INSTANCE
No documentation provided. -
EXTERNAL FUNCTION SYSTEM-NAME
- INSTANCE
Symbol that denotes the system.
-
EXTERNAL FUNCTION (SETF SYSTEM-NAME)
- VALUE
- INSTANCE
No documentation provided. -
EXTERNAL FUNCTION SYSTEM-ORDER
- INSTANCE
Fixnum representing system's update order.
-
EXTERNAL FUNCTION (SETF SYSTEM-ORDER)
- VALUE
- INSTANCE
No documentation provided. -
EXTERNAL FUNCTION TABLE-VALUE-REF
- TABLE-DESIGNATOR
- PREDICATES
- &KEY
- DEFAULT
- COLUMN
References the data table designated by TABLE-DESIGNATOR by plist PREDICATES, returning either (1) the column value, if it is just a single column, (2) a plist of columns if there are multiple, or (3) DEFAULT, if no row corresponding to PREDICATES is found. COLUMN, if non-NIL, specifies the column to return in (2) case. This function assumes that the column names in PREDICATES are alphabetically sorted.
See TABLE-VALUE-REF*
-
EXTERNAL FUNCTION TABLE-VALUE-REF*
- TABLE-DESIGNATOR
- PREDICATES
- &KEY
- DEFAULT
- COLUMN
References the data table designated by TABLE-DESIGNATOR by plist PREDICATES, returning either (1) the column value, if it is just a single column, (2) a plist of columns if there are multiple, or (3) DEFAULT, if no row corresponding to PREDICATES is found. COLUMN, if non-NIL, specifies the column to return in (2) case. This function makes sure that the column names in PREDICATES are alphabetically sorted and therefore works slightly slower.
See TABLE-VALUE-REF
-
EXTERNAL FUNCTION TARGET-PLAYER
- &OPTIONAL
- MOUSE-EVENT
Set new player character target according to MOUSE-EVENT or current mouse cursor position.
-
EXTERNAL FUNCTION TILE-PROPERTY
- TILE-PROPERTIES
- INDEX
- PROPERTY
- &OPTIONAL
- DEFAULT
Returns property denoted by symbol PROPERTY of tile with index INDEX. Returns DEFAULT if there's no such property.
-
EXTERNAL FUNCTION TOGGLE-LAYER
- ENTITY
- LAYER
- &OPTIONAL
- ON
Toggles layer LAYER on sprite entity ENTITY.
-
EXTERNAL FUNCTION TOGGLE-UI
- ENTITY
- &OPTIONAL
- ON
Toogles UI window corresponding to ENTITY ON; flushes internal UI event queue to prevent undesired side effects like processing the same event by different windows.
-
EXTERNAL FUNCTION UI-CONTEXT
Returns Nuklear GUI library's context.
-
EXTERNAL FUNCTION UI-FONT-LARGE
Returns large variation of UI font.
-
EXTERNAL FUNCTION UI-FONT-MEDIUM
Returns medium variation of UI font.
-
EXTERNAL FUNCTION UI-FONT-SMALL
Returns small variation of UI font.
-
EXTERNAL FUNCTION UI-ON-P
Returns boolean indicating whether any UI window is currenty shown.
-
EXTERNAL FUNCTION VIEWPORT->ABSOLUTE
- X
- Y
Converts given integer viewport coordinates to absolute screen coordinates.
-
EXTERNAL FUNCTION VISIBLEP
- X
- Y
- &OPTIONAL
- DELTA
Returns T if point with given viewport coordinates is visible on screeen.
-
EXTERNAL GENERIC-FUNCTION DELETE-COMPONENT
- SYSTEM
- ENTITY
Deletes SYSTEM's component from ENTITY.
-
EXTERNAL GENERIC-FUNCTION FINALIZE-ACTION
- TYPE
- INDEX
Finalizes action with given TYPE and global INDEX.
-
EXTERNAL GENERIC-FUNCTION INITIALIZE-ACTION
- TYPE
- INDEX
Initializes action with given TYPE and global INDEX.
-
EXTERNAL GENERIC-FUNCTION MAKE-COMPONENT
- SYSTEM
- ENTITY
- &REST
- PARAMETERS
Creates new component using PARAMETERS within system SYSTEM for entity ENTITY.
PARAMETERS could include
:PREFAB
key, in which case component is constructed using corresponding prefab. -
EXTERNAL GENERIC-FUNCTION MAKE-PREFAB
- SYSTEM
- PREFAB-NAME
Loads prefab with name symbol PREFAB-NAME within SYSTEM.
-
EXTERNAL GENERIC-FUNCTION MAKE-PREFAB-COMPONENT
- SYSTEM
- ENTITY
- PREFAB
- PARAMETERS
Creates new component using prefab instance PREFAB as a template and optional extra parameters PARAMETERS within SYSTEM for ENTITY.
-
EXTERNAL GENERIC-FUNCTION PREFAB
- SYSTEM
- PREFAB-NAME
Returns prefab with name symbol PREFAB-NAME within SYSTEM.
-
EXTERNAL GENERIC-FUNCTION (SETF PREFAB)
- NEW-PREFAB
- SYSTEM
- PREFAB-NAME
Sets prefab NEW-PREFAB with name symbol PREFAB-NAME within SYSTEM.
-
EXTERNAL GENERIC-FUNCTION PREFAB-PATH
- SYSTEM
- PREFAB-NAME
Returns prefab file path for SYSTEM and prefab name symbol PREFAB-NAME.
-
EXTERNAL GENERIC-FUNCTION PRELOAD-PREFABS
- SYSTEM
Loads all prefabs for SYSTEM to avoid in-game performance degradations.
-
EXTERNAL GENERIC-FUNCTION PROCESS-EVENT
- SYSTEM
- EVENT
Processes EVENT by SYSTEM.
-
EXTERNAL GENERIC-FUNCTION READ-BINARY
- TYPE
- STREAM
Reads and returns element of type denoted by TYPE from binary stream STREAM.
-
EXTERNAL GENERIC-FUNCTION SYSTEM-CREATE
- SYSTEM
Low-level method to properly initialize SYSTEM. Not meant to be redefined.
-
EXTERNAL GENERIC-FUNCTION SYSTEM-DRAW
- SYSTEM
- RENDERER
Renders system SYSTEM using functional renderer RENDERER.
See RENDER
-
EXTERNAL GENERIC-FUNCTION SYSTEM-FINALIZE
- SYSTEM
Performs SYSTEM finalization. Note: constructing components from prefabs is not permitted in the body of SYSTEM-FINALIZE.
-
EXTERNAL GENERIC-FUNCTION SYSTEM-INITIALIZE
- SYSTEM
Performs early SYSTEM initialization.
-
EXTERNAL GENERIC-FUNCTION SYSTEM-UPDATE
- SYSTEM
Updates system SYSTEM for time step DT (usually fixed by liballegro around 1/60 of second).
-
EXTERNAL MACRO DEFACTION
- NAME
- SLOTS
- &KEY
- DOCUMENTATION
- &BODY
- BODY
Defines an action named NAME with SLOTS and DOCUMENTATION. BODY should contain action's initializer and finalizer for the optimization of those to kick in.
See INITIALIZE-ACTION
See FINALIZE-ACTION -
EXTERNAL MACRO DEFCOMPONENT
- SYSTEM
- &OPTIONAL
- NAME
- &REST
- SLOTS
Defines component structure with NAME and SLOTS within SYSTEM.
-
EXTERNAL MACRO DEFEVENT
- NAME
- SLOTS
- &KEY
- DOCUMENTATION
Defines event class with NAME, SLOTS and DOCUMENTATION.
-
EXTERNAL MACRO DEFHANDLER
- SYSTEM
- EVENT
- &KEY
- FILTER
- &BODY
- BODY
Defines event handler in SYSTEM for event type EVENT. FILTER could be an expression checked to be T before running BODY.
-
EXTERNAL MACRO DEFINE-BINARY-STRUCT
- NAME
- &REST
- SLOTS
Defines structure with name NAME and slots SLOTS along with corresponding READ-BINARY method which reads and returns that structure from given binary stream.
See READ-BINARY
-
EXTERNAL MACRO DEFOPTIONS
- NAME
- &REST
- OPTIONS
Defines macro to access given group of options. E.g. when NAME is 'SYSTEM, it defines WITH-SYSTEM-CONFIG-OPTIONS macro. OPTIONS should be list of lists containing option's section name, option's name, and :TYPE and :DEFAULT properties.
-
EXTERNAL MACRO DEFPERFORMER
- ACTION
- BINDINGS
- &BODY
- BODY
Defines a performer function for ACTION symbol with BODY. BINDINGS is a list of names of action type slots, except for the first element, which is the name of global index of action being processed.
-
EXTERNAL MACRO DEFPREFAB
- SYSTEM
- EXTENSION
- &REST
- SLOTS
Defines prefab structure with slots SLOTS and file name EXTENSION within SYSTEM.
-
EXTERNAL MACRO DEFSYSTEM
- NAME
- SLOTS
- &KEY
- DOCUMENTATION
- ORDER
Defines an ECS system structure named NAME with SLOTS and docstring DOCUMENTATION, along with global system instance variable. ORDER is fixnum specifying the order for system initialization and WITH-SYTEMS macro.
See INITIALIZE-SYSTEMS
See WITH-SYSTEMS -
EXTERNAL MACRO DEFUNL
- FNAME
- LAMBDA-LIST
- &BODY
- BODY
DEFUN wrapper which sets correct current function name for logging functions.
-
EXTERNAL MACRO DO-SPARSE-ARRAY
- SUBSCRIPT
- INDEX
- SPARSE-ARRAY-INDEX
- &BODY
- BODY
Executes BODY several times with SUBSCRIPT and INDEX variables set to corresponding values in SPARSE-ARRAY-INDEX.
-
EXTERNAL MACRO ISSUE
- EVENT-CLASS
- &KEY
- ASYNC
- &REST
- ARGS
Shorthand macro to allow more convenient issuing of events. If ASYNC is NIL, process the event immediately.
-
EXTERNAL MACRO WITH-CAMERA
- BINDINGS
- &BODY
- BODY
Executes BODY with current camera position bound to two symbols in BIDNINGS list.
-
EXTERNAL MACRO WITH-CONDITION-REPORTER
- &BODY
- BODY
Executes BODY with generic error handler which puts full error condition info including backtrace to liballegro log and displays error messagebox when not in debugger.
-
EXTERNAL MACRO WITH-SCREEN-COORDINATE
- ENTITY
- BINDINGS
- &BODY
- BODY
Executes BODY with ENTITY's screen pixel coordinates bound to two symbols in BINDINGS list. If BINDINGS are not set, coordinates are bound to symbols X and Y.
-
EXTERNAL MACRO WITH-SYSTEM-CONFIG-OPTIONS
- OPTIONS
- &KEY
- READ-ONLY
- &BODY
- BODY
Executes BODY with bindings for config options OPTIONS. If READ-ONLY is T (the default), options are not SETF-able.
-
EXTERNAL MACRO WITH-SYSTEM-SLOTS
- SLOTS
- SYSTEM-TYPE
- &OPTIONAL
- SYSTEM-INSTANCE
- &KEY
- READ-ONLY
- &BODY
- BODY
Executes BODY with bindings for slots of a system specified by SYSTEM-TYPE. If SYSTEM-INSTANCE is NIL (the default), global system instance of type SYSTEM-TYPE is used. If READ-ONLY is T (the default), slots are not SETF-able.
-
EXTERNAL MACRO WITH-SYSTEMS
- VAR
- &BODY
- BODY
Executes BODY in loop for each system, binding system instance to variable VAR.