magico13

[1.1.2] B.R.O.K.E. - Beta 4 - 05/26/2016 - Now with gameplay!

Recommended Posts

5 minutes ago, JeffreyCor said:

Sure can, I always try to save a log from a test fail just in case it was needed

https://www.dropbox.com/s/798xkhwiuj8xf1f/output_log.MKS-Lite.txt?dl=0

Found the bug.  Same bug I just fixed in ShipSections. The BROKE loader code doesn't safely handle dlls with missing dependencies.  I'll add that to the list of things to fix!

Share this post


Link to post
Share on other sites

So I don't know how feasible this is, but how about a budget graph over time. Not strictly necessary, but seeing an in game graph of how the amount of Funds my Space Program has, has changed over the past 3 years, would be quite useful.

Share this post


Link to post
Share on other sites
20 hours ago, ThatOneBritishGuy... said:

So I don't know how feasible this is, but how about a budget graph over time. Not strictly necessary, but seeing an in game graph of how the amount of Funds my Space Program has, has changed over the past 3 years, would be quite useful.

If we can figure out how to make a graph, then maybe.

Share this post


Link to post
Share on other sites
36 minutes ago, jkortech said:

If we can figure out how to make a graph, then maybe.

A table would be easier, and we could easily make it output the data to a format like .csv for plotting in an external program. I do know other mods have made graphs before though, like the memory monitor (I think GCMonitor or something like that).

Share this post


Link to post
Share on other sites
On 23/03/2016 at 8:45 PM, magico13 said:

I do know other mods have made graphs before though, like the memory monitor (I think GCMonitor or something like that).

F.A.R. has some, so does R.P.M. (kinda. It prints to a buffer image, I think, and uses that as a prop texture).

Just found out about this. I play K.C.T. Like this!

Share this post


Link to post
Share on other sites

I found out about this mod the other day, though I don't want to install it because I'm playing 1.1. Is this mod compatible with 1.1? If not I'll wait. :D

Share this post


Link to post
Share on other sites
58 minutes ago, yorshee said:

I found out about this mod the other day, though I don't want to install it because I'm playing 1.1. Is this mod compatible with 1.1? If not I'll wait. :D

