Skip to content

noahzweben/Ballr

Repository files navigation

Ballr

A simple 2D game language

To test Pretty Printing:

(if change anything) sh run.bat

./ballr < Ballr_helloworld/helloworld.blr

SSH

If ssh-ing into virtual machine, make sure to use -X to enable X-forwarding. Will allow screen to be displayed

Building

To build a Ballr game, from the root directory type make <filename>.game . This will build the compiler if it has changed, look for a file called <filename>.blr, use the ballr executable to compile this to LLVM, and then build this LLVM file and link it with the runtime located at runtime/build.

Codegen

Codegen should be broken down into the following steps:

  • entites: To generate the code for entities, each needs a create function and a frame function. The create function will take a pointer to the entity as an argument, and is responsible for setting the entities given values for size, color, et cetera. The frame function is what the events compile to. Every frame, the runtime will call each entity's frame function, which checks for event conditions and executes the code if needed.

  • gameboards: Each gameboard should have a create function and an init function. The create function behaves the same as the entity's create func, while the init function corresponds directly to the code after the init => block in the gameboard definition.

  • main(): when generating the main method, we basically create each gameboard using that board's create funciton. Then, register_gb lets the runtime build a list of boards keyed by name, so that later (for functions like load()) we just refer to boards by their name. After creating the game boards, main() calls run_loop() to start the execution of the game.

Currently, no errors found

Obligatory Jokes

Why did the Ballr entity break up with the gameboard?

Because every frame it kept checking for events, but nothing ever collided. 🏀

How does a Ballr developer fix a flat tire?

They just call create() again — it's faster than patching the runtime. 🛞

Why did pong.blr go to therapy?

Years of being stuck in a run_loop(), just bouncing between the same two paddles. 🏓

Why did the LLVM backend refuse to play flappy.blr?

It took one look at the codegen and said "I'm not touching that — it's un-optimizable." 🐦

What's a Ballr entity's least favorite pickup line?

"Are you a bounding box? Because I feel a collision coming on." 💥

About

A simple 2D game language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors