Submitted by Moonside in programming

Let's be coding

I thought it would be nice to hear about some of the projects you guys are working on, in a cozy, low-stakes atmosphere. Things that are waiting for final polishing, games that are just mere infants! Actually, software babies that you left in the woods but feel like you might retrieve, too.

7

Comments

You must log in or register to comment.

Moonside OP wrote (edited )

I suppose it's going to be a bit ironic that I'm kinda announcing my own project to the world here, which isn't as cozy and low stakes I meant this thread to be, but ahem. Feel free to crib my format (introduction, project now, its future, conclusion) if you want to, it helped to make this comment better.

My project

I'm creating an app to generate random notes, chords and scales for musical practice. The closest thing I've found is Bret Pimintel's random note web app, which I recommend you to try out right this second. I'm also using the occasion as an excuse to learn Haskell.

To those not in the know, things that sound exactly the same on when played on the piano may not be the same always. Piano tuning is a compromise and thus augmented seconds and minor thirds sound exactly the same. But when sung, they sound distinct. Theory reflects this too, which matters when you need to name and notate notes. I did some research on how others deal with these issues in web apps and dare I say: badly or hardly not at all. Bret Pimentel has the nicest system, but I'm not sure whether it's extensible beyond it's original purpose. This is where my project comes in.

Where's my project currently

Modelling music theory is essentially complete, but the app lives on the command line without a graphical UI. There are also no options to make drills nor does it care about user input. If I run the program in terminal, it will generate ten random minor or major keys

[g,d,b,B♭,b♭,f♯,d♯,G♭,G♭,g]

where lowercase letter are minor keys, uppercase ones a major keys. It's not obvious from the output, but the program can handle arbitrarily many accidentals with ease, like C𝄪𝄪𝄪𝄪𝄪𝄪𝄪♯, which in a silly way has 15 sharps and corresponds to the C♯/D♭ key on the piano. It's a side-effect of having a principled system. I don't need to deal with special cases, so even ludicrously unlikely cases get treated correctly.

For the nerds in audience, think of it as arbitrary precision integer arithmetic vs using ints. I don't trust ints and dealing with special cases here. Performance doesn't matter, thus the high road is the easiest road.

Where's my project going

The next step is learning to create a web app using Haskell. I've never created a web app before and I'm not exactly sure which way I should go. Ideally something that lives 100% in the browser would be neat, I don't want to create a service that handles user data and log ins and shit. It would be nice updating could be just as easy as uploading some compiled html file and letting users refresh the site.

Conclusion

Somewhere in February I'll publish a pastiche of Pimentel's app. It should be the most principled web app of its kind available, even if not overly ambitious otherwise. Because of its principled modelling of music theory, it should be easy to extend so it could be more than that and I don't have to fight ad hoc logic to implement it. It will probably look like ass at first as I'm not a web designer.

5

musou wrote

this sounds really neat! i love making music and i also love haskell (although i am only a hobbyist at either one).

have you picked a web framework yet? i've seen a few for haskell but haven't tried any.

4

musou wrote

right now i'm in the early stages of writing a go (aka weiqi/baduk) server in the vein of online-go.com. i want to learn how to make game servers, and go is the simplest game that i play regularly so it seemed like a good choice. it also seemed like a good choice for Elixir, the language i use at work. i know a lot of other online game services use it. and when it comes time to write the front end i would like to try Elm again, but it's still a long road before i get to that point.

5

Moonside OP wrote

this sounds really neat! i love making music and i also love haskell (although i am only a hobbyist at either one).

It's nice to see another person in this intersection of interests, I wouldn't have guessed! I'm not a career programmer by any means, so Haskell is a hobby for me too.

have you picked a web framework yet? i've seen a few for haskell but haven't tried any.

No I haven't and this has been a point of procrastination for me. I think I should pick one, make something that outputs on the page the same [e♭,F,g,b♭,e♭,c,e♭,b,E,d] kinda string as my current program does, and refreshes it every time you click a button. Pimintel's app isn't much more fancy than that in the big picture, after all.

A problem is that there are lots of choices, but the situation keeps developing so I can't what's good. Year old blog posts are outdated at this point afaik.

3

kleril wrote

Videogame. Think Zeldy / Majora's Mask.
Been working on it for a while, but it should be pretty clear I'm more coder than artist. Unfortunately all the interesting things are the underlying systems - which are in, so it's a matter of adding content & polish - so showing it off visually is... challenging? Hopefully the demo will end up being done Soon (TM), and actually have models & textures that aren't just explicitly placeholder.

5

hollyhoppet wrote

would it be cheating to say jstpst lol?

4

twovests wrote

Current project:

  • Conway's Game of Life with three different species. I was actually coming to this sub to post about this and complain about my mistakes lol. I'm doing it in Python and following ~TDD~, but I made the mistake of not considering diagonal neighbors, which, stupid of me?? I'll probably post more about it once I fix it up. I started it yesterday and meant to be finished today.

