Giter Site home page Giter Site logo

zergon321 / cirno Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 2.0 3.54 MB

An easy-to-use collision resolution library for gamedev written in pure Go.

License: MIT License

Go 100.00%
gamedev collision-detection collision collision-avoidance collision-handling go golang golang-library golang-examples geometry

cirno's Introduction

Cirno GoDoc

An easy to use collision detection and resolution library written in Go programming language. The library is still in development and the API might change.

Installation

No C dependencies required to compile the library. Just use the following command to install it.

go get github.com/zergon321/cirno

Tutorial

The tutorial series explains how to use different API methods and data types of Cirno to handle everything related to collisions in games.

Examples

All the example programs using the library are located in examples directory. Pixel is required to run any of them. The most important demos are described below.

  • benchmark - a small demo application that creates 1000 rectangles, randomly moves and rotates them and serches for collisions between them. It clearly showcases quad tree in action;

  • contacts - a small demo application that showcases finding contact points between shape outlines;

  • raycast - a small demo application that showcases raycast, just like Physics2D.Raycast from Unity;

  • sliding - a small demo that showcases shapes movement with sliding collision.

Games

The most noteable game created with Cirno at the current time is a Touhou style danmaku demo. The less noteable one is a tiny platrformer level in examples directory.

Danmaku Platformer
Danmaku Platformer

If you have a game using Cirno and you want it to be present in this list, just create a new PR with your changes to the README.

Features

  • Shapes to attach to game objects to detect and resolve collisions between them:
    • circle;
    • line segment (or just line);
    • rectangle (OBB, oriented bounding box).
  • Quadtree space index
  • Raycast
  • Contacts finding methods
  • Normal computing methods
  • Movement and rotation approximation
  • Tag system

Contributing

For minor and unimportant errors such as typos please just create issues instead of PRs fixing them.

Code changes adding features, optimizations, tests and bugfixes are welcome. All the contributions in examples directory should be really small, preferrably one-file. If your game is quite big, consider placing links to it in the list of games in the README.

cirno's People

Contributors

zergon321 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cirno's Issues

Can you explain NewSpace function parameters a bit more?

Hello! Firstly I would like to say that, the library is amazing, and it is documented very well. However I found one place a bit complicated for me:

func NewSpace(subdivisionFactor, shapesInArea int, width, height float64, min, max Vector, useTags bool) (*Space, error)

What for are those variables?

  • subdivisionFactor
  • shapesInArea
  • width
  • height

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.