Weeks 170-171: Rocky Fishing and a Game Editor!

Busy weeks!

During the last 4 weeks, I’ve been working on a project with Eliott where we want to have a collection of games that share a set of restrictions, through a framework that also links them to each other. You play games one after the other, with their difficulty increasing, gain points, drain your virtual battery, and when your virtual battery is dead, you have your final score which goes onto a leaderboard. (that last part isn’t implemented yet)

But we also want to let users contribute to this game collection! Through a game editor! And so these two weeks I made a new game, Rocky Fishing, and then went on to work on a game editor!


In Rocky Fishing, you need to drive your hook between the rocks to get fish, and maybe even the treasure that is said to lie at the very bottom of the pond pit. But if you hit the rocks, it’s gameover! And avoid the boots too, they don’t taste as good as the fish.

I think the most interesting part of this game, from a making point-of-view, is the rock generation, so here’s how that works:

First I made a random curve generator, roughly based on the principles of additive synthesis, where the sum of sin waves with different factors lets you recreate specific curve patterns.

With this, three different random curves are generated. One will define the central line between the rocks, where the hook needs to pass. The other two curves define the rock themselves – they are placed on either side of the central curve and move with it, adding to their original curvatures.

The values for those curves are stored in Lua tables, so that we don’t have to do thousands of trigonometry call every frame, which could be very costly in performance.

Then, on frame, we simply draw the rocks one line at a time, from the left border of the screen to the left rock curve, and from the right border of the screen to the right rock curve. I use a small gradient of colors from the palette to give the final result some depth. And then I also added algae and coral, which are placed randomly and follow the sides’ curvature.

And it turned out quite nice!

Other interesting things: the fishing line is just a bunch of points pulling each other but also very slowly moving down (you don’t want it to stop moving anywhere, it looks weird), the fishes glow because flat colors looked bad, the addition of bubble particles is actually the one thing that made the game look a lot more alive (and so a lot better).

You can play Rocky Fishing on Castle! At the end of it, you’ll be prompted to play another game made by either me or Eliott! (and you should play on!)


Pictured in the gif above is me, editing the UI panel, from the UI panel.

That’s where I started from for the game editor. This UI panel is part of Castle and you decide what goes into it. You can have sliders, buttons, but also css-style boxes, tabs, dropdown lists, markdown text, and now you can also have a code editor.

It is super interesting, and super satisfying to play with, as it’s all very quick and easy to set up. It is clearly designed to make more complex usage possible, and so our game editor seemed like the perfect opportunity to put it to the test.

So I went for it! I already had an interesting idea for the structure of this editor, with a system consisting of a bank of individual functions that would make up the game code.

You’d have your list of functions, then the one function that is currently selected: its name and parameters, which you can edit, and then the function’s code, which you can edit as well. Then you have a ‘compile’ button which will compile the function and outputs syntax errors if there are any. (also works while testing the game, the function will update if it compiles successfully)


And it works!

Since this UI panel is a relatively new feature in Castle, I encountered a few bugs (which I reported of course and I was told that they would be fixed quickly) but still I managed to get something very functional, and that’s all I wanted!

Aside from the code part of the editor, we also had an existing game-info structure to work with the framework for the project’s games, containing title, description and controls, and so I replicated that structure in the editor, with a bunch of text-input and number input cases.

And when I was done with that, I used another Castle feature: storage! So the games you make can now be saved and tied with your profile, and soon it will be made playable by anyone, from the global storage, while only you can edit it. (they will be playable by other people only after you hit a ‘publish’ button of course)

I also wrote a quick API of all the base functions you can use in the game’s code! It’s missing one or two things but it’s still pretty complete.

Now I want to make small helper things to display outside of the UI panel, when not testing the game. There will at least be a palette picker and a glyph picker. But that’s for the coming week!


These last two weeks were pretty intense! The game editor has been a lot of work, but I’m very happy with how far it has come in just a few days! I’m hoping to let you use it as soon as next week!

As usual I want to thank my Patreon supporters! You all are incredible! I’ve been thinking about making some new exclusive content for you, I’ll let you know more soon!

Here are the names of all the 3$+ supporters:

★Joseph White, ★Spaceling, rotatetranslate, Anne Le Clech, LadyLeia, bbsamurai, HJS, Paul Nguyen, Dan Lewis, Dan Rees-Jones, Joel Jorgensen, Marty Kovach, Flo Devaux, Thomas Wright, HERVAN, berkfrei, Tim and Alexandra Swast, Jearl, Pillow Decay, Johnathan Roatch, Raphael Gaschignard, Eiyeron, Sam Loeschen, Andrew Reitano, amy, Cole Smith, Andrea D’Amico, Simon StÃ¥lhandske, yunowadidis-musik, slono, Max Cahill, hushcoil, Gruber, Pierre B., Sean S. LeBlanc, Andrew Reist, Paul Nicholas, vaporstack, Jakub Wasilewski


Next week should be interesting! Eliott is coming over to my place, so we’ll be able to better coordinate our efforts! We’ll see how it goes!

Have a very nice week!

Take care!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: