Giter Site home page Giter Site logo

jordymoos / elm-pixel-boulder-game Goto Github PK

View Code? Open in Web Editor NEW
41.0 3.0 6.0 8.65 MB

Pixel Boulder Game in Elm

Home Page: https://jordymoos.github.io/elm-pixel-boulder-game/?startLevel=official%2F001&hideDebug=1

License: MIT License

JavaScript 6.05% Elm 89.92% HTML 3.92% Python 0.12%

elm-pixel-boulder-game's Introduction

Elm Pixel Boulder Game

The Elm Pixel Boulder Game is a bit "out-of-hand" experiment to write a game in a pure functional language. I tried to apply some tricks out of the books like the Actor-Component system which allows you to configure the entities in assets.

For years I wanted to build a led table like this one (not mine). Which I would probably do on a raspberry pi in Python. One of the games I would like to make for it is the old school Boulder Dash. And I thought, if I could make Boulder Dash in a pure functional language like Elm. Then I could probably write about any game you can create in a 12 by 12 pixels grid in Python.

This is also the reason why its all pixel-ish (the menu and some original levels).

Original levels are in pixels

When I showed people this they where like "mhe" until I decided to add images. Suddenly it really looked like the old Boulder Dash!

The new version supports images

Play the game!

You can play the game at github pages.

https://jordymoos.github.io/elm-pixel-boulder-game/?startLevel=official%2F001&hideDebug=1

Easy level editor

You can create and play your own levels in the visual editor.

Create your own levels!

And then play your own level!

Play your self created levels!

https://jordymoos.github.io/elm-pixel-boulder-game/?hideDebug=1

Advanced level editor

If you do not like the default configuration then you can also use the advanced editor to configure more of your game!

Use the advanced editor to tune about everything

https://jordymoos.github.io/elm-pixel-boulder-game/?editorMode=advanced

Development

Clone the repository.

git clone https://github.com/JordyMoos/elm-pixel-boulder-game.git

Go into the directory.

cd elm-pixel-boulder-game

Install the dependencies.

npm install

Run the local version.

npm start

And play it in your browser at localhost:3000

Create a prod build

After installing the dependencies you can also create a production build.

npm run prod

Which will create the production version in the ./dist folder.

elm-pixel-boulder-game's People

Contributors

jordymoos 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

Watchers

 avatar  avatar  avatar

elm-pixel-boulder-game's Issues

Create a coordination index for actors

We have to loop through all the actors like almost d*n times. Only to find if a coordinate is owned or get that owner. We can easily optimize that.

It is possible that a coordinate is owned by more then one actor. Like:

  • When player is moving a rock
  • When an explosion is triggered

Maybe add tests

To play with the elm-test Fuzz a bit more.

Note the "Maybe" in the title!

refactor the destorying dirt and collecting diamonds

Now we have components for destroying and collecting diamonds while they are actually the same thing. The dirt gets destroyed and rewards nothing. And diamonds gets destroyed and collect diamonds

Main point here is that the engine should not know that a diamond is a thing. It ahould be. more generic collectable

Make trigger-explodable more dynamic

Now it is hard coded to what entity to spawn, while the game should not expect that entity to exists. We should make it configurable which entity should be spawned. That way it would be possible to other stuff like diamonds

Only draw tiles that changed

As a performance update it would be cool if we only overwrite tiles that changed.

  • Draw the canvas and store it in the model?
  • Keep list of changed positions
  • Update the changes in the canvas
  • How to update animations like diamonds??

Not sure if it really is per formant but it is part of the whole learning trajectory

PlayerInputComponent should just be an AI

That way you can no longer have an AI and player input. And also the player input should not give extra powers the the entity (like it does now with initiating a push). That sort of behavior should be decided by components without knowing if the AI or player did it

Make game playable on mobile

Guess coolest thing is with touch.
Which will transform to some movement over multiple game ticks. It does need to know where thr player is for it be able to deside

Advanced level editor

Configure what an Entity is yourself! If I also add a "FollowTrackerComponent" and "TrackerComponent" than you can make pacman!

Better input direction

Now we make direction decision in this order: left, up, right, down. But if we add the gametick to the is/was-pressed and sort on the lowest. Then we get a better direction decision.

Advanced level editor

Be able to drag and drop components to entities to make it more accessible to create games which could be really cool for kids to make their game

Update merge color

Instead of getting the average off all colors and alpha. We should "weight" the colors on the alpha and set alpha to the highest alpha value. I think that will make the color transition look smoother

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.