Page 1 of 14 12311 ... LastLast
Results 1 to 15 of 201

Thread: Bad Company Manager (ApiMod for Servers)

  1. #1
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1

    Bad Company Manager (ApiMod for Servers)

    Source Code

    For the precompiled binary:
    Bad Company Manager - Version 16.2_b7.1

    Version 16.2_b7.1

    All commands are prefixed with bc- by default.

    In the Mods/BCM/DefaultConfig folder is a Commands.xml file that allows you to change the command text, and in the sub folders are the help and description text files for each command that is displayed in game.

    Any command that doesn't have a text file will display the class name of the command for the description, and an empty help file by default. I have plans for an auto help generator based on command aliases and allowable params, but that's down the list at this stage.

    Current Commands
    (See second post for an examples of the output)

    bc-help - BCHelp, this command will return the full list of commands added by BCM, and some details on common /options

    Output from the bc-help command:
    Code:
    ***Bad Company Commands***
    bc-help => (BCM) BCHelp - Provides a list of all active BCM commands, and info about /options
    bc-lp => (BCM) List Players
    bc-lpbag => (BCM) List Players Bag (Backpack)
    bc-lpbuffs, bc-lpbuff => (BCM) List Players Buffs
    bc-lpci, bc-lpcinfo => (BCM) List Players Client Info
    bc-lpcrafts, bc-lpcraft => (BCM) List Players Crafting Queue
    bc-lpequip => (BCM) List Players Equipment (Worn Items)
    bc-lpx, bc-x => (BCM) List Players Extensive Data
    bc-lpfavs, bc-lpfav => (BCM) List Players Favourite Recipes
    bc-lpgs, bc-gs => (BCM) List Players Gamestage Values
    bc-lpids, bc-lpid => (BCM) List Players SteamId and EntityId
    bc-lppos => (BCM) List Players Position
    bc-lpquests, bc-lpquest => (BCM) List Players Quests
    bc-lprecipes, bc-lprecipe => (BCM) List Players Unlocked Recipes
    bc-lpskills, bc-lpskill => (BCM) List Players Skills
    bc-lpspawns, bc-lpspawn => (BCM) List Players Spawns (Bedroll)
    bc-lpstats => (BCM) List Players Stats
    bc-lptools, bc-lptool => (BCM) List Players Toolbelt
    bc-lpwayp, bc-lpwayps, bc-lpwaypoints => (BCM) List Players Waypoints and Marker
    bc-gpq, bc-gpquest => (BCM) Give Quest To Player
    bc-rpq, bc-rpquest => (BCM) Remove Quest From Player
    bc-gpb, bc-gpbuff => (BCM) Give Buff to Player
    bc-rpb, bc-rpbuff => (BCM) Remove Buff From Player
    bc-le => (BCM) List Entities Data
    bc-geb, bc-gebuff => (BCM) Give Buff to Entities
    bc-lhcd, bc-hcd => (BCM) List HubCell Data - A list of all prefabs in a given HubCell
    bc-arch, bc-archetypes => (BCM) List Archetypes
    bc-biomes => (BCM) List World Biomes
    bc-biomespawns => (BCM) List Biome Spawning
    bc-blocks => (BCM) List Blocks
    bc-buffs => (BCM) List Buffs
    bc-lec, bc-entityclasses => (BCM) List Entity Classes
    bc-leg, bc-entitygroups => (BCM) List Entity Groups
    bc-items => (BCM) List Items
    bc-loot => (BCM) List Loot
    bc-mats, bc-materials => (BCM) List Materials
    bc-prefabs => (BCM) List Prefabs
    bc-quests => (BCM) List Quests
    bc-recipes => (BCM) List Recipes
    bc-skills => (BCM) List Skills
    bc-spawners => (BCM) List Spawners
    bc-trash => (BCM) Mem Trash - Runs Garbage Collection to try and free up Memory on the server
    ***Options***
    /log => Send the command output to the log file
    /chat => Send the command output to chat
    /console => Override command default settings for /log or /chat
    /color=FFFFFF => Specify a color for text sent to chat
    /details => For commands that support it, will give more details on items returned
    /nodetails => Override command default settings for /details
    /online => For ListPlayers commands it will display only online players (default shows all players)
    /offline => For ListPlayers commands it will display only offline players
    /all => Override command default settings for /online or /offline
    ***Output Format Options***
    /nl => Uses a newline to seperate items (can be combined with /csv)
    /csv => Uses a comma to seperate items (can be combined with /nl)
    /nocsv or /nonl => Override command default settins for /csv and /nl
    /csvpos =>  Converts all Vector3 co-ords to csv seperated (default is space seperated)
    /worldpos => Converts all Vector3 co-ords to Map Co-ords
    /spacepos => Override command default settins for /csvpos or /worldpos
    Plans
    * Add localisation configuraton commands
    * Chat hooks to allow for running all commands from chat instead of console
    * Extensive plans for entity spawning systems and event management
    * (partially implemented) A fully featured web interface that allows for viewing all of this data live, and eventually the ability to manipulate many parts of the game from a remote web browser (no telnet required).
    * Full data tracking of inventory, position, quests, buffs, crafting, and other stats over time.

    Credits
    Alloc, danilocoppi, and dmustanger ApiMods provided great inspiration, thanks to them for their efforts!
    Last edited by StompyNZ; 2 Weeks Ago at 05:47 AM. Reason: 16.2_b7.1

  2. #2
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    Output Examples

    An example of the ListPlayersExtensive command (too big to post here):

    https://gist.github.com/StompyNZ/afa...75a06b144dff6a
    Last edited by StompyNZ; 01-02-2017 at 12:35 AM.

  3. #3
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    Known Issues

    Buffs that were on the player when they join a server do not get listed in the live player data. This is an issue with the TFP code that I havn't been able to find a workaround for. (Hence the list of live buffs, and saved buffs)

    Some stats, such as players bags only update when there is a loot change, or every 30 seconds. When you loot an item the player data is saved, but if you move an item from bag to worn (armor etc) then the equiped items updates immediately, but the bag list has to wait until the player is saved.

    All the data being pulled from the .ttp files should be moved to the persistent container, as there is a potential for a non fatal error if the game tries to save a player at the same time as the mod is reading the file. (rare occurance)

    Some stats are not stored in the .ttp file, and need to be pushed to the persistant container so that they can be retrieved when a player is offline

    Command playername and entityid lookups only work when that player is online. SteamId will work at all times.
    Last edited by StompyNZ; 01-07-2017 at 11:35 PM.

  4. #4
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    Going to be renaming this to Bad Company Manager as it is quickly expanding out beyond just a few console commands.

    I have created a command framework that I'm fairly happy with. It allows you to specify the console commands details via a text file without recompiling the dll, and both the description and help files are in text files, with a subfolder for different languages so it has localisation for the command help as an option. When its done you will be able to specify the default language for the server, but individual players will be able to specify their preference if they want.

    I'll be uploading the source in the next few days once I get some more of the framework nailed down, then I can really start working on the new commands.

  5. #5
    Guppycurian Forum Whore Guppycur's Avatar
    Join Date
    Apr 2014
    Location
    Houston-ish, Texas
    Posts
    15,317
    Rep Power
    1
    Awesome blossom.

  6. #6
    Tracker BeatKidz's Avatar
    Join Date
    Oct 2015
    Location
    East Coast USA
    Posts
    229
    Rep Power
    1
    Great work. I wrote a command that has been EXTREMLY helpful for server admin work. Its just a simple "Who owns this" command for secure doors and chests So i can easily figure out who's chest i'm in. I took a look at coppies unlockall command to figure out the basics.

  7. #7
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    Quote Originally Posted by BeatKidz View Post
    Great work. I wrote a command that has been EXTREMLY helpful for server admin work. Its just a simple "Who owns this" command for secure doors and chests So i can easily figure out who's chest i'm in. I took a look at coppies unlockall command to figure out the basics.
    Yeah between Allocs, Coppis, and Server tools there are some nice examples of how to do a lot of things. Other bits took a fair bit of trail and error to see what worked.

    Finding the right place for different stats etc was a mission, bit I have most of it sorted now. I'm in the process of breaking it down into seperate model files for each bit so its modular and I can grab the bits I need for each command without having to duplicate code.

    The first useful command I'll be looking at after the purely infomational commands is a quest updated tracker (for Guppy). It will provide a list of quest changes over time, and can pop a log/console message out when changes are spotted.

    I'm thinking of having a heartbeat ticker that runs in the background and triggers the checks periodically for events that are tied to it.

  8. #8
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    Updated with new version and mod rename.

  9. #9
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    Mostly finished a new component (uploaded to source) that adds a timer that allows actions to be performed at set intervals.

    The system has a Heartbeat object that has a pulse and configurable beats per minute (new System.xml file in config)
    The system also has Synapses and Neurons. The Synapse defines 1 or more Neurons that will be fired at set intervals. Currently, the synapses can be adjusted in the config for enabled/disabled, and how many beats between each firing. I will be adjusting the code a bit so that which neurons are attached to a synapse is configurable as well.

    The default heartbeat is 60 bpm, and the first synapse I'm working on is the quest monitor for GuppyCur that pops a message into the log when a players quest list changes.

    The Neurons will require some c# coding, however, some of them will be able to make use of config files, such as the spawning ones.

    This is the basis of the system I will be using to create the dynamic spawning system that allows the default spawning system to be entirely replaced.

  10. #10
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    Mostly have the quest monitor working, but something isnt quite right when used on a fresh presistent data container, so will need to keep working on it.

    For a break I have made a command to return a list of all prefabs from the hub cell data in a single cell, or all cells, or filters by text. The version that searches the full list is very HDD intensive so takes about 15 seconds to run on my local machine, but since the data is static i will add a saved file that contains the data to reduce the subsequent lookups.

    https://docs.google.com/spreadsheets...t#gid=13099823 is a google doc with some examples of the data it gives you.

    ListHubCellData.cs is the code for anyone that is interested. I will make a new release with a compiled dll in a day or two once I get my questmonitor command working correctly.

  11. #11
    Guppycurian Forum Whore Guppycur's Avatar
    Join Date
    Apr 2014
    Location
    Houston-ish, Texas
    Posts
    15,317
    Rep Power
    1
    What's up with those y coordinates. That's odd.

  12. #12
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    Quote Originally Posted by Guppycur View Post
    What's up with those y coordinates. That's odd.
    I'm clamping the height to make a flat world for prefab building

    <module name="clampOutput" type="ClampOutput">
    <property name="sourceModule" value="scaleBiasOutput"/>
    <property name="bounds" value="1,1"/>
    <!-- <property name="bounds" value="-28,190"/>-->
    </module>

    If you look at the vanilla tab is has a lot more variation in the y co-ord

  13. #13
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    Lot of changes uploaded to source. I'll tidy up a few things and Finish the List Game Objects commands and add a param to filter results and do the 1.1.0 release with a dll tomorrow.

    Managed get a memory efficient cache working for the hub cell data results, so only the first use after a server reboot will be slow, after that its less than 1 second even ruturning the entire 6000+ prefab list.

    I've unified most of the commands and added /options for affecting the output such as /log /chat /csv /nl /color /worldpos /csvpos and a few command specific ones (like /current for the hub cell data command)

    doing bc-lhcd /nl /chat isnt advised

  14. #14
    Guppycurian Forum Whore Guppycur's Avatar
    Join Date
    Apr 2014
    Location
    Houston-ish, Texas
    Posts
    15,317
    Rep Power
    1
    Geesh...

  15. #15
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,366
    Rep Power
    1
    I think it might even be possible to add dynamic changes to various game objects then call the save method and save the xml back out to the server xml's. This has some real potential.

    I'm going to be playing with randomly generated archetypes and entities today to see whats possible there too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •