Ludum Dare 48 is almost over, so I guess it is time to write a post mortem for my archive :smile: I intended to keep it short, but somehow I couldn't stop writing :sweat_smile:
My submission is a small physics game about building your own submarine, where you have to sustain increasing pressure the deeper you go. Here is how it went:
Theme and Idea
To be honest, at first I wasn't a big fan of the theme because it seemed too broad to me. But in return we got a big variety of games to rate, so I guess now I am happy with the theme. During the initial brainstorm session I came up with a lot of different settings, but as game mechanic I only had the idea to do something with pressure as consequence of depth. So I just went with this idea.
Implementations
Editor:
Implementing the editor was programming pure spaghetti code. In turn features like rotating parts would have taken a pretty long time to implement and there is also a game crashing bug in the editor :sweat_smile: But instead of focusing on this stuff I tried to make alerts as meaningful as possible if there is something wrong with the submarine plan. Unfortunately this didn't quite worked out. A lot of players had problems getting started to build a submarine. Probably I should have provided a default submarine and display the errors earlier. However, the first comment the game got during rating was to provide some example builds in the description and I think that really helped a lot!
Physics:
The physics is maybe the more interesting part. I used a library called planck.js, its basically a port of box2d for javascript. Building walls is then just creating bodies of the shape of a box and combining neighbors with a distance joint. Struts are also implemented by distance joints. Applying pressure was a bit more involved.

The green lines in the picture show the forces I applied manually to the body parts to model pressure, which get stronger with higher depth. To apply these forces a flooding algorithm
is used to assign a room to each tile that is not a wall (room 1 is the surrounding water). Then on every world step we check the tiles above and below (resp. left and right) of all walls. If one of these tiles is filled with water but the other one is not filled we apply a force.
You may already have noticed in the image above that the force is applied based on the rotation of the wall and not on the global shape of the room. This and probably also some general inaccuracies result in a lot of rotation and force coming from nowhere that a lot of players experienced. During testing these forces didn't seem too strong and I thought they add a bit fun, but in the aftermath I should have probably let the forces pull the walls into the middle of the room (this wouldn't have worked for concave shaped rooms though).
Also, because only the upper and bottom (reps. left and right) neighbors of walls get compared, there isn't any pressure applied to these "diagonal" walls on the right of the image. Indeed, you can try to build this submarine and will see that it moves to the left. This could have been easily fixed, but somehow it was super low priority for me during the jam :sweat_smile:
Damage System:
I think the damage system went pretty well. In planck.js you can check under how much stress a distance joint is. The initial idea was to just use that and define some threshold for when a joint should break. After some experimenting I realised that there is a lot of variance in the force that is applied to a joint, so this approach probably would result in unforeseen wall breaks. So the second idea was to break a room once it gets too much squashed (to be exact, when its area falls below 50% of its original area) This would give the player much better feedback. The implementation was then figuring out which wall parts define a room and applying the formular for the area of a general poygon.
Conclusion
This was one of the most fun Ludum Dares I participated in! Implementing the game was a nice challenge and I did enough breaks. There were some problems with the production build though, so I worked until 2:30AM (deadline is 3:00AM here) but I am happy with the result. Of course I would have set some other priorities retrospectively and I think the pressure isn't as central to the game as I wanted it to be. Maybe I will do a post-jam version if I have some time, there was some great feedback in the comments.
Also, as I already mentioned above, the submitted games where so different and a lot were super unique that it was super fun to discover all your games during rating, so thank you all very much for that!