Curve Crafter banner

Curve Crafter

26 devlogs
22h 44m 5s

Curve Crafter is a terminal-based function visualizer.
At its core, it’s built from two minimal systems: a tiny CLI game engine and a lightweight math evaluator.
Both parts are fully decoupled, so you can rip them out, reuse them

Curve Crafter is a terminal-based function visualizer.
At its core, it’s built from two minimal systems: a tiny CLI game engine and a lightweight math evaluator.
Both parts are fully decoupled, so you can rip them out, reuse them, or extend them independently whether you want a CLI game or a plotting tool.

This project uses AI
  • Used chatgpt to generate github readme.
  • Used copilot to generate git commits.
Demo Repository

Loading README...

hack.clubber

Shipped this project!

Hours: 22.73
Cookies: 🍪 275
Multiplier: 12.09 cookies/hr

I built a CLI function plotter but to make it I wanted to also learn the windows API, so I made a mini CLI game engine, and got caied away and made a pong clone using the game engine.

hack.clubber

Trying to get support for more than one graph, but its clearly not working.

Attachment
0
hack.clubber
  • Fixed the jitter in the linux version of the grapher.
  • Added more optimization.
0
hack.clubber
  • Cleaned up the makefile.
  • Made changes to the project structure.
  • Added the option to turn on/off graph smoothing using -s when running the app as shown in the picture.
Attachment
0
hack.clubber

Done

  • I finally finished linux support.
  • Made my own itoa function, so now the grapher should work with older windows versions and linux.
  • Made more optimizations.

To do

  • Add support for multiple functions at once.
  • Add the option to turn on/off the graph smoothing.
  • Optimize the grapher even more, because it’s a little slow right now.
0
hack.clubber
  • I optimized the app a little.
  • Finally finished the graph smoothing, although it is a little slow.
    So I might add the option to turn it on and off when running the app.
  • Still have to add support for more than one func and maybe add usefull stuff like intersect and whatnot.
Attachment
Attachment
0
hack.clubber
  • Finally Finished linux support, although, the grapher uses windows only functions, so only the pong game can be played on linux.

To Do

  • Add full linux support
0
hack.clubber
  • Fixed bugs in the evaluater, now it has proper operator presidence.

I don’t feel like adding support for negative values or decimals, so,

  • if you want to use negative numbers, do:
    0 - n ... # for example
  • If you wanna use decimals, do:
    1/2 ... # for example
Attachment
Attachment
0
hack.clubber

Math

  • Fixing the evaluater, not done yet.

Grapher

  • Still haven’t smoothed it, i will try for another day, if I can’t get it to work, I might have to use the help of AI.

To Do

  • Add support for negative numbers.
  • Add support for decimal numbers.
  • Add support for parentheses.
Attachment
Attachment
0
hack.clubber

Done:

  • Finally finished the docs, so the project is easier to understand.

To Do:

  • Finish adding linux support.
  • Fix the math parser.
  • Change and Improve the visuals for the func plotter.
  • Be done.
Attachment
0
hack.clubber

Merged The two wakatime projects because I only now figured out how to do it.

Attachment
0
hack.clubber
  • I fixed more bugs with the renderering api.
  • I made docs for both the input and renderering apis but my pc crashed so I have to restart all over.
Attachment
0
hack.clubber

What I did

  • I was getting tired of not being able to make the graphing calculator work like I want, so instead I:
    • Made the linux renderer but haven’t tested it yet.
    • Worked on input on linux.
  • I also fixed a bug in the pong game where the menu text was off centered when you change the size of the window.
Attachment
Attachment
0
hack.clubber
  • Updated the ASCII chars used to draw the axies.
  • Struggling to get the code that fills empty y spaces to work, still isn’t working as shown in the picture.
Attachment
0
hack.clubber
  • I made my own vector2 data type because I was using COORD from the win32 API, but that’ll make it require different code for different operating systems, So I made my own.
  • I also update my grapher and pong clone to use the new Vec2 data type.
Attachment
0
hack.clubber

Grapher:

  • I added the x and y axis so you can better visualize the graph.
  • I fixed bugs related to the graph’s position.
  • I added the ability to enter as many X variables as you want.

Problems:

  • I did have a problem where I wanted to add colors but my double buffering method doesn’t seem to be compatible with coloring. So I will do some more research on that, tho whether I can add color or not is up to the win32 API.

Extra:

  • And as the pictures show, the graph is pretty similar to the one made with ‘Desmos’.
Attachment
Attachment
0
hack.clubber

