This engine was made by David Lee and Brickson Cain.
We designed the engine with the main goals being the simulation of 3d in a 2d engine, and joypad input. We thought that these would be fun to apply to different genres, with David wanting to make a platformer and Brickson wanting to make a Pole Position-style racing game.
The engine can draw circles, squares and lines, all taking their typical 2-dimensional inputs as well as depth inputs. As the depth value gets larger, the object is drawn smaller and smaller, and is positioned closer and closer to the center of the screen, mimicing a one-point perspective drawing. B_Racer (by Brickson Cain) currently demonstrates these features of the engine by drawing a background that mimics a road with lines moving toward the camera and a simple car, making it seem like the camera is following a car as it drives down the tunnel. There are now opponent cars as well, which move towards the horizon at different speeds depending on the speed of the player's car.
The engine supports input from keyboard and joystick. Keyboard can detect keys. Joystick can detect if a joystick is connected, if a button is pressed, and what the current axis position is.
Key 2D platformer features such as importing tile map, sprite sheet, animation, collision, detect area enter and text pringing is supported.
These are the games built using DBM Game Engine

draw_circle(long x, long y, lons z, long r, long R, long G, long B, long A)
Draw a circle centered at (x,y) at depth z with radius r in the window. It will have a color with RGB value, and its transparency will be decided by A.
Parameters
longx position
longy position
longz depth
longr radius
longR red
longG green
longB blue
longA alpha
Returns
Nothing
draw_rect(long x, long y, lons z, long w, long h, long R, long G, long B, long A)
Draw a rectangle centered at (x,y) at depth z with width w and height h in the window. It will have a color with RGB value, and its transparency will be decided by A.
Parameters
longx position
longy position
longz depth
longw widthlongh height
longR red
longG green
longB blue
longA alpha
Returns
Nothing
draw_line(long x1, long y1, lons z1, long x2, long y2, long z2, long R, long G, long B)
Draw a line from (x1,y1,z1) to (x2,y2,z2) in the window. It will have a color with RGB value.
Parameters
longx1 position
longy1 position
longz1 position
longx2 position
longy2 position
longz2 position
longR red
longG green
longB blue
Returns
Nothing
print(string font, string string, int x, int y, int size)
Print text at (x,y)
Parameters
fontpath to the font file
stringstring to print
xx coordinate to print
yy coordinate to print
sizesize of the text
Returns
Nothing
load_tilemap(string filename, string spriteName, int offsetX, int offsetY)
Import tilemap json file and spritesheet image from the pathfilenamandspriteNamerespectively. Apply offset ofoffsetXandoffsetY.
Parameters
filenamepath to the tilemap json file
spriteNamepath to the sprite sheet image file
offsetXoffset x
offsetYoffset y
Returns
Nothing
draw_map()
Draw loaded map and spritesheet.
Parameters
None
Returns
Nothing
is_colliding(int x, int y, int w, int h)
Check if thewwidth,hheight rectangular area with (x,y) top-left collides with any collidable tile of the map.
Parameters
xtop left x coordinate of the rectangular area to check (e.g, player.x)
ytop left y coordinate of the rectangular area to check (e.g, player.y)
wwidth of the rectangular area to check (e.g, player.w)
hheigh of the rectangular area to check (e.g, player.h)
Returns
Nothing
add_area2d(string name, int x, int y, int w, int h)
Create a 2D area with the given name. It is created to callis_in_area()Parameters
nameName of the area
xtop left x coordinate of the rectangular area
ytop left y coordinate of the rectangular area
wwidth of the area
hheigh of the area
Returns
Nothing
is_in_area(string name, int x, int y, int w, int h)
Returntrueif the rectangle that hasxandyas the top-left andwwidthhheight is in thename2d area.
Parameters
nameName of the area to check
xtop left x coordinate of the rectangle area to check. (e.g, player.x)
ytop left y coordinate of the rectangle area to check. (e.g, player.y)
wwidth of the area to check (e.g, player.h)
hheigh of the area to check (e.g, player.x)
Returns
Trueif is area,Falseif not.
draw_tile(int tile_id, int x, int y, int tileSize)
Draw a tile with index number oftile_idfrom the loaded sprite sheet at (x,y). This tile must have width and height oftileSize.
Parameters
tile_idIndex number of the tile to draw
xx coordinate to draw at
yy coordinate to draw at
tileSizewidth and height of the tile
Returns
Nothing.
draw_sprite_frame(string filename, string frame_index, int x, int y, int frame_w, int frame_h, int scale, int faceRight)
Draw a sprite with index number offrame_indexfrom spritesheetfilenameat (x,y). The sprite must have width offrame_wand height offrame_h. The sprite is scaled byscaletimes and flips vertically iffaceRightisFalse.
Parameters
filenamePath of the spritesheet to use
frame_indexindex number of the sprite to draw
xx coordinate to draw at (E.g, player.x)
yy coordinate to draw at (E.g, player.y)
frame_wwidth of the sprite
frame_hheight of the sprite
scalesprite is drawn this times bigger
faceRightflips if false
Returns
Nothing.
Tilemap is a json file that contains the information of the map with following structure:
{
"tileSize": 16,
"mapWidth": 38,
"mapHeight": 14,
"layers": [
{
"name": "Background",
"tiles": [
{
"id": "26",
"x": 0,
"y": 6
},
],
"collider": false
},
{
// more layers
}
]
}
isKeyPressed(string)
Check if a key is pressed.
Parameters
stringkey to check
Returns
true if the key is pressed, false otherwise
| Key | Description |
|---|---|
unknown |
Unhandled key. |
a ~ z |
The lowercase alphabet keys. |
num0 ~ num9 |
Number keys at the top of the keyboard. |
escape |
Escape key. |
lcontrol |
Left Control key. |
lshift |
Left Shift key. |
lalt |
Left Alt key. |
lsystem |
Left system key (e.g., Windows key). |
rcontrol |
Right Control key. |
rshift |
Right Shift key. |
ralt |
Right Alt key. |
rsystem |
Right system key. |
menu |
Menu key. |
lbracket |
Left square bracket [. |
rbracket |
Right square bracket ]. |
semicolon |
Semicolon ;. |
comma |
Comma ,. |
period |
Period .. |
quote |
Quote '. |
slash |
Slash /. |
backslash |
Backslash \. |
tilde |
Tilde ~. |
equal |
Equal sign =. |
hyphen |
Hyphen -. |
space |
Space bar. |
enter |
Enter/Return key. |
backspace |
Backspace key. |
tab |
Tab key. |
pageup |
Page Up key. |
pagedown |
Page Down key. |
end |
End key. |
home |
Home key. |
insert |
Insert key. |
delete |
Delete key. |
add |
Numpad +. |
subtract |
Numpad -. |
multiply |
Numpad *. |
divide |
Numpad /. |
left |
Left arrow key. |
right |
Right arrow key. |
up |
Up arrow key. |
down |
Down arrow key. |
numpad0 ~ numpad9 |
Number pad keys 0–9. |
f1 ~ f15 |
Function keys F1 to F15. |
pause |
Pause/Break key. |
isConnected(int)
Return if joystick is connected
Parameters
intIndex of the joystick to check
Returns
true if the joystick is connected, false otherwise
isButtonPressed(int, int)
Check if a joystick button is pressed.
If the joystick is not connected, this function returns false.
Parameters
intIndex of the joystick
intButton to check
Returns
true if the button is pressed, false otherwise
getAxisPosition(int, int)
Get the current position of a joystick axis.
If the joystick is not connected, this function returns 0.
Parameters
intIndex of the joystick
intAxis to check
Returns
urrent position of the axis, in range [-100 .. 100]