Jump to content

  • Log In with Google      Sign In   
  • Create Account


C-Lesh Game Interpreter in JavaScript


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 C-Lesh   Members   -  Reputation: 124

Posted 28 April 2012 - 08:18 PM

This is a project that I've been tackling for the past few years. This is currently version 3 of C-Lesh. So what is C-Lesh? It's a programming language much like basic that is geared towards creating 2D games for www.c-lesh.net and publishing them on the site. Now for a little bit of history.

I started this project way back... probably like in 2005. Originally, I wanted to create an interpreter for the Calc Basic language. For those of you who don't know what that is it's basically the language of the TI-82 calculator. Anyways, this is relevent to me because I started programming on the TI-82. So I created this thing in C++. It was crude but could run text games on the terminal window. For those of you who remember Worm-Lang many many years ago (Does anyone remember?) you'll know what I'm talking about. However, the first version of C-Lesh could not output pixels - just text. I then proceeded to work on another version of C-Lesh and released the old one on SourceForge sometimes in 2008.

The first version of C-Lesh was crude. All variable were predefined as letters like in Calc Basic and there were no lists so programming was a challenge. This sucked so I began working on C-Lesh 2. The newer version included lists which could be configured to a specified size. It could also output graphics. I did manage to write a game in this language but it was sloppy. Like the first version the language has no subroutines, jumps, or memory allocation. All memory is fixed and defined by the programmer. This may seem to suck but on the bright side there is no need for garbage collection or freeing of memory.

So now there is this version of C-Lesh written entirely in JavaScript. I originally wrote version 3 in Java using an applet to implement the interpreter but that caused problems with porting. So I decided to do the thing in JavaScript and challenge myself. The compiler and interpreter are all written in JavaScript. JavaScript has gotten fast and there is even an NES emulator written in it that runs at a decent speed. This is one of the things that inspired me to do this.

C-Lesh 3 is much like basic but with fixed memory. As mentioned before there are no subroutines, jumps, or dynamic memory allocations. Basic control structures like if...else...end-if and while...end-while exist. All statements are in command format as so: output [STR_HELLO] at 0 0 C-Lesh does not do string processing just numbers so strings must be loaded at initialization time. There are also commands to deal with lists which are called segments in this language. C-Lesh outputs to the HTML 5 canvas which is embedded in the page - much better than using Java applets. They suck! You can also create text maps for levels like this:

xxxxxxxxxxxxxxxxxx
x p x
x x
xxxxxxxxxxxxxxxxxx

x = wall
p = player

These can then be loaded into the game.

You can write your games online test them. You can pull the code from the site because it's saved. Just download <your program>.clsh. If you have any questions, comments, or want tutorials just send a message to me. As a side note I haven't fully tested the language and it is still a work in progress so let me know.

The interpreter resides on my website. You can get there via the link in my signature. You do not need to register an account or anything. Have fun!

Nerd's Quote: "If you stare at a computer for 5 minutes you might be a nerdneck!"
C-Dev: http://www.francoiscdev.com - Home of the game development language C-Lesh and the Super Mario World game engine!


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS