Lightweight Quest and Event Engine

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    I am working on a few project right now for linux in bash. The main one is a quest wrapper for the server, Light vs Dark. I am also building some of the back-end tools necessary for an "event engine." The difference between quests and events is that quests are initiated by the player. Events happen regardless of whether any player takes part or not. For example, a quest may be instanced or it may not be, but the player will not know about it or be able to do it till they start the quest. An event may occur while they are out mining. Perhaps they get a ":: Incoming transmission ::" message and are informed of a distress call nearby.

    Right now the initial quest engine is operational, but not yet complete. The event engine is not functional yet, but some of the back-end has been done. I will talk about the quest engine for now and will update this post later to include information on the event engine, once I have a working prototype.

    The first iteration of the quest wrapper is designed to be very light weight and compatible with other wrappers, running on top of them. This wrapper reads the chat logs for commands to be run. When a quest is started, the quest scripting is run in a unique "screen," so that the wrapper can continue running for other players. Because of this, the scripting is very light weight. It does not parse the main StarMade log or the console output, which is oftentimes gunked up with thousands or tens of thousands of lines per second of output from the server. This is also limiting though because it cannot rely on the console output for information. Instead it must use admin console commands to retrieve information and then act on it.

    Here is what it can do now:
    • The quest has the following commands, which players can type into the main chat window or a special "Chat command" chat room:
      !quests -or- !quest list
      !quest start [Quest Name]
      !quest stop
      !quest info [Quest Name]

      Here are a few images showing their usage:








    • These commands allow the player to list the available quests they have. It will not include any quests they already done for the day. The player can also start the quest, end it, or get information on a specific quest.
    • The scripting will only allow a player to do each quest once per day.
    • Create an instanced quest for a player with a timeout.
      - The moves a player to a special quest sector, and then manages the quest.
      - The "instance" is an exported sector that has been imported for the player automatically. The script loads the exported sector into the quest coordinates and then moves the player there. It can also be configured to move the player to an exact point within the quest sector. For example, in front of the command chair of a ship in that quest.
      - When the quest ends, the player is moved back to exactly where they started, including their coordinates and spacial coordinates within that sector.
      -The instance is ended either by the countdown timer OR by the player, when they type the "!quest end" command.
    • The sector that is used for the quest can be one of the following:
      1. In a unique sector for each player, very far away from the main galaxy.
      This is based on the location of that player's personal test sector, but it is not the same coordinates. Each one of these coordinates is at least 1 system away from any another player's quest sector. Thus these sectors can be claimed by a faction and are far enough from each other that player's will not be able to interfere in each other's instanced quest. However, this it is not recommended to allow players to claim the sector for their faction, because the sector is so far away from the main galaxy. It leads to an insane draw on faction points and would destroy factions. To allow claiming of the quest sector, the custom faction point numbers for the server config needs to be set to a "0" penalty for both distance from the home base and distance from the galaxy center. Unless this is actually an intended result, destroying a player's faction.

      2. It can be set to any fixed set of coordinates which will be shared by all players.
      These coordinates will then be shared by all players who participate in the quest. So, for example, if two players start that same quest, both will be transported to the coordinates for the quest. I am planning on diversifying this a bit, to allow players from allied, neutral, or enemy factions to either help each other or deny each other success in the quest. I also will be expanding on the custom coordinates system to allow unique sectors to be used by factions. So, for example, only faction members will be joining the same quest sector together to work toward a common goal and it will exclude anyone else.
    • There are config files for quests, which allow customization.
      - Quest sector customization:
      Will the quest remove all or some entities from the sector when the quest is ended? The options are All/asteroids/ships/bases/planets. Will it use the /sector_chmod command to set "protected," "peace," "noenter," "noexit," "nofploss" for the sector (or unset it) when the quest sector is being set up initially? Will the system be unclaimable? Should the faction claim be reset at the end?
      - Quest sector bot messaging:
      Will a bot message be sent to the player upon starting and ending of the quest? For the "!quest info" command, what text should be displayed to describe the quest to the player?
      - Custom Quest Scripting:
      The quest can use a custom script for each individual quest. This script allows for much deeper and richer quests than simply plopping a player into a sector, giving them a custom message and then letting them have at it till the timeout. This custom script might handle dialogue, ship spawning, timing, and whatever else the admin want to do in the quest. For example, a quest I have created called "Mineapalooza" has complex dialogue, info and warning pop-ups, enemy ship spawns, and turns on and off the "noindications" flag for the quest sector when certain events are initiated by the quest. It also keeps checking the quest to ensure the player is still online and participating. If the custom script detects that the player is no longer in the sector or online, then it moves the player's ship back to where the player started and then destroys everything else in the sector. If the player went offline, and was not in their ship, they will find themselves in an empty sector upon returning. The player can then type "!quest end" to return back.

    • The quest has some permissions built in. These are what can currently be set in the quest config:
      -Only allow admins to run the quest - This is useful for beta testing.
      -Not allow "build sector" players from participating. - This is another feature on my server which allows players to perform creative mode building with commands.
      -Not allow a player to bring in a ship.
      -Require a player to bring in a ship. The max weight allowed can be specified.
      -Should it require the player have voted for the server on starmade-servers.com before they can start the quest?
    Because it does NOT parse the main log file for StarMade, it much faster, but has many limitations. It can only rely on existing starmade commands. So here are some examples of what it cannot do:
    • Since there is no command to view a player's inventory, it cannot "remember" a player's inventory. If a server is set to have players drop their items upon death, those items will drop in the quest sector.
    • It cannot stop a player from setting their death respawner to the quest sector and possibly getting stranded there.
    • It cannot set the spawn point for an individual player, since there is no console command to do this. Only an admin logged into the server can set a player's individual spawn point to the admin's current location.
    • It cannot detect exactly when a player dies, because it relies on scripts to periodically check to see if the player is still in the quest sector.
    • It cannot detect what the player is shooting at, because that kind of information is only in the main starmade log.
    • It cannot detect if a player spawns in a ship using a blueprint. Though I could add this kind of functionality into a script that creates a listing of all entities in the quest at the start and then periodically compares to a second listing, checking for new entities, and then acting on this (for example, sending those entities back to the sector the player started at).
    Here are some of the things I have planned to add to the functionality of the scripting or to prepare it for release:
    • Right now there is only a custom quest sector for individual players or 1 static sector for that quest. However, I would like to expand on this, by:
      1. Adding a "FactionsQuestSector" option for a quest's config file. This would instance the quest using a set of coordinates that is custom to the faction that the player is in. This would allow factions to participate in the quest together.
      2. Adding a "RandomGalaxyCoords" and "RandomNearbyGalaxyCoords" options for the quest sector. These would use randomized coordinates but within the known galaxy and not near any stars or black holes. The second option would be nearby the player in an empty sector. These quests may be instanced or not. If not instanced, the player will have to physically move to that quest sector to take part in it. These quests also may or may not have a timeout set for them. They may become a new base spawned somewhere in the galaxy or they are simply destroyed after the timeout.
    • For faction quests and public quests, I would like these to have certain limitations. For example, perhaps anyone from the factions can only complete the quest once per day. Or maybe only founders can initiate the quest and then other members can join in. Or maybe it depends on how many players are in the faction. For example, maybe only 3 members can compete at a time, and the total number the quest can be completed is equal to the size of the faction divided by 3.
    • Allow different intervals for quests. Right now players can only do each quest once per day, but what if the quest is designed to be done once every 4 hours? Or once a week?
    • I need to modify the way I scripted it to be easily configurable. Right now, I have many different scripts with custom variables set to my server. I need to make 1 configuration file that is used and then a configuration script to set it up.
    • Once I release the scripting to the public, I need to have a way for it to auto-update. I have not given this much thought yet because I am simply working on the core functionality right now.
    • I need to set up example quests and tutorials on how to set up the quest config, how to create a quest sector export, and how to do the custom scripting for a specific quest.
    After I have completed the lightweight quest system, I will be creating a more robust version that will parse the main starmade log file. This will use high fidelity C++ compiled programs to do the parsing, to allow much greater efficiency. This will require installation of additional programs. However, this more complicated system will allow much more customization of the quests. Note that it remains to be seen how this may or may not reduce server performance, because the StarMade main log can really become overloaded with server messages, forcing parsing on every single line. It will need to be very efficient to not impact a server. This system may also be more complicated to use. So I will probably make this more complete wrapper solution be an optional part, but it will be there for anyone that wants to use it.

    Once this more robust wrapper solution is set up, here are some examples of the new functionality that will be available for quests:
    • When a player claims ownership of an entity, something might happen right away. For example, maybe the quest ends and they are given a prize.
    • When a player opens an inventory, something might happen.
    • A player might enter a specific location of a quest and then something happens, perhaps ships are spawned in, or a wall entity is removed, revealing a bunch of enemy pirate astronauts.
    • The script will be able to tell what a player is shooting at or attacking and then act on it. For example, an NPC faction may be used in the quest. If the player shoots at anything owned by that faction, war is declared and ships are spawned into the quest sector.
    • If a player attempts to jump out of the sector, perhaps the scripting will move them to another quest sector.
    • If the player is taking damage, perhaps dialogue will pop up and ally ships are spawned in.
    • If a player dies, they could be teleported back in to the quest immediately, thus giving the appearance of a temporary respawn point.
    • If a player exits the game, the quest might "hibernate", stopping the countdown timer. And then restart the timer when the player rejoins the game.
    These are just part of what I would like to release in my final version. But I am still somewhat new to scripting in linux, so this all will take some time. But, it is my hope to really give something back to the community and to help make StarMade more fun for everybody. And I think a quest engine is one of the ways I can do that.
     
    Last edited:
    • Like
    Reactions: JumpSuit and Bogdan
    Joined
    Dec 16, 2013
    Messages
    130
    Reaction score
    83
    • Legacy Citizen 2
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen
    Hey Benevolent27,
    Good to have another person working on server wrappers. There's plenty that has yet to be explored in the area, starmade could certainly use more of us.

    This looks to be very interesting, quests could definitely add more for players to do more than the normal grind we see these days. I'll need to check out the Light vs Dark server sometime when I find the time. Looks like you guys are doing some interesting things with scripting over there.

    In the area of linux or starmade wrapping, if you need anything just ask. I'm happy to assist, and I'm sure the other wrapper authors are as well.

    Happy scripting!

    - Jeryia
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    Hey Benevolent27,
    Good to have another person working on server wrappers. There's plenty that has yet to be explored in the area, starmade could certainly use more of us.

    This looks to be very interesting, quests could definitely add more for players to do more than the normal grind we see these days. I'll need to check out the Light vs Dark server sometime when I find the time. Looks like you guys are doing some interesting things with scripting over there.

    In the area of linux or starmade wrapping, if you need anything just ask. I'm happy to assist, and I'm sure the other wrapper authors are as well.

    Happy scripting!

    - Jeryia
    Great, thanks! I just might take you up on that. I've been scripting for 20 years, so design is something I understand well, but linux scripting is new to me, so I am rather slow. lol
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    Just to show the first quest I created, "Mystery Box."
    The player is moved to an quest instance sector and is locked in. They spawn inside of a small shuttle ship and have to fly over to the box and then move inside. Right now there are about 5 secrets to find. Eventually I'd like to have different versions of the same quest that happen randomly, so players will need to figure out the secrets and then also be able to identify which box they are in to know how to solve whatever puzzles are inside.

     
    Joined
    Dec 16, 2013
    Messages
    130
    Reaction score
    83
    • Legacy Citizen 2
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen
    I like that quest,
    It adds a bit of a exploration and mystery to the game instead of the normal 'fly around and shoot things, or mine'.

    Though I think it would be awesome to have it instead of a thing you type !quest to do, it would be something the player could randomly run into(to encourage general exploration). Then have them get a message saying something like 'You're detected an alien artifact. Type !quest_start to check it out'. Just a thought.

    I am curious as to what is inside the Mystery Box that would interest players in exploring it.
     
    • Like
    Reactions: Az14el

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    I like that quest,
    It adds a bit of a exploration and mystery to the game instead of the normal 'fly around and shoot things, or mine'.

    Though I think it would be awesome to have it instead of a thing you type !quest to do, it would be something the player could randomly run into(to encourage general exploration). Then have them get a message saying something like 'You're detected an alien artifact. Type !quest_start to check it out'. Just a thought.

    I am curious as to what is inside the Mystery Box that would interest players in exploring it.
    I am working on this actually. I created a "SDialogue" language to help manage interactions with NPCS. If you go to the "Shady Patron" at our spawn, I am currently betatesting it. Just type "!talk" when you are near the NPC. Then you can reply to what he says with the "!reply [number]" command. If you say the right things, it will start a quest for you.