From 48f5a9db8e8d99c54ceb08d632cfd11576b73261 Mon Sep 17 00:00:00 2001 From: Evan Hemsley Date: Sat, 14 Sep 2019 19:55:02 -0700 Subject: [PATCH] initial commit --- .gitignore | 12 ++++++++++++ .gitmodules | 3 +++ archetypes/default.md | 6 ++++++ config.toml | 7 +++++++ content/_index.md | 15 ++++++++++++++ content/broad_phase/_index.md | 13 +++++++++++++ content/broad_phase/introduction.md | 18 +++++++++++++++++ content/broad_phase/spatial_hash.md | 6 ++++++ content/getting_started/_index.md | 13 +++++++++++++ content/getting_started/installation.md | 26 +++++++++++++++++++++++++ content/shapes/_index.md | 13 +++++++++++++ content/shapes/circle.md | 13 +++++++++++++ content/shapes/introduction.md | 17 ++++++++++++++++ content/shapes/line.md | 13 +++++++++++++ themes/hugo-theme-learn | 1 + 15 files changed, 176 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 archetypes/default.md create mode 100644 config.toml create mode 100644 content/_index.md create mode 100644 content/broad_phase/_index.md create mode 100644 content/broad_phase/introduction.md create mode 100644 content/broad_phase/spatial_hash.md create mode 100644 content/getting_started/_index.md create mode 100644 content/getting_started/installation.md create mode 100644 content/shapes/_index.md create mode 100644 content/shapes/circle.md create mode 100644 content/shapes/introduction.md create mode 100644 content/shapes/line.md create mode 160000 themes/hugo-theme-learn diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89ff0a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# Hugo default output directory +/public + +## OS Files +# Windows +Thumbs.db +ehthumbs.db +Desktop.ini +$RECYCLE.BIN/ + +# OSX +.DS_Store \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..30e9149 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "themes/hugo-theme-learn"] + path = themes/hugo-theme-learn + url = https://github.com/matcornic/hugo-theme-learn diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..00e77bd --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,6 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +draft: true +--- + diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..577b3ee --- /dev/null +++ b/config.toml @@ -0,0 +1,7 @@ +baseURL = "https://moontools.github.io" +languageCode = "en-us" +title = "Bonk Docs" + +theme = "hugo-theme-learn" +[outputs] +home = ["HTML", "RSS", "JSON"] \ No newline at end of file diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..83e5714 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,15 @@ +--- +title: "Bonk" +--- + +# Bonk + +[Bonk](https://github.com/MoonsideGames/MoonTools.Core.Bonk) is a fast and modular collision detection system for MonoGame that is part of the MoonTools suite. + +Bonk **is** designed to help you figure out if two shapes are overlapping and by how much. + +Bonk **is not** a physics simulator and it will not help you execute collision responses. + +Bonk is available as a [NuGet package](https://www.nuget.org/packages/MoonTools.Core.Bonk/). + +Bonk is licensed under the [LGPL-3](https://www.gnu.org/licenses/lgpl-3.0.en.html). In summary: feel free to include it in your closed-source game and modify it internally at will, but if you make changes that you intend to redistribute, you **must** freely publish your changes. \ No newline at end of file diff --git a/content/broad_phase/_index.md b/content/broad_phase/_index.md new file mode 100644 index 0000000..0fe8a4b --- /dev/null +++ b/content/broad_phase/_index.md @@ -0,0 +1,13 @@ ++++ +title = "Broad-Phase Collision" +date = 2019-09-14T18:33:15-07:00 +weight = 15 +chapter = true +pre = "3. " ++++ + +### Chapter 3 + +# Broad-Phase Collision + +Fast and inaccurate. \ No newline at end of file diff --git a/content/broad_phase/introduction.md b/content/broad_phase/introduction.md new file mode 100644 index 0000000..56da65d --- /dev/null +++ b/content/broad_phase/introduction.md @@ -0,0 +1,18 @@ +--- +title: "Introduction" +date: 2019-09-14T18:36:07-07:00 +--- + +Let's say we have a room with 100 objects. How do we know if any of those 100 objects are touching one another? + +The naive solution is to simply check each pair of objects and see if they are colliding. + +Unfortunately, this will require 10000 comparisons. + +In other words, this naive approach becomes *extremely* expensive as the number of collision objects grows. + +The solution? Broad-phase collision detection. + +The purpose of the broad-phase is to very quickly check if an object *might* be touching another object. Then, once we know that an object might be touching another object, we can do a more expensive and accurate test. + +There are a few different ways to do this. The only way that Bonk currently implements is the *spatial hash* technique. \ No newline at end of file diff --git a/content/broad_phase/spatial_hash.md b/content/broad_phase/spatial_hash.md new file mode 100644 index 0000000..6da9dac --- /dev/null +++ b/content/broad_phase/spatial_hash.md @@ -0,0 +1,6 @@ +--- +title: "Spatial_hash" +date: 2019-09-14T18:35:33-07:00 +draft: true +--- + diff --git a/content/getting_started/_index.md b/content/getting_started/_index.md new file mode 100644 index 0000000..52eaf39 --- /dev/null +++ b/content/getting_started/_index.md @@ -0,0 +1,13 @@ ++++ +title = "Getting Started" +date = 2019-09-14T18:05:58-07:00 +weight = 5 +chapter = true +pre = "1. " ++++ + +### Chapter 1 + +# Getting Started + +It's pretty simple. \ No newline at end of file diff --git a/content/getting_started/installation.md b/content/getting_started/installation.md new file mode 100644 index 0000000..0a58974 --- /dev/null +++ b/content/getting_started/installation.md @@ -0,0 +1,26 @@ +--- +title: "Installation" +date: 2019-09-14T18:20:28-07:00 +--- + +The simplest way of using Bonk is by including it in your C# project as a NuGet package. + +To include the latest version of Bonk in your project using the .NET CLI, use the following command: + +```sh +dotnet add package MoonTools.Core.Bonk +``` + +If you are using the NuGet Package Manager, you may do: + +```sh +PM> Install-Package MoonTools.Core.Bonk +``` + +Once you have done this, you may access Bonk functionality by including + +```cs +using MoonTools.Core.Bonk; +``` + +in any C# file. \ No newline at end of file diff --git a/content/shapes/_index.md b/content/shapes/_index.md new file mode 100644 index 0000000..257a368 --- /dev/null +++ b/content/shapes/_index.md @@ -0,0 +1,13 @@ ++++ +title = "Shapes" +date = 2019-09-14T19:08:45-07:00 +weight = 10 +chapter = true +pre = "2. " ++++ + +### Chapter 2 + +# Shapes + +What are shapes? We just don't know. \ No newline at end of file diff --git a/content/shapes/circle.md b/content/shapes/circle.md new file mode 100644 index 0000000..812a6c7 --- /dev/null +++ b/content/shapes/circle.md @@ -0,0 +1,13 @@ +--- +title: "Circle" +date: 2019-09-14T19:46:44-07:00 +weight: 20 +--- + +To define a circle, give a center point and radius. + +```cs +var center = new Position2D(5, 5); +var radius = 3; +var circle = new Circle(center, radius); +``` \ No newline at end of file diff --git a/content/shapes/introduction.md b/content/shapes/introduction.md new file mode 100644 index 0000000..709d78c --- /dev/null +++ b/content/shapes/introduction.md @@ -0,0 +1,17 @@ +--- +title: "Introduction" +date: 2019-09-14T19:19:03-07:00 +weight: 5 +--- + +In Bonk, a **Shape2D** is defined by two methods. + +1) A *support function*, which is a method that returns the farthest possible position **Vector2** in a given **Vector2** direction defined by the shape with its vertices transformed by a **Transform2D** + +2) A method for creating an axis-aligned bounding box from the shape. + +Bonk provides you with 4 built-in common 2D shapes, but you can implement these methods to create custom **Shape2D** structs. + +Note that these shapes should be defined with zero-centered **Position2D** structs. You will use a **Transform2D** to manipulate the shape's position, rotation, and scale in 2D space. + +A final restriction to note: Defining concave shapes is an error. The collision solving algorithm that Bonk uses does not support concave shapes. If you wish to define concave shapes, define them as a composition of multiple convex shapes. \ No newline at end of file diff --git a/content/shapes/line.md b/content/shapes/line.md new file mode 100644 index 0000000..71ed035 --- /dev/null +++ b/content/shapes/line.md @@ -0,0 +1,13 @@ +--- +title: "Line" +date: 2019-09-14T19:36:39-07:00 +weight: 10 +--- + +To define a Line, give a start and end position. + +```cs +var start = new Position2D(-1, 1); +var end = new Position2D(1, 1); +var line = new Line(start, end); +``` \ No newline at end of file diff --git a/themes/hugo-theme-learn b/themes/hugo-theme-learn new file mode 160000 index 0000000..b85d51a --- /dev/null +++ b/themes/hugo-theme-learn @@ -0,0 +1 @@ +Subproject commit b85d51a051745cf12e3a45ce61b4b0c747c5ea4a