Creating a scripting language for your game or application

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
wearymemory
Chaos Rift Junior
Chaos Rift Junior
Posts: 209
Joined: Thu Feb 12, 2009 8:46 pm

Creating a scripting language for your game or application

Post by wearymemory »

There are quite a few scripting languages out that have been developed specifically for a game or application, whether they are variants of different languages, or adapt their own unique style.

I personally believe that this adds a more unique feel to your application, as well as gives its users who wish to integrate their ideas with your application more freedom to do so. However, I do believe that it varies from program to program whether or not something like this should be implemented, and I think that's obvious.

Code: Select all

crumb Guard is Npc {
    spit(player) gives number {
        if(player:isBlack()) {
            return swallow(player, "kill()", "take(money)", "send(jail)");
        }
        return swallow(player);
    }
}
This is an implementation of a concept of the Crumpet scripting language created by a friend and myself.

In the game that this scripting language was to be used, the players could freely kill one another, but they would receive a limit, and once that limit was breached, the player's name would turn black, and if they were killed, they had a chance to lose their equipment. And if that player wandered into city limits, and a Guard saw him, the above commands would be parsed and executed. There was a lot more than just this, but I've forgotten most if it.

This language wasn't at all designed to be intuitive or easy to use. Thoughts of implementing a new error-- "GiveUpAllHopeError," and a new Boolean value, "maybe," were considered as being a permanent part of the language. This language was designed for what was going to be our community, so that we could gawk at their laughable attempts at trying to use and understand our complex language.

Spoon: Thoughts, ideas, etc.
User avatar
wtetzner
Chaos Rift Regular
Chaos Rift Regular
Posts: 159
Joined: Wed Feb 18, 2009 6:43 pm
Current Project: waterbear, GBA game + editor
Favorite Gaming Platforms: Game Boy Advance
Programming Language of Choice: OCaml
Location: TX
Contact:

Re: Creating a scripting language for your game or application

Post by wtetzner »

wearymemory wrote:

Code: Select all

crumb Guard is Npc {
    spit(player) gives number {
        if(player:isBlack()) {
            return swallow(player, "kill()", "take(money)", "send(jail)");
        }
        return swallow(player);
    }
}
Just out of curiosity, do you have an actual implementation of this language? Because the more complex it is, the more difficult it will be to implement.
Also, is there a reason you're passing "kill()", "take(money)", and "send(jail)" as strings?
wearymemory wrote:This language was designed for what was going to be our community, so that we could gawk at their laughable attempts at trying to use and understand our complex language.

Spoon: Thoughts, ideas, etc.
I don't think you'd get much of a community of people programming in this language if it's too complex.

On the other hand, C++ is amazingly popular, as well as being amazingly complex, both to use (most people just use a subset of it) and to implement (it's basically unparseable), so what do I know?
The novice realizes that the difference between code and data is trivial. The expert realizes that all code is data. And the true master realizes that all data is code.
User avatar
thejahooli
Chaos Rift Junior
Chaos Rift Junior
Posts: 265
Joined: Fri Feb 20, 2009 7:45 pm
Location: London, England

Re: Creating a scripting language for your game or application

Post by thejahooli »

wearymemory wrote:

Code: Select all

if(player:isBlack())
:lol: Doesn't it seem a bit racist
I'll make your software hardware.
wearymemory
Chaos Rift Junior
Chaos Rift Junior
Posts: 209
Joined: Thu Feb 12, 2009 8:46 pm

Re: Creating a scripting language for your game or application

Post by wearymemory »

wtetzner wrote: Just out of curiosity, do you have an actual implementation of this language? Because the more complex it is, the more difficult it will be to implement.
Also, is there a reason you're passing "kill()", "take(money)", and "send(jail)" as strings?

I don't think you'd get much of a community of people programming in this language if it's too complex.

On the other hand, C++ is amazingly popular, as well as being amazingly complex, both to use (most people just use a subset of it) and to implement (it's basically unparseable), so what do I know?
No, this is just a concept of what really would be Crumb or Crumpet-Lite, but none of this has actually been implemented. It was merely supposed to be a joke between our developers, but we would have provided sufficient enough resources for our community to make some sense out of it.

Yes, there is a reason that the methods are being passed as String Objects. We just haven't come across that reason yet.
Also, I wanted to use Java's "..." operator, so maybe that's a reason.

Also, I recommended a 100 millisecond wait time before and after sending data to each client, so what do I know about online game programming?...Or maybe I'm just vindictive enough that I'd blame the lag on the community and make them pay for a dedicated line.
thejahooli wrote:
wearymemory wrote:

Code: Select all

if(player:isBlack())
:lol: Doesn't it seem a bit racist
I didn't type that! I'm not racist! Uhhh...I'll go yell at the others.
Post Reply