Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
KillHour
Oct 28, 2007


Anno posted:

Is there a good YouTube/twitch channel to learn about ONI? I feel like it’s the one of these I want to try next after my 100something hours in Rimworld but I’d like to learn about it first.

Nilaus has been playing it lately if you're into an insane min/maxer.

Adbot
ADBOT LOVES YOU

KillHour
Oct 28, 2007


It's probably better when none of you have any idea what you're doing so it's just a complete clusterfuck.

KillHour
Oct 28, 2007


Freedom has been a dog whistle for capitalism since at least the 80s.

KillHour
Oct 28, 2007


Rocket trains.

KillHour
Oct 28, 2007


I play on slower speeds because I'm bad and if I don't everyone is suddenly dead.

KillHour
Oct 28, 2007


They need a tutorial for the tutorial.

KillHour
Oct 28, 2007


explosivo posted:

I think your choices are probably either Planet Coaster or Parkitect, the former being less about fiddly management stuff and more about painstakingly creating the perfect park visually and the latter being a modernized rollercoaster tycoon. Planet coaster looks great but I wasn't too keen on it because of how much of it is about aesthetics. I haven't personally played Parkitect but it's on my wishlist and I've hemmed and hawed about it myself.

There might be some honorable mentions I've forgotten though.

If you're feeling nostalgic, OpenRCT2 is an open source implementation of RCT2 with a ton of improvements and modern computer support.

KillHour
Oct 28, 2007


No, it's more of a Factorio "have to drive them manually and hope they don't crash into each other" deal.

KillHour
Oct 28, 2007


I used to think it was dumb that Steam didn't allow porn games but now that the most popular section of the store is filled with cat-girl visual novels and shallow "[genre] but tits" cash-ins, I've changed my mind.

KillHour
Oct 28, 2007


Jack Trades posted:

Ah yes, I always wanted a city-builder I could play one-handed.

If you're not using both hands I don't think you're getting your full value for money.

KillHour
Oct 28, 2007


I'm surprised there aren't tags set by the game authors / steam and user tags that can be filtered on separately.

KillHour
Oct 28, 2007


Nyaa posted:

It sounds like you want to play a Tower Defense game where you guard a key building that generates money/resources to upgrade the defense.

So mindustry?

KillHour
Oct 28, 2007


Really? Because I make horrible rights abuses filled with pollution, propaganda and secret police to extract the most money possible out of my workersresources.

KillHour
Oct 28, 2007


Tenebrais posted:

Yeah, the biggest flaw with Autonauts is that, for a game ostensibly about programming, it's very manual. You can only code bots by directly doing the thing you want them to do, and then you get to configure some loops and conditionals and potentially change the specific objects they're interacting with. You can copy the programs bots run on, but you have to use an item to do it, by stopping the bot from running, copying to the disk item, starting them again then using the disk on a new robot. The code manipulation is all point-and-click, and you've got no way to add new lines of code on the same bot except by demonstrating that action again.

I think the ideal form of this game, for me, would play out a bit more like Exapunks. Or, alternatively, would basically be Exapunks expanded to a logistical scale. Or something like the strategic puzzles from Spacechem.

What I'm saying is I want a Zachtronics logistics management game.

I spent a year and a half trying to make this and I couldn't make it fun. Then again, I put a ton of idiotic constraints on myself so maybe I'll give it another crack, eventually.

KillHour
Oct 28, 2007


I do find it funny that for a long time, RAM sizes kept going up and up and then like a decade ago everyone decided "Yeah we're good with 8/16."

KillHour
Oct 28, 2007


"In an effort to save hosting costs we're migrating our databases to our customers' web cache I'm a revolutionary new P2P storage paradigm. Don't worry, it will be secured by Blockchain technology."

KillHour
Oct 28, 2007


We're also doing versioning to meet SOX compliance so no editing posts! Only quote!

KillHour
Oct 28, 2007


I've been addicted to Bitburner for long enough to give it a recommendation. It's billed as an idle game, and there's a lot of crossover, but it's much like Factorio in that there's always something you can be doing to optimize things while you wait.

The short version is that it's ostensibly a game about hacking, but it's really a game about writing JavaScript to automate the pressing of buttons as efficiently as possible. There's more to it, but the writing ever-more-complex code part is really the core of the gameplay loop. Be warned that the learning curve is as steep as your imagination - there's nothing stopping you from trying to create a Terraform clone from scratch within the first 5 minutes besides your need to eat and sleep. Also, it's free (in money, not the time you'll never get back). Overall, the game has a lot of features that don't really fit and are kind of stupid (why can I go mug people?) but the main loop is deep and complex enough to rival a Zachtronics game, albeit with way less guidance.

https://danielyxie.github.io/bitburner/

There's also a Steam version
https://store.steampowered.com/app/1812820/Bitburner/

