Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dancemanUK authored Jun 30, 2024
0 parents commit d1eb73e
Show file tree
Hide file tree
Showing 68 changed files with 8,980 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: deepnight
35 changes: 35 additions & 0 deletions .github/workflows/test.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test JS build

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
build:

strategy:
matrix:
os: [windows-latest]
haxe: [4.3.3]
fail-fast: true
runs-on: windows-latest

steps:
# Checkout & install haxe
- uses: actions/checkout@v2
- uses: krdlab/setup-haxe@v1
with:
haxe-version: ${{ matrix.haxe }}
- run: haxe -version

# Install libs
- run: haxe setup.hxml
- run: haxelib list

# Try to build
- run: haxe build.js.hxml

8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
redist/
bin/
dump/
res/.tmp/
res/**/backups/

# VScode
.vscode/settings.json
66 changes: 66 additions & 0 deletions .vscode/commandbar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"skipTerminateQuickPick": true,
"skipSwitchToOutput": false,
"skipErrorMessage": true,
"commands": [
{
"text": "🍊 DX",
"color": "orange",
"commandType":"exec",
"command": "haxe build.directx.hxml",
"alignment": "right",
"skipTerminateQuickPick": false,
"priority": -9
},
{
"text": "🍊 OpenGL",
"color": "orange",
"commandType":"exec",
"command": "haxe build.opengl.hxml",
"alignment": "right",
"skipTerminateQuickPick": false,
"priority": -10
},
{
"text": "Run HL",
"color": "orange",
"command": "hl bin/client.hl",
"alignment": "right",
"skipTerminateQuickPick": false,
"priority": -11
},
{
"text": "☕ JS",
"color": "yellow",
"commandType":"exec",
"command": "haxe build.js.hxml",
"alignment": "right",
"skipTerminateQuickPick": false,
"priority": -20
},
{
"text": "Run JS",
"color": "yellow",
"command": "start run_js.html",
"alignment": "right",
"skipTerminateQuickPick": false,
"priority": -21
},
{
"text": "🅰️ Lang",
"color": "white",
"command": "haxe tools.langParser.hxml",
"alignment": "right",
"skipTerminateQuickPick": false,
"priority": -40
},
{
"text": "📦 Redist",
"color": "lightgreen",
"command": "haxelib run redistHelper build.directx.hxml build.opengl.hxml build.js.hxml -o redist -p GameBase -zip",
"alignment": "right",
"skipTerminateQuickPick": false,
"priority": -50
}
]
}
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "HL debug",
"request": "launch",
"type": "hl",
"cwd": "${workspaceRoot}",
"preLaunchTask": "HaxeActiveConf"
},
{
"name": "Chrome JS debug",
"request": "launch",
"type": "chrome",
"file": "${workspaceFolder}/run_js.html",
"preLaunchTask": "HaxeActiveConf"
}
]
}
25 changes: 25 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "HaxeActiveConf",
"type": "haxe",
"args": "active configuration",
"problemMatcher": [
"$haxe-absolute",
"$haxe",
"$haxe-error",
"$haxe-trace"
],
"presentation": {
"reveal": "never",
},
"group": {
"kind": "build",
"isDefault": true
},
},
]
}
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# GameBase changelog

## 2.0

- General:
- **The official gameBase version is now the former "advanced" branch version. The previous, more minimalistic version, is still available in the `legacy` branch.**
- **Debug Drone**: press `CTRL-SHIFT-D` to spawn a debug Drone. Use arrows to fly around and quickly explore your current level. You can also type `/drone` in console.
- Full **Controller** rework, to provide much better Gamepad support, bindings, combos, etc.
- Full **LDtk** integration (https://ldtk.io), with hot-reloading support.
- Added many comments everywhere.
- Moved all source code to various `src/` subfolders
- Moved all assets related classes to the `assets.*` package
- Added various debug commands to console. Open it up by typing `/`. Enter `/help` to list all available commands.
- Added `/fps` command to console to display FPS chart over time.
- Added `/ctrl` command to visualize and debug controller (keyboard or gamepad).
- Fixed various FPS values issues
- Better "active" level management, through `startLevel()` method
- Cleaned up Main class
- Renamed Main class to App
- Renamed Data class to CastleDb
- Replaced pixel perfect filters with a more optimized one (now using `Nothing` filter)
- Added many comments and docs everywhere
- Added XML doc generation for future proper doc
- Removed SWF target (see you space cowboy)
- Added this CHANGELOG ;)