General:

  • I fixed some bugs:
    • Graphics flickering.
    • Input not registering.
  • And I also added a camera so you can look around.
  • And I also added Error checking for input.

Game-engine:

  • I added a new function for if you only want to use a single buffer.
  • I changed some misleading variable names and function names.
0
hack.clubber

Done:

  • Made a Semi-Working evaulater.
  • You can now graph funcs but they’re looking at the wrong direction.

To Do:

  • Improve the parser to handle more than one x value.
  • Add operator presidence.
  • Add support for negative numbers.
Attachment
Attachment
0
hack.clubber

Everything already done

  • Windows Input system and renderer
  • Basic CLI game-engine
  • Pong game

Future plans

  • I’m planning on adding the math evaluater.
  • Adding a menu bar with usefull tools.
  • Implementing the graphing calculator.

pong

  • Implement ball physics, collisions and UI tweaks.
  • I finished the pong game.
Attachment
Attachment
0
hack.clubber

game

  • Added bounds checking.
  • Stopped using hard coded ball position.
  • Added a start screen.

general

  • Added docs template.
  • Improved Makefile.
0
hack.clubber
  • Improved the rendering API.
  • Fixed bug where the console wouldn’t fully get cleared.
  • Added a games directory and made it a basic pong template.

  • Added option to compile game and grapher separately in the Makefile.
0
hack.clubber

Add a new math subsystem and integrate it into the project build and main flow.

  • Add src/core/math/math.c and math.h: implement square(), cube(), a tokenizing parse() function and a stub evaluate() (currently returns 0). parse() allocates token strings and returns count.
  • Update makefile to include the math source for win and unix targets.
  • Modify renderer: move buffer initialization into swap_buffers() (removed init_buffers implementation) so cursor info is set when swapping.

These changes wire a new math parser into the app and refactor the renderer behavior; evaluate() is still incomplete and will need implementation and memory management review for parse() allocations.

Attachment
0
hack.clubber
  • I tried making the character move with WASD which made me realize my old code didn’t work as expected so I switched input detection on windows from using <conio.h> to <windows.h>.
  • And as you see the new input system works very well.

  • Also planning to add docs for anyone who wants to use the game-engine by itself for himself…
2

Comments

nmsoukmandjiev007
nmsoukmandjiev007 about 2 months ago

Woah that looks super cool! This is rlly unique as well. Good luck on it!

hack.clubber
hack.clubber about 2 months ago

Thanks dude

hack.clubber

Rename and simplify renderer functions, add FPS control, and add keyboard constants.
init_win_cli() -> init_renderer(), clear_con() -> clear_console(), swap_buffers(float) -> swap_buffers() and a new set_fps(float) were introduced.
init_renderer() now sets a default fps of 60.
main.c updated to use the new renderer API (init_renderer, clear_console, swap_buffers) and removed the old cursor positioning usage.
Also added KEY_A..KEY_Z defines to src/input/win_input.h for letter key codes.

Will add a camera system and a status bar with usefull commands in the future.

Attachment
0
hack.clubber

Introduce key constants and input helper functions (esc_pressed, key_pressed, arrow_key_pressed) in win_input.* to centralize keyboard handling. Add draw_char and draw_chars wrapper functions in renderer to encapsulate WriteConsoleOutputCharacterA usage and update main to use draw_char. Minor whitespace/comment cleanup in main.

Attachment
Attachment
0
hack.clubber

Refactor codebase to separate Windows and Unix platform layers and improve build targets.

  • Makefile: add CC/CFLAGS, variables, and explicit win and unix targets; run now uses the built binary. Unix build is stubbed with a helpful message (unix support not implemented yet).
  • Platform refactor: rename/move Windows-specific modules: src/input.c -> src/input/win_input.c and src/win_cli.c -> src/renderer/win_renderer.c; corresponding headers moved/renamed under input/ and renderer/.
  • Additions: add placeholder Unix sources/headers (src/input/unix_input.* and src/renderer/unix_renderer.*) to prepare for Unix support.
  • Remove cli_os_layer.h and replace with conditional includes in main.c (#ifdef _WIN32 / #else) to include the correct platform headers.
  • API change: swap_buffers parameter type changed from int to float; implementation adjusts Sleep timing (Sleep(fps / 3.75)) and call site updated from swap_buffers(16) to swap_buffers(60.0).

These changes prepare the project for cross-platform support and cleaner separation of platform-specific code while improving the build workflow for Windows. Unix implementation remains to be completed.

Attachment
0
hack.clubber

Made basic text rendering with double buffering to reduce flicker.

0