KillHour fucked around with this message at 07:42 on Jan 4, 2022

KillHour
Oct 28, 2007


5AM on a Tuesday is definitely when I should be programming a distributed bot swarm instead of sleeping. Yep.

KillHour
Oct 28, 2007


zedprime posted:

There's crimes because eventually you prestige into worlds where hacking is less valuable source of money or experience but crime is now worthwhile so you unlock a crime API and automate crime

It's really dumb fun but despite it's claims I don't think someone is going to pick it up as a Zachlike without some other background in C-like programming. You can upload someone's script repository and basically play Hacknet idler but I don't think the base idle game is strong enough for that unless you are really desperate for cyber punk idler.

I mean, I assume most people playing TIS-100 already know a programming language. It's not the kind of thing that appeals to non-nerds. But it was more of a comparison of depth than anything else - the Zachtronics games are much more focused puzzlers whereas this is a coding sandbox, but both will take ages to master.

KillHour fucked around with this message at 16:13 on Jan 4, 2022

KillHour
Oct 28, 2007




Why yes, I did implement a microservices scheduling and dispatch system from scratch. Why do you ask?

Edit: Before someone asks, the reason the threads aren't being distributed fairly is because I also implemented a dynamic ranking system, so it always targets the most profitable servers first.

KillHour fucked around with this message at 05:19 on Jan 6, 2022

KillHour
Oct 28, 2007




I got sick of having to look through a JSON file to figure out what the hell was going on with my allocations so I ended up writing a small library to render progress bars.

KillHour
Oct 28, 2007


In a world where all education and personal skill is fungible like it is in that game, it wouldn't be the worst system.

KillHour
Oct 28, 2007


LLSix posted:

Your insanity is glorious.

Turns out, you can just call document or window from a script and access the actual environment the game engine is running on. There's even an achievement for doing it in such a way that the game can't penalize you for it If you use eval to access it, you don't have to pay the RAM cost.

Anyways, this lets me completely hijack the game's entire UI so I've started adding quality of life functionality from inside it - starting with a hierarchy tree on the right showing how servers are connected and which ones I have admin access on, complete with working hyperlinks to each server that I spent way too long getting to work because they use react for handling events and I had to tie into that.





...I may have spent considerably more time doing this than it will ever save me in typing.

KillHour fucked around with this message at 10:25 on Jan 15, 2022

KillHour
Oct 28, 2007


The game supports wget so you could host the scripts somewhere and use real version control if you wanted to.

KillHour
Oct 28, 2007


My code is a hack because I did it at 5AM so I'll share it when it stops breaking the interface randomly but there's actually a small section in the game's documentation about it that I wish I found earlier

https://bitburner.readthedocs.io/en/latest/netscript/advancedfunctions/inject_html.html

Also some helpful tips that took me a long time to find out the hard way:

- you don't have to be sneaky about trying to access native JS and react extensions. There is no attempt to sandbox anything so you can just call whatever from your script. I wasted a lot of time with serializing code so it could run in the document directly when it was deserialized as a script element but you don't need to bother with that at all.

- you can work with react directly in native JS, and you should instead of trying to manually create HTML nodes because otherwise you won't be able to call events. https://reactjs.org/docs/react-without-jsx.html

- you can literally just Google react examples and as long as they are in native JS instead of JSX, you can just paste them in there.

- you will gently caress up the webpage repeatedly but that's why there's a reload option.

Edit: Here's a cool one. The devs put extra elements in the overview status pane specifically so you could add custom stuff to it:
https://github.com/bitburner-official/bitburner-scripts/blob/master/custom-stats.js

Gives a nice easy thing to play with modifying the UI a bit.

KillHour fucked around with this message at 22:36 on Jan 15, 2022

KillHour
Oct 28, 2007


Harminoff posted:

Agreed. All these programming type games seem to be based on JavaScript which bums me out. Should just learn JavaScript sometime I guess.

It's because they're all implemented in chromium since that's an easy environment to make a text based game and it's trivial to insert custom code.

I decided to make a hello world program for loving around in React:

code:
class NetworkMap extends React.Component {
	constructor(props) {
		super(props);
		this.state = {clickedThis: false};
	}
	
	render() {
		let text = "This is not the best code in the world it is only a tribute.";

		if (this.state.clickedThis) {
			text = "You clicked it! Yay!"
		}

		return React.createElement(
			'div',
			{
				onClick: () => this.setState({clickedThis: true}),
				class: 'css-cxl1tz'
			},
			text
		)
	}
}

const doc = eval('document');

//Delete old data
let old = doc.getElementById("haxx0r");
if (old) {
	old.remove();
}