- Entity:
- All entities now have a proper width/height and a pivotX/Y factor
- Separated bump X/Y frictions
- Fixed X/Y squash frictions (forgot to use tmod)
- Added a `sightCheck` methods using Bresenham algorithm
- Added `isAlive()` (ie. quick check to both `destroyed` flag and `life>0` check)
- Added `.exists()` to Game and Main

- Camera:
- Cleanup & rework
- Added zoom support
- Camera slows down when reaching levels bounds
- Camera no longer clamps to level bounds by default
- Added isOnScreen(x,y)

- UI:
- Added basic notifications to HUD
- Added debug text field to HUD
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Sébastien Bénard

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# About

**A lightweight and simple base structure for games, using _[Heaps](https://heaps.io)_ framework and _[Haxe](https://haxe.org)_ language.**

Latest release notes: [View changelog](CHANGELOG.md).

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/deepnight/gameBase/test.js.yml)](https://github.com/deepnight/gameBase/actions/workflows/test.js.yml)
[![GitHub Repo stars](https://img.shields.io/github/stars/deepnight/gameBase?label=%E2%98%85)](https://github.com/deepnight/gameBase)

# Install

## Legacy or master?

Two separate branches exist for GameBase:

- `master`: latest GameBase version, actively maintained.
- `legacy`: the previous Gamebase version. This one is much more minimalistic but it could be useful if you were looking for a very basic framework for Heaps+Haxe.

The following document will only refer to the `master` branch.

## Getting master

1. Install **Haxe** and **Hashlink**: [Step-by-step tutorial](https://deepnight.net/tutorial/a-quick-guide-to-installing-haxe/)
2. Install required libs by running the following command **in the root of the repo**: `haxe setup.hxml`

# Compile

From the command line, run either:

- For **DirectX**: `haxe build.directx.hxml`
- For **OpenGL**: `haxe build.opengl.hxml`
- For **Javascript/WebGL**: `haxe build.js.hxml`

The `build.dev.hxml` is just a shortcut to one of the previous ones, with added `-debug` flag.

Run the result with either:

- For **DirectX/OpenGL**: `hl bin\client.hl`
- For **Javascript**: `start run_js.html`

# Full guide

An in-depth tutorial is available here: [Using gamebase to create a game](https://deepnight.net/tutorial/using-my-gamebase-to-create-a-heaps-game/). Please note that this tutorial still refers to the `legacy` branch, even though the general idea is the same in `master` branch.

## Sample examples

The samples are the recommended places to start for the latest `GameBase` version (`main`).

They should give a pretty hands-on understanding of how entities work and how to integrate `ldtk` to development.

`SamplePlayer.hx`[SamplePlayer.hx]

SamplePlayer is an Entity with some extra functionalities:

- user controlled (using gamepad or keyboard)
- falls with gravity
- has basic level collisions
- some squash animations, because it's cheap and they do the job

`SampleWorld.hx`

A small class that just creates a SamplePlayer instance in the sample level.

## Localization

For **localization support** (ie. translating your game texts), you may also check the [following guide](https://deepnight.net/tutorial/part-4-localize-texts-using-po-files/).

## Questions

Any question? Join the [Official Deepnight Games discord](https://deepnight.net/go/discord).

# Cleanup for your own usage

You can safely remove the following files/folders from repo root:

- `.github/`
- `LICENSE`
- `README.md`
- `CHANGELOG.md`
10 changes: 10 additions & 0 deletions _base.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-cp src/game

-lib castle
-lib heaps
-lib hscript
-lib deepnightLibs
-lib ldtk-haxe-api
-lib heaps-aseprite

-main Boot
2 changes: 2 additions & 0 deletions build.dev.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build.directx.hxml
-debug
4 changes: 4 additions & 0 deletions build.directx.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_base.hxml
-D windowSize=1280x720
-hl bin/client.hl
-lib hldx
3 changes: 3 additions & 0 deletions build.js.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_base.hxml
-dce std
-js bin/client.js
4 changes: 4 additions & 0 deletions build.opengl.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_base.hxml
-D windowSize=1280x720
-hl bin/client.hl
-lib hlsdl
Binary file added res/atlas/tiles.aseprite
Binary file not shown.
3 changes: 3 additions & 0 deletions res/const.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"myJsonConstant": 2
}
Loading

0 comments on commit d1eb73e

Please sign in to comment.