Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Gustavo6046

Musical Redemption Community Project

Recommended Posts

So, looking at my past, it seems my music is SHIT. I laughed at it! I really make way better music nowadays!

This inspired me to do something to help the other guys that still are struggling to compose.

Give them a chance to practice more while composing to this project!

(like NOVA series, only musical)

Theme: Any (as long as you don't pick a theme you're bad at)

This is the workflow: The advanced musicians makes examples for the novices to listen and get inspired to make their musics better. All in this channel!-- I mean thread :P (I'm getting addicted with roleplaying in IRC)

What did you think of the workflow?

(This thread is also to keep the novice composers practicing so they don't lose the hang in something they are just starting to grasp :P )

Share this post


Link to post

This is actually much better than your previous works, I'll try to revamp it so you can see how much actual potential it has.

Share this post


Link to post
Fonze said:


Yes but it's so fun! I even made a Sentient Mushes game based on the roleplay we did for 2 days, in Python (it's a IRC bot):

Spoiler

from json import load
import os
import socket
import sys
import time
import random
import json
import threading

start = time.time()
exiting = False

joined = 0


class SMException(BaseException):
    pass


class BossSystemError(SMException):
    pass


class GiverThread(threading.Thread):
    def __init__(self, threadID, name):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name

    def run(self):
        while True:
            time.sleep(3.0 - ((time.time() - start) % 3.0))
            for p in players:
                players[p]["health"]["self"] += players[p]["healthrate"]
                if players[p]["health"]["self"] > players[p]["maxhealth"]:
                    players[p]["health"]["self"] = players[p]["maxhealth"]
            if exiting:
                break


t = GiverThread(1, "Spore thread")

t.start()

addr, port = sys.argv[1].split(":")
port = int(port)
name = sys.argv[2]

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

sock.connect((addr, port))

sock.setblocking(False)

sock.send("NICK " + name + "\r\n")
sock.send("USER " + name + " " + name + "_ " + name + "__ :" + name + "\r\n")


def calcdamage(player):
    damg = players[fr]["damage"]
    if players[player]["transferred"]:
        damg = players[player]["transferdata"]["damage"]
    for f in players[fr]["friends"]:
        damg += things[f]["damage"] * players[fr]["friends"][f][0]
    return damg


def damage(player, amt):
    if players[player]["transferred"]:
        players[player]["transferdata"]["health"] -= amt
        if players[player]["transferdata"]["health"] <= 0:
            players[player]["transferdata"] = None
            players[player]["transferred"] = False
    else:
        players[player]["health"]["self"] -= amt
        if players[player]["health"]["self"] <= 0:
            players.pop(player)


def gethealth(player):
    if players[player]["transferred"]:
        return players[player]["transferdata"]["health"]
    return players[player]["health"]["self"]


def getmaxhealth(player):
    if players[player]["transferred"]:
        return players[player]["transferdata"]["maxhealth"]
    return players[player]["maxhealth"]


def say(txt, to):
    to = to.strip()
    sock.sendall("PRIVMSG " + to + " :" + txt + "\r\n")


def notice(txt, to):
    sock.sendall("NOTICE " + to + " :" + txt + "\r\n")


def action(txt, to):
    sock.sendall("PRIVMSG " + to + " :\01ACTION " + txt + "\01\r\n")


try:
    f = open("save." + name + ".json", "r")
    dat = json.load(f)
    f.close()
except:
    dat = {}

locations = {
}

players = {
}

things = {
}

bosses_attacked = {
}

battlerequests = []


def befriend(player, thing):
    players[fr]["numfriends"] += 1
    players[player]["friends"][thing] = players[player]["friends"].get(thing, [0, 0])
    players[player]["health"][thing] = players[player]["health"].get(thing, 0)
    players[player]["friends"][thing][0] += 1
    players[player]["friends"][thing][1] += 1
    players[player]["health"][thing] += things[thing]["health"]


def cmd_attack(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    try:
        thing = " ".join(cmd[1:]).lower()

    except IndexError:
        say(fr + ", specify a boss to kill!", ch)
        return

    if thing not in players:
        if thing not in things.keys():
            say(fr + ": Thing non-existant!", ch)
            return

        if not things[thing]["boss"]:
            say(fr + ": The thing is not a boss!", ch)
            return

        attackers = [boss["attackers"] for boss in bosses_attacked.values() if boss["type"] == thing]

        for x in attackers:
            attackers.remove(x)
            attackers.append(*x)

        if fr not in attackers:
            bosses_attacked[thing + str(len([boss for boss in bosses_attacked.values() if boss["type"] == thing]))] = {
                "type": thing, "health": things[thing]["health"], "attackers": [fr]}
            say(fr + " started an attack against a {} of {}!".format(thing, players[fr]["place"] - 1), ch)
            return

        boss = None

        for x in bosses_attacked:
            if fr in x["attackers"]:
                boss = x
                break

        if boss is None:
            raise BossSystemError("An boss was falsely detected as being attacked by fr!")

        bosses_attacked[thing + str(bosses_attacked.values().index(boss) + 1)]["health"] -= calcdamage(fr) / (
            2 if players[fr]["transferdata"] == {} or players[fr]["transferdata"]["host"] not in things[thing][
                "weakhosts"] else 1)
        boss["health"] -= calcdamage(fr)

        say(fr + " dealt {} damage to a {} boss!".format(calcdamage(fr) / (
        2 if players[fr]["transferdata"] == {} or players[fr]["transferdata"]["host"] not in things[thing][
            "weakhosts"] else 1), thing), ch)

        if bosses_attacked[thing + str(bosses_attacked.values().index(boss) + 1)]["health"] < 0:
            bosses_attacked.pop(bosses_attacked[thing + str(bosses_attacked.values().index(boss) + 1)])
            players[fr]["experience"] += things[thing]["exp"]
            damage(fr, -(getmaxhealth(fr) / 2))
            say(fr + " succesfully killed a {} *boss*!! He was awarded with {} exp and {} health.".format(thing,
                                                                                                          things[thing][
                                                                                                              "exp"], -(
                    getmaxhealth(fr) / 2)), ch)
            return

        damage(fr, things[thing]["damage"])

        if gethealth(fr) < 0:
            players.pop(fr)
            say(fr + " died trying to kill a {}! He is out of the game and will have to rejoin.".format(thing), ch)


def cmd_available(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    if len(cmd) == 1:
        place = locations[players[fr]["place"]]
        message = ""
        cango = ""
        for thing_type, amount in place[1].iteritems():
            if len(message) != 0:
                message += ", "
            message += "{} {}s".format(amount, thing_type)
        for c in place[0]:
            if len(cango) != 0:
                cango += ", "
            cango += c
        say(fr + ": Things available at your location: " + message, ch)
        say(fr + ": You can go to: " + cango, ch)


def cmd_dumpthings(cmd, fr, ch):
    message = fr + ": Things available: "

    for thing in things.keys():
        if message[-2] == ":":
            message += thing
        else:
            message += ", " + thing

    say(message, ch)


def cmd_dumplocations(cmd, fr, ch):
    message = fr + ": Locations available: "

    for location in locations.keys():
        if message[-2] == ":":
            message += location
        else:
            message += ", " + location

    say(message, ch)


def cmd_harvest(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    try:
        thing = " ".join(cmd[1:]).lower()

    except IndexError:
        say(fr + ", specify a thing to harvest souls from!", ch)
        return

    if thing not in players:
        infthing = thing.replace("random ", "")

        if infthing not in things.keys():
            say(fr + ": No such thing!", ch)
            return

        if locations[players[fr]["place"]][1].get(infthing, 0) <= 0:
            say(fr + " can't find a " + infthing + "!", ch)
            return

        if things[infthing]["boss"]:
            say(fr + ": .attack to attack bosses!" + infthing + "!", ch)
            return

        if things[infthing]["damage"] > gethealth(fr):
            players[fr]["dead"] = True
            players[fr]["health"] = 0
            say(fr + " has died trying to harvest souls from a {}! He's out of the game!".format(cmd[1]), ch)
            players.pop(fr)
            return

        elif things[infthing]["health"] < calcdamage(fr):
            say(fr + " harvests " + str(things[infthing]["souls"]) + " souls from a " + infthing + "!", ch)
            damage(fr, things[infthing]["damage"])
            locations[players[fr]["place"]][1][infthing] -= 1
            players[fr]["souls"] += things[infthing]["souls"]
            return

        else:
            say(fr + " doesn't have enough damage points to kill a {}!".format(thing), ch)


def cmd_where(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    say(fr + " is at " + players[fr]["place"], ch)


def cmd_join(cmd, fr, ch):
    global joined

    if fr in players:
        say(fr + " is already playing!", ch)
        return

    players[fr] = {"place": "start", "numfriends": 0, "friends": {},
                   "health": {"self": 200}, "maxhealth": 200, "healthrate": 0.0,
                   "spores": 10, "maxspores": 10, "experience": 0, "attacking": None, "upgradepoints": 0,
                   "damage": 15, "souls": 1, "dead": False, "transferred": False, "transferdata": {}}
    joined += 1
    say(fr + " joined the game at start.", ch)


def cmd_transfer(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    try:
        thing = " ".join(cmd[1:]).lower()
    except IndexError:
        say(fr + ", specify a thing to transfer to!", ch)
        return

    if thing not in players:
        infthing = thing.replace("random ", "")

        if locations[players[fr]["place"]][1].get(infthing, 0) <= 0:
            say(fr + " can't find a " + infthing + "!", ch)
            return

        if things[infthing]["immune"] > players[fr]["spores"]:
            say(fr + " didn't transfer to a " + infthing + " because he didn't have enough spores!", ch)

        if things[infthing]["damage"] > gethealth(fr):
            players.pop(fr)
            say(fr + " has died trying to transfer to a {}! He's out of the game!".format(cmd[1]), ch)
            return

        locations[players[fr]["place"]][1][infthing] -= 1
        players[fr]["spores"] -= things[infthing]["immune"]
        players[fr]["transferred"] = True
        players[fr]["transferdata"] = {}
        players[fr]["transferdata"].update(things[infthing])
        players[fr]["transferdata"]["maxhealth"] = players[fr]["transferdata"]["health"]
        players[fr]["transferdata"]["host"] = infthing
        return


def cmd_spores(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    say(fr + " has " + str(players[fr]["spores"]) + "/" + str(players[fr]["maxspores"]) + " spore(s).", ch)


def cmd_health(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    say(fr + " has " + str(gethealth(fr)) + "/" + str(getmaxhealth(fr)) + " health, +" + str(
        players[fr]["healthrate"]) + " health per 3 seconds.", ch)


def cmd_upgrade(cmd, fr, ch):
    if players[fr]["upgradepoints"] < 1:
        say(fr + " tried to upgrade something without the points", ch)
        return
    if cmd[1] == "health":
        say(fr + " upgrades maximum health.", ch)
        players[fr]["maxhealth"] += 30
        players[fr]["health"]["self"] = players[fr]["maxhealth"]
    elif cmd[1] == "healthregen":
        say(fr + " upgrades health regeneration.", ch)
        players[fr]["healthrate"] += 2
    else:
        return
    players[fr]["upgradepoints"] -= 1


def cmd_stats(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    say("{} has {}/{} experience points, {} souls and {} damage points.".format(fr, players[fr]["experience"],
                                                                                30 + players[fr]["maxspores"] * 2,
                                                                                players[fr]["souls"],
                                                                                calcdamage(fr)), ch)


def cmd_parsejson(cmd, fr, ch):
    if len(cmd) < 2:
        say(fr + ": Not enough parameters!", ch)
        return

    try:
        fname = os.path.join("jsondir", cmd[1])
        if ".." in fname:
            return
        parsed_json = json.load(open(fname))
        locations.update(parsed_json.get("Locations", {}))
        things.update(parsed_json.get("Things", {}))
        things.update(parsed_json.get("Enemies", {}))

    except BaseException as error:
        say(fr + ": Error loading file: " + str(error), ch)
        return

    say(fr + ": JSON parsed succesfully!", ch)


def cmd_infect(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    if players[fr]["spores"] < 1:
        say(fr + " doesn't have enough spores!", ch)
        return

    thing = " ".join(cmd[1:]).lower()
    if thing not in players:
        infthing = thing.replace("random ", "")
        if locations[players[fr]["place"]][1].get(infthing, 0) <= 0:
            say(fr + " can't find a " + infthing + "!", ch)
            return
        befriend(fr, "mush")
        locations[players[fr]["place"]][1][infthing] -= 1
        players[fr]["experience"] += 5
        if players[fr]["experience"] >= 30 + players[fr]["maxspores"] * 2:
            players[fr]["experience"] = 0
            players[fr]["upgradepoints"] = 2
            players[fr]["maxspores"] += 4
            say(fr + " infects " + infthing + " and gets a minion! " + fr + " gets four more spore capacity!", ch)
        else:
            say(fr + " infects " + infthing + " and gets a minion! +5 XP!", ch)
        players[fr]["spores"] -= 1
        return


def cmd_befriend(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    thing = " ".join(cmd[1:]).lower()
    if thing not in players:
        infthing = thing.replace("random ", "")
        if locations[players[fr]["place"]][1].get(infthing, 0) <= 0:
            say(fr + " can't find a " + infthing + "!", ch)
            return
        say(fr + " befriends a " + infthing + "!", ch)
        befriend(fr, infthing)
        locations[players[fr]["place"]][1][infthing] -= 1
        players[fr]["spores"] += 1
        return


def cmd_fixit(cmd, fr, ch):
    say(
        "FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT FIXIT",
        ch)
    time.sleep(2.5)
    say("FIXIT FIXIT FIXIT", ch)


def cmd_boot(cmd, fr, ch):
    action("kicks everyone", ch)


def cmd_go(cmd, fr, ch):
    if fr not in players:
        say(fr + ": start playing first!", ch)
        return

    place = " ".join(cmd[1:]).lower()
    if place not in locations:
        say(fr + ": unknown place", ch)
        return

    if place not in locations[players[fr]["place"]][0]:
        say(fr + " can't go to " + place, ch)
        return

    if len(locations[place]) > 2:
        if locations[place][2] == "requires-empty":
            tally = sum(locations[players[fr]["place"]][1].values())
            if tally > 0:
                say(fr + " tried to go to " + place + " even though there are still things there...", ch)
                return

    players[fr]["place"] = place
    say(fr + " is now in " + place + "!", ch)


def cmd_trade(cmd, fr, ch):
    if len(cmd) < 2:
        say(fr + ": How many strenght points?", ch)
        return

    try:
        if players[fr]["souls"] > int(cmd[1]) + 1:
            players[fr]["damage"] += int(cmd[1])
            players[fr]["souls"] -= int(cmd[1])
            say(fr + ": You traded {0} souls for {0} damage points succesfully!".format(int(cmd[1])), ch)

        else:
            say(fr + ": You don't have enough souls!", ch)

    except ValueError:
        say(fr + ": Invalid number!", ch)

    return


def cmd_help(cmd, fr, ch):
    cmdhelp = {
        "attack": "Attack the boss",
        "available": "Find available locations and things",
        "harvest": "Harvest a soul from an animal",
        "join": "Start playing",
        "transfer": "Transfer into a host",
        "infect": "Infect an animal",
        "befriend": "Befriend an animal",
        "go": "Go somewhere",
        "spores": "Show the stats for spores",
        "health": "Show health, max health and health regen",
        "where": "Find out where you're currently at",
        "upgrade": "Upgrade something",
        "stats": "Find out how much of experience points, damage points and souls you have",
        "locations": "Know of every location in the game! (including parsed JSON addons)",
        "things": "Know of every thing in the game! (including parsed JSON addons)",
    }
    if len(cmd) == 1:
        say("Commands:", fr)
        say(
            " .availables, .attack, .harvest, .join, .transfer, .infect, .befriend, .go, .spores, .health, .stats, .where, .upgrade, .things, .locations",
            fr)
        say(
            "You are a sentient mush trying to avenge the humans for having they take you from your home planet, "
            "Tamina.",
            fr)
        say("You start on the start location.", fr)
        say("You can befriend or infect animals, good luck!", fr)
    else:
        say(cmdhelp.get(cmd[1], "unknown command"), ch)


commands = {"attack": cmd_attack, "available": cmd_available, "harvest": cmd_harvest, "upgrade": cmd_upgrade,
            "where": cmd_where,
            "join": cmd_join, "transfer": cmd_transfer, "spores": cmd_spores, "health": cmd_health, "stats": cmd_stats,
            "infect": cmd_infect,
            "befriend": cmd_befriend, "go": cmd_go, "help": cmd_help, "parsejson": cmd_parsejson, "trade": cmd_trade,
            "things": cmd_dumpthings, "locations": cmd_dumplocations, "fixit": cmd_fixit, "boot": cmd_boot}


def run_cmd(cmd, fr, ch):
    global exiting
    if ch != "#sentientmushes":
        if fr == "Gustavo6046":
            if cmd.strip()[0] == "#":
                sock.send("JOIN " + cmd.strip() + "\r\n")
            elif cmd == "quit":
                sock.send("PART #sentientmushes :Good game! Bye!\r\n")
                exiting = True
            else:
                sock.send(cmd.strip() + "\r\n")
        else:
            catchphrases = [
                "You are not authorized to access the inner workings of me. Please pick up the Argent Energy on the way here to activate the red keycard.",
                "Noooooooooooooooooooo *SPLAT*",
                "Please press the RED button that says 'DO NOT PRESS'.",
                "YOU JUST GOT BOOTED!",
                "/me kicks you",
                "You need 35000 souls to enter The Dungeon.",
                "Do not enter at your own risk. I would then die, and I would be forced to kick you.",
                "I AM A ROBOT STOP PLEASE INSERT MY KAMIKAZE SPHERE SO I CAN BLOW YOU UP STOP",
                "... wat",
                "You are attempting to enter The Core. Please wait FIVE seconds for me to blow you up.",
                "BEEP BOOP I AM A ROBOT YOU ARE STUPID BEEP BOOP STOP",
                "Oh snap! Something went wrong!",
                "YOU JUST GOT KICKED!!",
                "Meet my brother, SMBot2!",
                "Deja Vu!",
                "Deja Vu!",
                "_.-'|STUPIDSTUPIDSTUPID|'-._",
                "Please wait FIVE seconds for the crusher to hit you.",
                "You got 1-UP",
                "You lost all your coins!",
                "You got 500 coins!",
                "oOxX SUPA MLG 360 NOSCOPE HEADSHOT XxOo",
                "HEADshOT",
                "Beep boop, I'm a bot. You're stupid.",
                "Do you know what you need most? AUTOCORRECT!",
                "Do you know why you're talking to me? AUTOCORRECT!",
                "/me enables my autocorrect",
                "/em disvalxaf i's grommur end speltib coar"
            ]

            say(random.choice(catchphrases), fr)
        return

    cmd = cmd.split(" ")

    if cmd[0] in commands:
        try:
            commands[cmd[0]](cmd, fr, ch)
        except BaseException as e:
            say(fr + ": command " + cmd[0] + " failed: " + e.__class__.__name__ + ": " + str(e), ch)
            # else:
            # say(fr + ": unknown command " + cmd[0], ch)


try:
    while True:
        if exiting:
            break
        try:
            text = sock.recv(2048)
            if text:
                print text
        except:
            text = ""
            pass

        if text.startswith("PING "):
            sock.sendall("PONG " + text.split(" ")[1] + "\r\n")

        if text.startswith("ERROR "):
            break

        try:
            thing = text.split(" ")[1]
        except:
            thing = ""

        if thing == "PRIVMSG" and text.find(":") != -1:
            msg = text.split(" ", 3)[3][1:].strip()
            fr = text[1:].split("!")[0]
            chan = text.split(" ")[2]

            if len(msg) == 0:
                continue

            if chan == name:
                run_cmd(msg, fr, fr)
            else:
                if msg[0] == ".":
                    cmd = msg[1:].strip()

                    run_cmd(cmd, fr, chan)
                elif msg.startswith("@" + name):
                    cmd = msg[len(name) + 1:].strip()

                    run_cmd(cmd, fr, chan)
        elif thing == "KICK":
            text = text.split(" ")
            if text[3] == name:
                if len(joined) == 0:
                    sock.sendall("JOIN :" + text[1] + "\r\n")
finally:
    exiting = True

Share this post


Link to post

Bump; forgot to respond to some posts.

DoomLover234 said:

This is actually much better than your previous works, I'll try to revamp it so you can see how much actual potential it has.


I'm waiting. :)

Spoiler

walter confalonieri said:

At first i was thinking of making good maps with "bad" music...

lol

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×