Games: I have a lot of game ideas that I want to write. I'm going to be using the Godot engine (https://godotengine.org/) and am waiting for it to hit version 3.

  • Morph-ball game; a physics platformer where you use an assortment of bombs to maneuver.
  • Weird dimension fuckiness; a puzzle game based in 5 spatial dimensions and 2 time dimensions.
  • 2D-Time bullet hell; a bullet hell expanding on the 2D time concept

Learning:

  • I want to learn Rust, so I'm going to create a Library-of-Babel sorta thing in it.
  • I want to create a circuit design educational language that the Game of Life thing is sort of practice for. It'll be turing complete and a bit like Minecraft
  • I've been meaning to look at the Postmill source code and learn about that too

School is starting soon though so I won't be making lot's of progress.

4

twovests wrote

I don't know a lot about music theory but the arbitrary precision integer arithmetic sounds interesting.

It might be that I don't understand enough about the music theory behind it, but why don't you trust ints? Is that distrust just for this application, or more general?

4

lainproliant wrote

I'm working on a few different things, balancing load across them based on whatever I feel like working on at any given time.

  • moonlight: A set of utilities for everyday C++ coding that make life easier, used in almost all of my C++ projects. It's effectively an overhaul of this which I wrote a few years ago: https://github.com/lainproliant/toolbox-cpp
  • lost-levels: A 2D game engine.
  • bakery: A python-based dependency driven build system: https://github.com/lainproliant/python3-bakery
  • pixart-queue: Part of a RPi project where the RPi is mounted in a shadowbox frame along with a 16x16 RGB LED grid. pixart-queue is an agent running on the RPi which will respond to requests in a Slack channel and will add images, animations, or printouts to its circular display queue.
  • jotdown: An extension for annotating notes, tasks, and appointments on top of Markdown, along with some helpful self-organization utilities to go along with it.
4

Moonside OP wrote

Arbitrary precision integer arithmetic is just a mouthful for what is in Python long and in Java BigInteger. Just integers that go arbitrarily big in absolute value. I literally had to google for the official name!

It might be that I don't understand enough about the music theory behind it, but why don't you trust ints? Is that distrust just for this application, or more general?

It was a bit of hyperbole, it's mostly that I've gotten a bit bored with the tricks we have to do in software to make things palatable for computers, instead of doing the most straightforwardly correct thing at first and then making it hairy in the name of efficiency. It's like we have a computer brain or binary fog or what you call it!

The big problem was representing notes so that they have correct letter names, the correct amount of accidentals and octave; this is enough to name them correctly and also play the pitch. I wrote convoluted and buggy versions of this, so I was motivated to do it Right. The original version was just storing these directly, but calculating intervals between them was convoluted, but I noticed that each note is some distance (interval) away from middle C. Notes can be represented as rewrapped intervals.

I represented intervals as pairs of integers (I can distinguish between augmented fourths and diminished fifths that way). I defined addition and inverse on them so it turns out that they are isomorphic to the additive group of integer points on a XY-plane, or Z². And as notes are just intervals from middle C in disguise, naming all of them correctly is easy since the bookkeeping is done by underlying presentation. It's about ten lines of code and half of that are signatures.

So it was just an easy thing to do, because the innermost representation really is infinite in two directions. That said, it doesn't matter much, because the largest integer is 9223372036854775807 and basically for my purposes about 1000 is enough, without doing a bunch of renormalizations.

3

Moonside OP wrote

I'm doing it in Python and following ~TDD~

Reimplement in Coq and automatically derive it from specification. Actually I've tried to learn proper testing habits in Haskell, but I think that I don't even have a specification atm so yeah haha.

Godot looks pretty good.

I've been meaning to look at the Postmill source code and learn about that too

Me too! I've been itching to Fix a thing or two there.

3

twovests wrote (edited )

Ooh I never heard of Coq, I'll definitely need to check that out eventually! Googled it a bit, it seems neat but it'll be too much for me to get into rn

3

Moonside OP wrote

I was mostly joking, but I'm halfway done with the 1st of these books. It's definitely laborious, but interesting. It seems like things are faraway from production and changing pretty fast in that space. Some others: Agda, Idris, ATS (this seems scary). The most impressive Coq project I've seen is this C compiler: http://compcert.inria.fr .

Btw, juggling with proofs is very video game like though, I played with them too late into the night. That constant feedback! The triumph of writing Qed.

2

lainproliant wrote

https://github.com/lainproliant/lost-levels

Run submodules.sh to pull down the submodules, then make to build. Requires sdl2 and sdl2-image.

There's two demos: quadtree that shows the breakdown of a quadtree that would be used for collision detection, and simple that I use as a benchmarking tool to see how many sprites I can get on the screen before framerate starts to suffer.

2