Balance tables

Started by NoImageAvailable, February 21, 2015, 07:49:21 AM

Previous topic - Next topic

NoImageAvailable

From the changelog for A9:

Quote
  • Rebalanced ranged weapons using calculated balance tables.
  • Rebalanced crops and melee weapons using calculated balance tables.

Is there any chance the community can get access to these balance tables? I imagine mod makers trying to balance their additions against vanilla would appreciate it and others might find it useful too.
"The power of friendship destroyed the jellyfish."

Tynan

Yes, turn on dev mode and hit HOME. You will get all the debug output options including balance tables.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Latta

Is there a way to scroll ranged table down? Or log it outside of the game? I can't see whole table.

Tynan

Quote from: Latta on February 22, 2015, 10:10:13 AM
Is there a way to scroll ranged table down? Or log it outside of the game? I can't see whole table.

Sorry I never implemented a scroll bar :( Didn't need it myself.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Latta

I should make my own on Excel spreadsheet than :P I guess I found its class.

Tynan

This may be useful to you; you can modify this code to have a scroll bar if you need.

public class Dialog_DebugTables : Layer
{
private string[,] table;

//Constants
private const float RowHeight = 23;
private const float ColExtraWidth = 8;

public Dialog_DebugTables( string[,] tables )
{
this.table = tables;

doCloseButton = true;
doCloseX = true;
absorbAllInput = true;
category = LayerCategory.GameDialog;

SetCentered( 1000, 760 );
}

protected override void FillWindow(Rect inRect)
{
Text.Font = GameFont.Tiny;

GUI.BeginGroup(inRect);
{
//Determine the column widths
List<float> colWidths = new List<float>();
for( int col = 0; col<table.GetLength(0); col++ )
{
float max = 0;
for( int row=0; row<table.GetLength(1); row++ )
{
string s = table[col,row];
float w = Text.CalcSize(s).x;
if( w > max )
max = w;
}
colWidths.Add(max + ColExtraWidth);
}

float x = 0;
for( int col = 0; col<table.GetLength(0); col++ )
{
for( int row=0; row<table.GetLength(1); row++ )
{
Rect r = new Rect(x, row*RowHeight, colWidths[col], RowHeight);

Rect wide = r;
wide.xMin -= 999;
wide.xMax += 999;
if( wide.Contains(Event.current.mousePosition) || col%2 == 0 )
Widgets.DrawHighlight(r);

Widgets.Label(r, table[col,row]);
}
x += colWidths[col];
}
}
GUI.EndGroup();
}
}

public class TableDataGetter<T>
{
public string label;
public Func<T, string> getter;

public TableDataGetter(string label, Func<T, string> getter)
{
this.label = label;
this.getter = getter;
}
}

public static class DebugTables
{
public static void MakeTablesDialog<T>( IEnumerable<T> dataSources, params TableDataGetter<T>[] getters )
{
var getterList = getters.ToList();

int numRows = dataSources.Count() + 1; //+1 for labels
int numCols = getterList.Count;

string[,] table = new string[numCols,numRows];

//Add labels to table
{
int col = 0;
foreach( var g in getters )
{
table[col,0] = g.label;
col++;
}
}

//Add all data rows to table
int row = 1;
foreach( var e in dataSources )
{
for( int col = 0; col<numCols; col++ )
{
table[col,row] = getterList[col].getter(e);
}
row++;
}

Find.LayerStack.Add( new Dialog_DebugTables(table) );
}
}

Tynan Sylvester - @TynanSylvester - Tynan's Blog