Code Monkey home page Code Monkey logo

elm-2d-game's Introduction

Elm render 2D game

This library aims to enable creating 2d games based on WebGL using elm.

TODO: pretty pictures and more examples

Alternative libraries

Check out https://korban.net/elm/catalog/packages/game-dev/rendering for similar libraries and other approaches to game development.

Related Libraries

Goals

My current goal is just to enable users with no WebGL and GLSL knowledge to create simple games. Hopefully this will eventually grow into something bigger, but currently that's what this is.

This library is for you, if

  • you want to create a simple 2d game as a learning experience
  • you want to use elm
  • you've used elm-graphics, but are looking for a slightly more powerful option without going full WebGL.

If you want to create a "real" game, I strongly recommend other options such as Godot / LÖVE / libGDX / MonoGame / Unreal / Unity etc...

Examples

Vision

The vision for this library is to grow into something bigger. Currently it only provides a way to render things to the screen.

It does not provide a way to structure your physics/gameplay code, no resource management, no input management, no sound, no networking, etc.

However, the idea is that each of the mentioned missing topics can be created as a separate package that would live under the same namespace. E.g. a 2d physics engine might live in a package called elm-game-2d-physics and provide the namespace Game.TwoD.Physics

Update log

  • ** 3.1 -> 4.0 **

    • Upgrade to elm 0.19
  • ** 3.0 -> 3.1 **

    • Added viewportToGameCoordinates thanks to @Luftzig.
  • ** 2.1 -> 3.0 **

    • Breaking changes:
      • Removed rectangle. Use shape rectangle instead
      • Changed what the pivot affects.
        • Previously, the pivot only affected the center of rotation. The pivot now also affects where position refers to. For instance, a pivot of (0.5, 0) means that the position parameter of the object now refers to its bottom center.
        • If you want the previous behavior, use (x + pivotX*w, y + pivotY*h) instead of (x, y) for position.
        • makeTransform is also affected by that change.
    • ** New stuff: **
      • Added more prototyping shapes, thanks to @yourSenchou.
      • Added manuallyManagedAnimatedSpriteWithOptions
  • 2.0 -> 2.1

    • Exposed renderTransparent
  • 1.0 -> 2.0

    • Updated to WebGL 2.0.
    • Renamed Vertex attribute a_position to position

elm-2d-game's People

Contributors

legendairie avatar luftzig avatar zinggi avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elm-2d-game's Issues

Similar framework

I wrote a 2D Elm game framework called Messenger and it has many nice features.

Our team developed a game called Reweave based on this framework.

Your 2d game library is great, but I think Messenger works better when creating a complex games (it's modularized, object-oriented).

I would appreciate if you could let me add a link to my project in your Readme. I hope that more people can see my framework :)

Hope you like our framework & game!

Animated sprites should receive their own time

Because time is global, switching animations usually causes the new animation to start in the middle of the sequence.

Users should be able to manage a unique time for each sprite. Doing this will allow users to start animations at any point in the animation sequence(usually the start) as well as handle uncommon animations that may not loop in a normal fashion.

Does the time field in the render config serve another important purpose besides determining a sprites animation frame?

Z-index either not used or misleading

When using functions like shapeZ, spriteZ, or any of the more complicated provided functions with a Float3 position, the Z-order (where sprite layering is determined by the last number in the Float3 tuple) is not respected -- or, it may work in a confusing way.

Expected Behaviour: swapping of non-equal Z-coordinates of overlapping sprites should swap their layering.
Current Behaviour: no change is seen when Z-coordinates are swapped.

I've created a simple example using shapeZ on Ellie, which can be found here.

Documentation missing for `Float2`

The alias Float2 is documented nowhere (had to look at the source code to find it.

You should consider documenting it, possibly somewhere in Render?

Plugin naming convention

Hi, this is a super minor thing, but I saw you want plugins to be named elm-game-2d-.
I am very new to Elm but is there any reason not to call them elm-game-2d/ ?
I think that would make it a little more obvious if a package is part of elm-game-2d.

More basic shapes for prototyping

Being able to use a few more built in shapes without having to use sprites or custom render functions would help make prototyping more productive because being limited to rectangles makes it difficult to distinguish between game entities.

Shapes that would help
Shape Potential Use
Circle Player
Triangle Enemy
Nice to haves / potential ideas
Shape Potential Use
Ring Hitbox
Line Path
Curved Line Trajectory
Hexagon Dangerous terrain
Octagon Ally npc

I have not used veryCustom but it looks like the current way to implement other shapes is it use that. Is that correct?

In the Game.TwoD.Shapes section of the docs you specify that "Since we're dealing with 2d only, the only available shape is a square". Are the shapes I am listing imposible to implement?

Would these changes be in the right direction of this project?

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.