Dark Bit Factory & Gravity

PROGRAMMING => Other languages => Topic started by: Chalisque on April 18, 2013

Title: Forth like machines for embedded scripting in demos
Post by: Chalisque on April 18, 2013
Most demos, by their nature, have a fixed design.  Most fascinating to me are those which fit in a small space.  What I am pondering is an interactive demo which is in some way programmable.  For this, there must be a programming system which by its nature needs to be small and powerful, and this points to Forth.  I am wondering if anybody else has been thinking along these lines?
Title: Re: Forth like machines for embedded scripting in demos
Post by: Canopy on April 18, 2013
often demo's and games have their own scripting using LUA


but other than that the other option is live shader programming?

a'la www.shadertoy.com
Title: Re: Forth like machines for embedded scripting in demos
Post by: hellfire on April 18, 2013
I'm not getting the connection between "interactivity" and "forth" but I remember a 4k intro which was stored as forth-instructions (which are much smaller than the x86-cisc instruction-set) and translated to x86-opcodes at runtime with an own just-in-time compiler.
Unfortunately I don't remember its' name...
Title: Re: Forth like machines for embedded scripting in demos
Post by: Chalisque on April 28, 2013
Thanks,  that's all i needed to know.  Someone else has thought of that trick.  There are good real world uses, but I was wondering whether someone had realised it could be used for demo purposes.  The interactivity thing with forth is that forth programs can write and compile their own forth programs with no help from outside their userspace.  They do this in a very small space.  The user can insert words into a running program to totally change how the program runs, and the words can change other things which change behaviours.  You could write a small 64k demo using a forth engine to visualise cryptographic hashes as pretty graphics (which I guess is what they do in Hollywood all the time).