GithubHelp home page GithubHelp logo

orasund / pixelengine Goto Github PK

View Code? Open in Web Editor NEW
58.0 4.0 3.0 1.73 MB

a graphic engine for elm

Home Page: https://package.elm-lang.org/packages/Orasund/pixelengine/latest/

License: BSD 3-Clause "New" or "Revised" License

Elm 10.23% HTML 89.77%

pixelengine's Introduction

PixelEngine

PixelEngine is a graphic engine for rendering turn-based pixel games.

Games made with pixelEngine

Games can either be stand-alone documents or imbedded in a website

Tutorials

Games made with this Engine

If you have created a game with this engine, please let me know.

Should I use this Package?

This package follows a few philosophies:

  • Let CSS handle all animations - I feel like functional programming should describe reactions to some events. Animations are normally running all the time and not a reaction. Addionally by getting rid of an infinite game loop, we can use the time-travel debugger.
  • Pixel games first - There are a few optimizations to ensure crips pixels as well as good old low-frame animations.
  • Demand driven features - There is no roadmap. I intend to use this engine for all my games. If I feel like I can't make a game, because my engine is missing a feature, I will add it. (Please feel free to ask if you are missing a feature.)

When to use it:

  • The game is turned based. (Board Games, Rogue-likes games, Puzzle games, Turn based strategy games)
  • The game has an idle state. (Farming games, J-RPG games like Pokemon)
  • The game is tile based. (Tetris,Pack-man)

When not to use it:

  • The game is about speed or accuracy. (Racing games)
  • The game is physics based. (Flappy Birds)
  • The game has a continues game loop. (Platformers, western RPGs like Zelda)

Motivation

I had just watched a talk about the time-travel debugger of Elm. So I wanted to test it out for my next project: A little game.

The graphics engines that I could choose from where

Both used a loop to draw animations and therefore did not support time travelling and besides elmo-8 couldn't even render pixel graphics properly.

So I decided to try something different and to use HTML and CSS instead of WebGL. This way I could let CSS handle the animations. I knew that my little project was not a universal game engine, but for very specific games it might be just right.

Upcoming Features

  • Console - It would be great if all games written with this engine would have a common way how the interface looks like. I am mainly thinking of a PICO-8-like style, but i would like to provide a few different GUIs and start screen.
  • Modular Transitions - For now I do not expect this will ever be done, just because its a very complex problem.
  • Particles - Maybe using BrianHicks/elm-particle?

Upgrading

  • To 6.0.0
  • To 5.0.0
  • To 4.0.0
    • program and programWithCustomControls are now renamed to game and gameWithCustomControls.
    • This package now uses avh4/elm-color for colors.
    • For styling use Html.Attributes.style.
    • renderToScale replaced usingScale, but normally Graphics.program is the better option.
  • To 3.0.0
    • First follow the error messages of the compiler
    • Next set the scale of your game to 1. In the new version the scale feature scales the entire game.
    • If you want keyboard support use Graphics.program. It will also take care of the new way scaling works.

pixelengine's People

Contributors

orasund 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

Watchers

 avatar  avatar  avatar  avatar

pixelengine'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.

I think Messenger are more flexible and you can use it to design almost any game (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!

Converting tiles to images loses custom attributes

I Wanted to be able to layer tiles, so I implemented my own tilesArea as shown below.
But in this case, custom attributes (such as those added with .monochrome) are not rendered.

tiledArea :
    { rows : Int, tileset : Tileset, background : Background, rowsPerTile : Int }
    -> List ( ( Int, Int ), Tile msg )
    -> Area msg
tiledArea params list =
    PixelEngine.imageArea
        { height = toFloat <| params.rows * params.tileset.spriteHeight // params.rowsPerTile
        , background = params.background
        }
        (list
            |> List.map
                (\( ( col, row ), tile ) ->
                    ( ( toFloat (col * params.tileset.spriteWidth // params.rowsPerTile)
                      , toFloat (row * params.tileset.spriteHeight // params.rowsPerTile)
                      )
                    , PixelEngine.Image.fromTile tile params.tileset
                    )
                )
        )

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.