It's not yet and I likely won't get it updated to 1.1 until the end of April (at which point I'll be able to finish it). There's a chance that @jkortech will update the existing code to 1.1 before then but that's up to him. All my big deadlines are toward the end of April and after them I should have considerably more time for hobbies.

Share this post


Link to post
Share on other sites
On 3/22/2016 at 0:07 AM, jkortech said:

If we can figure out how to make a graph, then maybe.

You could make a graph by creating a texture in-code and then drawing the graph inside it.

Share this post


Link to post
Share on other sites

I've made a new release available for KSP 1.1. It's got a bunch of changes by @jkortech and I haven't gotten to test everything. I really want to start a new career with this mod as the primary source of funds, so expect changes and new FMs in the next few weeks. Skins have been temporarily disabled as the GUI changes in 1.1 have broken things.

Share this post


Link to post
Share on other sites
5 minutes ago, theonegalen said:

Awwww, yeah.

Expect bugs. I haven't gotten past the "can it make it through a single quarter" phase of testing yet. I'm hoping to do some more work on it this week and next weekend especially. I'm dying to start a new career with this (and my basic Life Support mod that I was working on a few months ago).

Share this post


Link to post
Share on other sites

With the current FM format, is there a way to factor # of Kerbonauts into income, not just expenses? (thinking space hotel rent)

Share this post


Link to post
Share on other sites
1 hour ago, Venusgate said:

With the current FM format, is there a way to factor # of Kerbonauts into income, not just expenses? (thinking space hotel rent)

Absolutely! When the FM is told to calculate income you could ask KSP for the Kerbal roster and do what toy want with it (including figure out who is on what vessel). That's only calculated once a quarter or year though. Instead you might keep a running total when the FM is told a new day has passed and just return that total each quarter. So they income would be based on each individual day, but you wouldn't see the money until the end of the quarter.

Obviously you'd need to write a new FM for this. If you want I could come up with a basic one for you that you can expand off of.

Share this post


Link to post
Share on other sites
2 minutes ago, magico13 said:

Obviously you'd need to write a new FM for this. If you want I could come up with a basic one for you that you can expand off of.

That'd be great!

Share this post


Link to post
Share on other sites

The BROKE icon seems to be reproducing itself, creating more copies as time goes by. First starting there was two. but after going into the SPH and VAB, there is now 6. They were busy while off the screen :wink:

screen capture: https://www.dropbox.com/s/zbdcmrgdh6zpc2d/screenshot12.png?dl=0

Log: https://www.dropbox.com/s/1k0mm7a05n20ewe/output_log.txt?dl=0

Share this post


Link to post
Share on other sites
56 minutes ago, JeffreyCor said:

The BROKE icon seems to be reproducing itself, creating more copies as time goes by. First starting there was two. but after going into the SPH and VAB, there is now 6. They were busy while off the screen :wink:

Little did you know that they were BROKE Bunnies... :sticktongue:

Good to see you've got this mod back in action again @magico13.  I really enjoyed toying with this before!

Share this post


Link to post
Share on other sites
2 hours ago, Venusgate said:

That'd be great!

Alright, here's something basic that gives you 100 funds per day (configurable) per Kerbal in a Hitchhiker Container. You'll need to reference BROKE, Assembly-CSharp, KSPUtil, UnityEngine, and UnityEngine.UI (all the basics + BROKE).

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BROKE;
using UnityEngine;
using KSP;

namespace SpaceHotel
{
    public class SpaceHotel : IFundingModifier
    {
        private double totalIncome = 0;
        private double perKerbalFunds = 100;
        public string GetName()
        {
            return "Space Hotel";
        }

        public string GetConfigName()
        {
            return "SpaceHotel";
        }

        public void OnEnabled()
        {

        }

        public void OnDisabled()
        {

        }

        public bool hasMainGUI()
        {
            //no main GUI. Could use one to show any info you wanted, like funds for each station if you tracked that
            return false;
        }

        public void DrawMainGUI()
        {
            //if there were a main GUI you would draw it here
        }

        public bool hasSettingsGUI()
        {
            //It has a settings GUI
            return true;
        }

        public void DrawSettingsGUI()
        {
            //draw the setting GUI
            GUILayout.Label("Settings:");
            GUILayout.BeginHorizontal();
            GUILayout.Label("Funds per Kerbal per day: ");
            perKerbalFunds = Double.Parse(GUILayout.TextField(perKerbalFunds.ToString(), 10));
            GUILayout.EndHorizontal();
        }

        public void DailyUpdate()
        {
            //get the number of Kerbals in HitchHiker containers and multiply by the perKerbalFunds
                //Add that to the total
            
            foreach (ProtoVessel pv in HighLogic.CurrentGame.flightState.protoVessels) //all vessels
            {
                if (pv.protoPartSnapshots.Exists(pps => pps.partName == "crewCabin"))
                {
                    Debug.Log("SpaceHotel: Found crewCabin on "+pv.vesselName);
                    //contains a hitchiker part
                    foreach (ProtoPartSnapshot pps in pv.protoPartSnapshots.FindAll(pps => pps.partName == "crewCabin"))
                        totalIncome += pps.protoModuleCrew.Count * perKerbalFunds;
                }
            }
            Debug.Log("SpaceHotel: QTD = " + totalIncome);
        }

        public InvoiceItem ProcessQuarterly()
        {
            InvoiceItem invoice = new InvoiceItem(this, totalIncome, 0);
            totalIncome = 0;
            return invoice;
        }

        public InvoiceItem ProcessYearly()
        {
            return new InvoiceItem(this, 0, 0);
        }

        public ConfigNode SaveData()
        {
            //Save the totalIncome and perKerbalFunds info to the save file
            ConfigNode settings = new ConfigNode();
            settings.AddValue("totalIncome", totalIncome);
            settings.AddValue("perKerbalFunds", perKerbalFunds);
            return settings;
        }

        public void LoadData(ConfigNode node)
        {
            //Load the totalIncome and perKerbalFunds info from the save file
            double.TryParse(node.GetValue("totalIncome"), out totalIncome);
            double.TryParse(node.GetValue("perKerbalFunds"), out perKerbalFunds);
        }

        public void OnInvoicePaid(object sender, InvoiceItem.InvoicePaidEventArgs args)
        {

        }

        public void OnInvoiceUnpaid(object sender, EventArgs args)
        {

        }
    }
}
59 minutes ago, JeffreyCor said:

The BROKE icon seems to be reproducing itself, creating more copies as time goes by. First starting there was two. but after going into the SPH and VAB, there is now 6. They were busy while off the screen :wink:

screen capture: https://www.dropbox.com/s/zbdcmrgdh6zpc2d/screenshot12.png?dl=0

Log: https://www.dropbox.com/s/1k0mm7a05n20ewe/output_log.txt?dl=0

I actually knew about that issue and forgot about it. There's also an issue where the GUI breaks if you aren't using autopay. So many silly bugs! :P I've got a lot of work to put into this in the next few days to actually get it to a nice and playable state. I also want to rewrite the payment history code. What's in is fine but what I've got planned is a lot more detailed and a little more useful.

 

1 minute ago, rasta013 said:

Little did you know that they were BROKE Bunnies... :sticktongue:

Good to see you've got this mod back in action again @magico13.  I really enjoyed toying with this before!

As I mentioned above, there's still a bunch of work needed before I'd recommend actually using this. But if you've got FMs in mind now's the time to start playing around with creating them!

Share this post


Link to post
Share on other sites

I've been using State Funding while waiting for this.  I would love to see them somehow merged but I think State Funding may conflict a bit.  (it primarily deals with giving you $ based on it's own variables based on various milestones such as sat coverage, the nation you chose, etc).  It doesn't deal with expenses however.

 

I'm dying to make a "Planetary Science" sub-mod (like i've been talking about FOREVER but i'm lazy/busy/ADD all the time) to go with BROKE.  Something simple where you dedicate funding to planetary science, it compares the science gathered per-world to the total available and determines the % chance yearly of making a major discovery (with sweet rewards, maybe free levels for new scientists or big rep and free research points).  Each year a discovery brings you 1/4 the way towards a full understanding and selection from a list of Amazing Discoveries  (random per game) on each world.  So far that's about the only thing I've hashed out, besides the formulas.  

@magico:  Life support you say? :)  ::intrigued::

Add:  I'm going to look into the FM thing for this and see if I can figure out where the game is storing the research points per planet (I mean it knows how many you collect per world so I imagine it keeps track).  Maybe I can make this thing after all.

Share this post


Link to post
Share on other sites

What would be the difficulty of making a funding config that depended on activating a certain strategy from the Administration Building, especially using something like Strategia?

Share this post


Link to post
Share on other sites
8 hours ago, theonegalen said:

What would be the difficulty of making a funding config that depended on activating a certain strategy from the Administration Building, especially using something like Strategia?

If you're just checking that a strategy is active then that's probably pretty easy. I've never actually done it though so I'm not sure off the top of my head how easy it would be. I imagine it's just one function call to the right place.

Then, based on the status of that check you can have the FM do whatever you want.

Share this post


Link to post
Share on other sites
13 hours ago, magico13 said:

If you're just checking that a strategy is active then that's probably pretty easy. I've never actually done it though so I'm not sure off the top of my head how easy it would be. I imagine it's just one function call to the right place.

Then, based on the status of that check you can have the FM do whatever you want.

@theonegalen - Also, StrategyEffects only get their OnRegister hook called if it is an active strategy, so that's usually the hook to do something/turn something on.

I'd intended to do some stuff with BROKE stuff with Strategia, but I never got it done for the first release, and just haven't gotten a chance to circle back around to it.

Share this post


Link to post
Share on other sites
12 hours ago, nightingale said:

I'd intended to do some stuff with BROKE stuff with Strategia, but I never got it done for the first release, and just haven't gotten a chance to circle back around to it.

Well, figuring BROKE isn't really at a properly functioning state yet that's understandably not a priority :wink:

Share this post


Link to post
Share on other sites

I'm very interested in this mod - I'd help out with it if I only knew more of programming...
This would be a great way to teach financial literacy in a simulator! :wink:

On that note, graphs aside, it would be interesting to be able to allocate budgets into the game! Budgets for manned missions, robotic missions?

Insurance is a possible idea too, for those RPers who play hardcore - insure a kerbal or mission, based off of DV, kerbal skill, etc.

Keep up the good work @magico13 and co, I like what I see!

-Khorso

Edited by Khorso
More ideas percolating like a rich coffee in the morning.

Share this post


Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.