const root = doc.getElementById('root');
root.setAttribute('style', 'display: flex; flex-direction: row; justify-content: stretch; align-items: center');
const container = doc.createElement('div'); //Render replaces all content so if we try to overwrite root, bad things happen.
container.setAttribute('id', 'haxx0r');
container.setAttribute('style', 'flex: 0 0 auto, white-space: nowrap');
root.appendChild(container);

const muibox = root.getElementsByClassName("MuiBox-root");
if (muibox.length) {
	muibox[0].setAttribute("style", "flex: 1 1 auto"); //This stops our new div from taking up literally half the screen.
}

ReactDOM.render(
	React.createElement(NetworkMap),
	container
);

KillHour fucked around with this message at 23:26 on Jan 15, 2022

KillHour
Oct 28, 2007


zedprime posted:

Listen, its got java in the name and I can invoke "yourface.visibledisgust ++" Not sure what you big computery people are expecting here.

You cannot, as JavaScript does not have an increment operator. You would need to do "yourface.visibledisgust += 1;"

KillHour
Oct 28, 2007


What the actual gently caress :psyduck:

What language am I thinking of!?

Fake Edit - it's Python. I'm thinking of Python :doh:


Protocol7 posted:

I was really confused if I was in the front-end thread or something else. A React app in Bitburner? drat :stonk:

The entire game's UI is in React. What's so strange about that?


Aaaanyways, I cleaned up the code for my server browser thing. Warning: This contains major spoilers because in order to get the ability to connect to a server when clicking on it, I had to load both the player and terminal objects into scope, which is pretty much the "I win button" since you can give yourself whatever you want at that point. It's definitely worth trying to figure out on your own.


code:
/** @param {NS} ns **/

let terminal = null;
let player = null;

function getElements() {
	return Array.from(eval("document").querySelectorAll("[class*=MuiBox-root]"));
}

function getProps(obj) {
	return Object.entries(obj).find(entry => entry[0].startsWith("__reactProps"))[1].children.props;
}

function hasProp(obj, prop) {
	try {
		return getProps(obj)[prop] ? true : false;
	}
	catch (ex) {
		return false;
	}
}

function getProp(prop) {
	const elements = getElements();
	//console.log(elements);
	const result = elements.find(x => hasProp(x, prop));
	//console.log(result);
	return result ? getProps(result)[prop] : null
}

function getTree(data, networkLocation, depth) {
	if (!networkLocation) {
		console.log("No Data");
		return React.createElement(
			'div',
			{
				class: 'css-cxl1tz',
				style: {
					color: "red"
				}
			},
			"No Data"
		)
	}
	return Object.keys(networkLocation).reduce((iter, node) => iter.concat(formatNode(node, data, depth), ...getTree(data, networkLocation[node], depth + 1)), []);
}

function formatNode(node, data, depth) {
	const adminRights = data.servers[node].hasAdminRights;
	const leftText = depth > 0 ? '\xa0'.repeat(depth - 1) + "\\_" : "";

	return React.createElement(
		'p',
		{
			onClick: () => terminal.connectToServer(player, node),
			key: node,
			class: 'css-cxl1tz',
			style: {
				color: adminRights ? "" : "red"
			}
		},
		leftText + node
	)
}

class NetworkMap {
	constructor(data, container) {
		this._container = container;
		this._data = data;
		this._render();
	}

	_render() {
		ReactDOM.render(
			getTree(this._data, this._data.network, 0),
			this._container
		);
	}

	set data(value) {
		this._data = value;
		this._render();
	}
}

export async function main(ns) {



	const doc = eval('document');

	const filename = (ns.args[0] ? ns.args[0] : "hosts") + ".txt";

	//Delete old data
	let old = doc.getElementById("haxx0r");
	if (old) {
		old.remove();
	}

	const root = doc.getElementById('root');
	root.setAttribute('style', 'display: flex; flex-direction: row; justify-content: stretch; align-items: flex-start');
	const container = doc.createElement('div'); //Render replaces all content so if we try to overwrite root, bad things happen.
	container.setAttribute('id', 'haxx0r');
	container.setAttribute('style', 'flex: 0 0 auto, white-space: nowrap');
	root.appendChild(container);

	const map = new NetworkMap({}, container);

	do {
		terminal = getProp("terminal");
		player = getProp("player");
		await ns.sleep(200);
	} while (!terminal || !player)

	console.dir(terminal);
	console.dir(player);

	while (true) {

		const data = JSON.parse(ns.read(filename));
		if (data === "") {
			ns.print(`File not found.  Waiting.`);
			await ns.sleep(10000);
			continue;
		}

		const muibox = root.getElementsByClassName("MuiBox-root");
		if (muibox.length) {
			muibox[0].setAttribute("style", "flex: 1 1 auto");
		}

		map.data = data; //Update panel

		await ns.sleep(5000);
	}
}


