Allegro.cc - Online Community

Allegro.cc Forums » The Depot » Ramen, a 2D game engine for standard Forth - 1.6.0

This thread is locked; no one can reply to it. rss feed Print
Ramen, a 2D game engine for standard Forth - 1.6.0
roger levy
Member #2,513
July 2002

Peter Hull
Member #1,136
March 2001

I watched the video. Very interesting, well done :D

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

roger levy
Member #2,513
July 2002

It's no replacement but it is huge fun once you learn it, which isn't hard. You can get to a point where you are rolling off ideas like you are dictating directly to the computer. Here's the meat of the pink bouncing ball's script:

: >bounce  sin abs negate 24 * ;
: draw-bouncer  draw> zofs 65 tile ;
bouncer :to start
    draw-bouncer 0 perform>
        begin 3 + dup >bounce z !  pause again ;

Factor out a couple theoretical utility words and you could do the same thing with even less effort:

bouncer :to start  65 draw-ztile  0 perform> 3 24 sinbounce ;

The possibilities are almost intoxicating. No types, no headers, no compile time (it's instantaneous). It's a limited space, but it has strengths.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

roger levy
Member #2,513
July 2002

It's simple just read it left to right. Parameters go first, i.e. it's postfix so you don't 1 + 2 you 1 2 +. : and ; start and end a function definition and apart from flow control (if/then) and understanding the VM and dictionary that's pretty much it.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

roger levy
Member #2,513
July 2002

Because it compiles fast, and actually it's easier, there's never any ambiguity about order of operation and it's easier to factor.

I actually think the version you wrote out is a headache! Understanding the transformations numbers go through step-by-step is effortless in postfix. :)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

You said read it from left to right, and that made no sense at all.

If it was prefix, it would be :

* 24 negate abs sin bounce

, and it would be perfectly clear to any human being what it did. Postfix notation may be easier to pop on and off a stack, but it's not worth it. You made coding harder so compiling would be easier. That's not a trade-off I'm willing to make.

Niunio
Member #1,975
March 2002
avatar

A game engine to make games with FORTH? Nice!!!

I actually never used FORTH but I made a scripting language inspired by it, even used it in a game engine mock-up to build interactive fiction games. It was pretty easy to use, actually.

-----------------
Current projects: Allegro.pas | MinGRo

roger levy
Member #2,513
July 2002

:) That's totes the idea! When I found out about Forth 15 years ago I was so intrigued with the simplicity and after I got the hang of it it was so much fun. I'm hooked.

I've been feeling a little restricted capabilities-wise so I'm working on a physics module using Chipmunk2D. Also have plans to create a basic 3D rendering module.

I'm doing it for me primarily but I'm always hoping one day there'll be a small userbase.

Go to: