HN
Today

Curveball

A developer created "Curveball," a Rust-powered tool for generating intricate curves and shapes for the open-source game Neverball. This technical deep dive explains the challenges of creating complex geometries within a peculiar brush system and showcases elegant solutions using convex hull algorithms and a clever extrusion abstraction. It's a great example of solving a niche problem with robust engineering and creative algorithmic thinking.

3
Score
0
Comments
#4
Highest Rank
2h
on Front Page
First Seen
Jul 4, 4:00 PM
Last Seen
Jul 4, 5:00 PM
Rank Over Time
44

The Lowdown

Curveball is a new tool developed by 'toilet' to generate complex curves and shapes specifically for the open-source game Neverball. Frustrated by the limitations of Neverball's existing curve generator, which only produced circular arcs, the author embarked on a journey to create a more versatile solution for their own level design.

Here's a breakdown of Curveball's development and features:

  • Motivation and Origins: The author needed sophisticated shapes for a Neverball level set that the game's default curve.c tool couldn't provide. This led to a series of personal scripts that eventually coalesced into Curveball, a comprehensive tool with a visualizer, available as a web app or desktop application (written in Rust, naturally 🦀).
  • Neverball's Unique Geometry: Neverball levels are constructed from "brushes," defined as an intersection of halfspaces, much like the Quake map format. This peculiar method means every brush must be convex, posing a significant challenge for generating non-convex curves.
  • Algorithmic Solutions: Initially, generating brushes involved tedious manual point selection. The author found a more elegant solution using the chull Rust crate, which implements a convex hull algorithm. This allowed the tool to automatically generate the necessary convex brushes from a set of points.
  • The Extrusion Abstraction: The core innovation in Curveball is the "extrusion" concept, inspired by mechanical CAD software. Users define a 2D profile that is then extruded along a 3D path. This powerful abstraction allows for generating a vast array of curve types from simple profiles and paths.
  • Orientation Challenges: A specific technical hurdle was correctly orienting the 2D profile as it moved along the 3D path. The author solved this by employing the Frenet frame, which provides the necessary three orthogonal vectors (tangent, normal, binormal) at each point on the path, allowing for precise rotational control.
  • Beyond Extrusion: While extrusion is central, Curveball also includes specialized generators like "Curve Classic," "Rayto," and "Curve Slope" to handle specific geometric needs that are either difficult to implement via extrusion or are historical artifacts from previous tools.

Curveball represents a significant step forward for Neverball level design, empowering creators with the ability to craft far more intricate and dynamic levels. The author is eager to see the creative designs the Neverball community will produce with this powerful new tool.