Author Topic: In-Game Programming Language  (Read 1342 times)

This has been killing me since I got the game (about a year ago).
Why doesn't Blockland have an IN-GAME programming language, this would add a whole new level of creativity that wrench events cannot offer.

I have thought about it and I have determined that the language should be BASIC, JavaScript, or Objective-C based.
I believe that Objective-C style would be best, it's fairly easy to learn.

Example
Code: [Select]
/* Finds brick with given name and sets it's color to red */
Brick *brick;
NSString *name;

name = @"brickName";
brick = [[Brick alloc] initWithExistingBrick:name];
[brick setColor: [NSColor colorWithCalibratedRed:1.0f green:0.0f blue:0.0f alpha:1.0f]];
[brick commitChanges:nil];
...Or...
Code: [Select]
/* Creates new brick */
Brick *brick;
BrickShape *shape;
NSString *name;
NSColor *color;

name = @"brickName";
color = [NSColor colorWithCalibratedRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; /* White BTW */
[shape setStyle:@"cube"]; /* Style can be "cube", "flat", "special", etc. */
[shape setWidth:20]; /* 20 units wide */
[shape setHeight:20];
[shape setLength:20];
[shape setPrint:NO]; /* Set whether or not the brick is a print brick */
[shape setXCoord:0 yCoord:0 zCoord:0];

brick = [[Brick alloc] initWithName:name shape:shape color:color];
The code could be assigned to a specific brick, like wrench events.


This would add a whole new level of functionality.
Thanks.

Let's say you wanted to run some code only if a specific condition is true, or maybe create a line of bricks.
Here is the code...
Code: [Select]
/* Run if condition is true... */
Brick *brick;
NSString *name;
name = @"brickName";

brick = [[Brick alloc] initWithExistingBrick:name];

if (brick.printChar == "A") {
   /* Some Code... */
}
...Or to create a line of bricks...
Code: [Select]
Brick *brick;
BrickShape *shape;
NSString *name;
NSColor *color;
NSInteger count;

name = @"brickName";
color = [NSColor colorWithCalibratedRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; /* White BTW */
[shape setStyle:@"cube"]; /* Style can be "cube", "flat", "special", etc. */
[shape setWidth:20]; /* 20 units wide */
[shape setHeight:20];
[shape setLength:20];
[shape setPrint:NO]; /* Set whether or not the brick is a print brick */

while (count < 5) {
   [shape setXCoord:count yCoord:0 zCoord:0];
   brick = [[Brick alloc] initWithName:name shape:shape color:color];
}
« Last Edit: June 03, 2009, 02:00:07 AM by TheGermanKid »

Truce was planning on doing something like this back in the day.

Truce was planning on doing something like this back in the day.
Really?

Really?
Yeah he was going to make a clientside based game in a gui where you could play a game like "tic tac toe" while playing blockland.  It was going to use a custom made scripting language that even a monkey could learn.

Yeah he was going to make a clientside based game in a gui where you could play a game like "tic tac toe" while playing blockland.  It was going to use a custom made scripting language that even a monkey could learn.
Interesting,
I think that the language should not be really easy to learn, because then you get stuff like Applescript.

Well if it was easy it opens it up to having alot of people of all ages to make there own games.

Well if it was easy it opens it up to having alot of people of all ages to make there own games.
I see what you mean, but simple languages teach bad programming habits (originating out of Visual BASIC, I know)

I see what you mean, but simple languages teach bad programming habits (originating out of Visual BASIC, I know)
Most people that would use it will never learn another scripting language and if they do they learn better ways of script and away from the bad habits.

Most people that would use it will never learn another scripting language and if they do they learn better ways of script and away from the bad habits.
True

The majority of blockland users are kids - kids don't want to have to learn some weird language to make a brick that explodes when you click it. Furthermore, why would we need to declare variables before using them? That is only necessary when reserving memory - and this won't interact with memory directly.

The methods you've proposed for creating bricks on-the-fly will also not work without overhauling the brick networking and convincing them not to require datablocks. I am convinced Badspot will not be willing to devote the time required to make something like this when the vast majority of users would not take the time to use it or try to understand it. Getting people to understand events was hard enough - kids will not be able to learn this.
« Last Edit: June 03, 2009, 08:06:09 AM by Ephialtes »

The majority of blockland users are kids - kids don't want to have to learn some weird language to make a brick that explodes when you click it. Furthermore, why would we need to declare variables before using them? That is only necessary when reserving memory - and this won't interact with memory directly.

The methods you've proposed for creating bricks on-the-fly will also not work without overhauling the brick networking and convincing them not to require datablocks. I am convinced Badspot will not be willing to devote the time required to make something like this when the vast majority of users would not take the time to use it or try to understand it. Getting people to understand events was hard enough - kids will not be able to learn this.
This would not REPLACE wrench events, it would be in addition to wrench events
And it is not necessary to declare variables before using them, I did that to show a bit more of the language.

My point still stands, why devote so much development time to something that barely 1% of the userbase would use?

Oh, the thing I was working on before I went inactive was a client-sided support script that allowed experienced scripters to use simple functions to connect multiple clients via TCPObjects. The example I had gave was a game of Tic-Tac-Toe without any of the users being on the same server. It did however use a custom set of functions, but it's not like C -> VisualBasic. It's more just TorqueScript -> Easier-to-read Torquescript.

I haven't worked on it in awhile though.