Edit: I just realized you need a file named 'hosts.txt' with the server info for this to work. It's not particularly complicated - just a tree structure of keys and a flat array of the analyze() output of each server.

code:
/** 
 * @param {NS} ns
 * @param string? starting host
 * @param string? filename
 */
export async function main(ns) {
	const filename = (ns.args[1] ? ns.args[1] : "hosts") + ".txt";

	while (true) {
		const file = JSON.parse(ns.read(filename) !== "" ? ns.read(filename) : "{}");
		if (file.locked) {
			ns.print(`File locked by ${file.lockedBy}.  Waiting.`);
			await ns.sleep(10000);
			continue;
		}

		file.locked = true;
		file.lockedBy = ns.getHostname() + '|' + ns.getScriptName() + '|' + JSON.stringify(ns.args);
		await ns.write(filename, JSON.stringify(file, null, 4), "w"); //Enable write lock

		const start = ns.args[0] ? ns.args[0] : "home";

		file.servers = {};
		file.network = {};
		
		Dive(start, file, file.network);

		file.locked = false;
		await ns.write(filename, JSON.stringify(file, null, 4), "w"); //Update and release write lock
		ns.print(`Finished cycle`);
		await ns.sleep(60000);
	}

	function Dive(serverName, file, networkLocation) {

		const server = ns.getServer(serverName);
		file.servers[serverName] = server;
		networkLocation[serverName] = {};

		const connected = ns.scan(serverName);

		for (const s of connected) {
			if (file.servers[s]) continue; //Already explored
			Dive(s, file, networkLocation[serverName]);
		}
	};
}
I'm done making GBS threads up the thread with my bad code. Promise.

KillHour fucked around with this message at 08:13 on Jan 16, 2022

KillHour
Oct 28, 2007


PerniciousKnid posted:

Aren't increments mainly used for loops? Usually in Python I'm vectorizing everything so loops aren't needed, I've never missed it.

Edit: I mean I assume there's some kind of machine code loop under the hood but invisible to me.

This is why I whiffed on it - I pretty much always use map / reduce / whatever with an anonymous function in JS.

KillHour
Oct 28, 2007


I'm in crime world so I added a karma field to my stats panel, since it's not something the game normally makes readily available (in fact, you get an achievement for figuring out how to access it), and I discovered that dealing drugs doesn't affect your karma. :420:

KillHour
Oct 28, 2007


Automating gang violence is really loving hard. Reagan lied to me.

KillHour
Oct 28, 2007


Subjunctive posted:

You’re welcome!

I added those to the language, back in the mists of time

You what now? :eyepop:

You do know you're going to have to explain that one over beers if that's ever a thing again.

KillHour
Oct 28, 2007


Teledahn posted:

But... this is already my favourite management game thread? Where else can I learn about Soviet labour relations, the sex lives of beavers, and metropolitan scale traffic planning all in one place?

Probably Dwarf Fortress, TBH.

KillHour
Oct 28, 2007


JosefStalinator posted:

My time at portia is probably one of the better ones on this list - I already own it so I'm not asking for it, but it's a crime that it's still available.

gently caress, I have to take this to try it now, don't I? Never heard of it until now.

KillHour
Oct 28, 2007


Wyld Karde posted:

It's kind of a third person over-the-shoulder post-post-apocalyptic take on Stardew Valley, only you're a craftsperson rather than a farmer. A small, rustic town built upon the ruins of the old world (plenty of opportunities for dungeon dives) where you'll be taking contracts to build things from hinges to fix someone's door to bus stops and busses for the fast travel system and on from there.

But I have so much adulting to do this week

KillHour
Oct 28, 2007


Chain signals on entrances to intersections and regular signals on exits. Solved.

KillHour
Oct 28, 2007


Volmarias posted:

Yeah, chain signals are one of those things where once you 'get' it, it all makes sense. In particular, the mixed signals for destinations with only an entrance and no exit, which means that an incoming train can be stopped well before it would block in another train, and the outgoing train will wait until it can actually get out of the gate before starting to move (so as not to hit another train if there's multiple platforms)

W&R didn't have mixed signals at first and it was the biggest pain in the rear end.

KillHour
Oct 28, 2007


Jinnigan posted:

this is kind of a weird request for this thread but there's enough overlap that maybe there's a few folks who'll know: are there any games out there that are a nice introduction to programming-logic? it looks like there's some zachtronics stuff that is maybe a fun game for people who already know programming but what if you simply have no clue?

Human Resource Machine is a good one if you want to learn about the basics of algorithms / programming theory but don't want to get bogged down in actually typing out syntax. The sequel 7 Billion Humans focuses on parallel processing and is cool too.

Adbot
ADBOT LOVES YOU

KillHour
Oct 28, 2007


What if I literally watched cartoons until it killed me and now I'm deadposting about Konosuba?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply