Stanford Tulpa Study looking for more participants
(if you're chosen they'll pay for travel and lodging!)

Poll: How good this is?
You do not have permission to vote in this poll.
10/10**********
0%
0 0%
11/10***********
0%
0 0%
12/10************
0%
0 0%
13/10*************
0%
0 0%
14/10**************
0%
0 0%
15/10***************
0%
0 0%
17/10****************
0%
0 0%
18/10*****************
0%
0 0%
19/10******************
0%
0 0%
20/10*******************
100.00%
2 100.00%
Total 2 vote(s) 100%
* You voted for this item. [Show Results]

Create Stuff Easy!
#1
I'm very create mang. Newest Design!!

http://www.phudbase.com/wm_client/

host:
192.210.137.155
port:
8888

Create wonderland and tupacs with ease!
Will the BBB please buy my guide. [advertising link scrubbed]
Reply

Sponsors:
Lolflash - click it, you know you want to

#2
Wow, you can even make Tupac?
Reply
#3
Can't connect... and your English is poor.
"Try to get a better understanding of things before making your judgement." -Khan, Metro 2033
Reply
#4
I wasn't able to create, mang. I'll give it a 20/10******************* for the effort, though.
Reply
#5
How do i use it?
The host and port dont work.
*Forgive me for any mistakes in english language.
DA: http://red-duke.deviantart.com/
Reply
#6
So I'm not the only one having trouble. Looks like the TC may be having server trouble.

Anyway, this looks like it's supposed to be a MUD. It's a multiplayer online text-only game, in which players can create characters and areas through a combination of writing and coding. You can find some other MUDs through mudconnect.com or mudstats.com, if you're interested. Both sites have some MLP games. Pony characters might not be so welcome in non-pony oriented games (although RetroMUD is hard fantasy, and will allow unicorn characters).
Reply
#7
Sorry guys, I got bored. There's some bugs so it'll crash randomly. I'll leave it running one more time until it crashes. So have fun until then if you see this in time.

Here's the source if anyone wants to host it themselves. Just "node whateveryounamethefile.js " and make a file called save.txt in the same directory as it, to save to. It's shit, but w/e guys. Runs on port 8888.
Code:
var net = require('net');

var sockets = [];

/*
* Cleans the input of carriage return, newline
*/
function cleanInput(data) {
    return data.toString().replace(/(\r\n|\n|\r)/gm,"");
}

/*
* Method executed when data is received from a socket
*/
function receiveData(socket, data) {
    var cleanData = cleanInput(data);
    if(cleanData == "look"){
        socket.write( game.look(socket.gameLocation) );
            console.log(game.ents);

    }else if(cleanData.substring(0,6) == "enter "){
    
        if(game.ents[cleanData.substring(6)]){
            socket.gameLocation = cleanData.substring(6);
            socket.write( game.look(socket.gameLocation) );
        }else{
                for(var i=0; i<game.ents[socket.gameLocation].contains.length;i++){
                    if(game.ents[game.ents[socket.gameLocation].contains[i]].name==cleanData.substring(6)){
                        socket.gameLocation = game.ents[socket.gameLocation].contains[i];
                        socket.write( game.look(socket.gameLocation) );
                        return(0);
                    }
                }
            }
            
    }else if(cleanData == "exit"){
        socket.gameLocation = game.ents[socket.gameLocation].parent;
        socket.write( game.look(socket.gameLocation) );
    }else if(cleanData.substring(0,7) == "create "){
        socket.write(chatCreateEnt(socket.gameLocation, cleanData.substring(7)));
    }else if(cleanData.substring(0,4) == "del "){
        socket.write(chatDelEnt( socket.gameLocation,cleanData.substring(4)) );
    }else if(cleanData == "save"){
        pie = JSON.stringify(game.ents);
        console.log(pie);
        fs = require('fs');
        fs.writeFile("./save.txt",pie,function (err){
            if(err) throw err;
            console.log("It's saved!");
        });
    }
    
    
    if(cleanData === "@quit") {
        socket.end('Goodbye!\n\r');
    }
    
}

//chat command delete entity
function chatDelEnt(parentId,data){
    //if it's an ent id, check if it's in the parent and if so, delete it.
    if(game.ents[data]){
        for(var i=0; i<game.ents[parentId].contains.length; i++){
            if(game.ents[parentId].contains[i] == data){
                game.delEnt(data);
                return("Deleted it, nigga.\n\r");
            }
        }
    }else{
        for(var i=0; i<game.ents[parentId].contains.length; i++){
            if(game.ents[game.ents[parentId].contains[i]]){
                if(game.ents[game.ents[parentId].contains[i]].name == data){
                    game.delEnt(game.ents[parentId].contains[i]);
                    return("Deleted it, nigga.\n\r");
                }
            }
        }
    }
    return("nigga pls\n\r");

}    

//chat command create entity
function chatCreateEnt(parentId,data){
    game.addEnt(parentId, data);
    return("You create a "+data+".\n\r");
}

/*
* Method executed when a socket ends
*/
function closeSocket(socket) {
    var i = sockets.indexOf(socket);
    if (i != -1) {
        sockets.splice(i, 1);
    }
}

/*
* Callback method executed when a new TCP socket is opened.
*/
function newSocket(socket) {
    console.log("new socket: "+socket.remoteAddress);
    socket.setTimeout(2*60*1000);
    socket.gameLocation = 0;
    sockets.push(socket);
    socket.write("Welcome!\n\rType \u001B[1;32mcreate\u001B[0;0m ___ to create something.\n\rType \u001B[1;32mdel\u001B[0;0m ___ or del # to delete something\n\rType \u001B[1;32mlook\u001B[0;0m to look.\n\rType \u001B[1;32menter\u001B[0;0m ____ or enter # to enter that thing.\n\rType \u001B[1;32mexit\u001B[0;0m to exit the place you're in.\n\rType \u001B[1;32m@quit\u001B[0;0m to exit the game\n\rType \u001B[1;32msave\u001B[0;0m to save the server. There's no autosave. If the server crashes and no one's saved recently, you're \u001B[1;32mfucked\u001B[0;0m!\n\r");
    socket.write( game.look(socket.gameLocation) );
    socket.on('data', function(data) {
        receiveData(socket, data);
    })
    socket.on('end', function() {
        console.log("closing socket"+socket.remoteAddress);
        closeSocket(socket);
    })
}

function ent(id, parent, name, creator){
    this.id=id;
    this.name=name;
    this.creator=creator;
    this.parent=parent;
    this.contains=[];
}

function Game(){
}

Game.prototype.init = function(){
    fs = require('fs');
    var saveFile;
    fs.readFile("./save.txt", function read(err, data){
        if(err){
            throw err;
        }
        saveFile = data;
        game.ents = JSON.parse(saveFile);
        console.log("loaded save file");
        console.log(game.ents);
    });
    //this.ents = [new ent(0,0,"The Beginning","God")];
}

Game.prototype.addEnt = function(parent, name){
    
    for(var i=0; i<this.ents.length;i++){
        if(this.ents[i]==null){
            this.ents[i]=new ent(i, parent, name, "anon");
            this.ents[parent].contains.push(i)
            return(i)
        }
    }
    this.ents[parent].contains.push(this.ents.length);
    this.ents.push(new ent(this.ents.length,parent,name,"anon"));

}

Game.prototype.delEnt = function(id){
    //delete the items inside
    if(this.ents[id].contains.length){
        for(var i=0; i<this.ents[id].contains.length; i++){
            this.delEnt(this.ents[id].contains[i]);
        }
    }
    //delete it from the parent's contains list.
    for(var i=0; i<this.ents[this.ents[id].parent].contains.length; i++){
        if(this.ents[this.ents[id].parent].contains[i] == id){
            this.ents[this.ents[id].parent].contains.splice(i,1);
        }
    }
    this.ents[id]=null;
    //this.ents.splice(id,1);
}
            
Game.prototype.look = function(id){
    locationString = "You are in "+this.ents[id].name+". You see ";
    for(var i=0; i<this.ents[id].contains.length;i++){
        locStr="["+this.ents[id].contains[i]+"]"+this.ents[this.ents[id].contains[i]].name+" ";
        locationString=locationString.concat(locStr);
    }
    return(locationString+".\n\r");
}
    
// Create a new server and provide a callback for when a connection occurs
var server = net.createServer(newSocket);

// Listen on port 8888
server.listen(8888);

game = new Game();

game.init();

(05-12-2014, 07:01 AM)jean-luc Wrote: If there's enough interest I could host this.

It's really not worth it. I got bored before adding anything cool to it. Basically all you can do now is create, delete, enter, and look. I don't think any particular features would make this worth playing.

ex: create Dr Pepper
enter Dr Pepper
create My Tupper
create Grass Field
create lake
look
"You see My Tupper, Grass Field, and lake"
enter lake
create a boat.



Entire 'game' is that. While making it, I thought it might be fun, but SURVEY SAYS: nope!
Will the BBB please buy my guide. [advertising link scrubbed]
Reply
#8
If there's enough interest I could host this.
Reply
#9
I would like that.
Reply
#10
Host please!
*Forgive me for any mistakes in english language.
DA: http://red-duke.deviantart.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)

Sponsors:
Lolflash - click it, you know you want to