For background, I am a moderately experienced programmer (mostly Haskell), but this is my first serious foray into web development.
I’m looking to build a simple 2D game, but I don’t know which technologies and libraries to get started with - there seem to be a dizzying array of options, and I don’t understand all of the different trade-offs. Among my requirements are:
- I’d like to work with an API which allows me to easily fit the game to the viewport (not quite sure if that’s the right terminology), and work with relative coordinates e.g. (0.5,0.5) to refer to the centre point, regardless of resolution. I want to guarantee that there’ll be no scrollbars.
- I don’t care if it looks bad on displays which don’t have a roughly 16:9 aspect ratio.
- Ideally, I’d like to create SVG assets through an external tool (I have a particular one in mind), and load them from files. Some (though actually not many) of these will need to be animated. I figure I should be able to control particular sub-components (again, not sure of the right terminology here) of the SVG, based on their 'id’s.
- Performance is not a primary concern.
did you see: evancz/elm-playground?
its source code is here
There is also a #gamedev channel in elm slack which would be super helpful to you.
evancz/elm-playground locks down a lot of what you can do for the sake of simplicity. You won’t be able to play audio, save your game state, or make http requests (besides loading images). If that’s a deal breaker, I recommend using ianmackenzie/elm-geometry-svg instead (along with elm/svg and ianmackenzie/elm-geometry as you’ll need these when working with
You can get your (0.5, 0.5) relative coordinates by setting the viewBox property in your top level svg tag.
I was playing around with sort of a 2D game myself recently. (See https://github.com/mduerig/elmaze).
Most of the stuff if coded from scratch. However for SVG I found elm-collage very easy to use and powerful enough for my purpose.
Re. animations, so far I created them in an ad-hoc way. However, recently I became aware of elm-animator, which looks like a good fit.
elm-collage definitely seems cool. It’s even based on the Haskell
diagrams library which is what I had been planning to use to build SVG.
elm-animator also looks like it’ll be worth looking in to.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.