Vigilante

Edit for convenience: the project’s community page, bundled windows version: Vigilante.zip (2.5 MB)

Since this post got a rather nice reception, I’ve decided to lay my current project bare for you here.

What’s it all about:

I’m trying to simulate a small society living on a decrepit space station. Think of it as a building and management simulator, except without any building or management. That will all be up to the peeps themselves. They should go to work, produce goods, buy stuff, fulfil needs and all that boring stuff humans do. In the next stage I’ll want to add crime - stealing food because of hunger, pub fights, all the way to protection rings and assassinations. And of course some form of law enforcement. If nothing else, peeps should be able to beat up a would-be thief and leave them bleeding on the sidewalk, since crime is no fun if there are no repercussions, though I’d like to make my way up to law enforcement of some sort, though that would require some form of government to pay for it etc etc etc…

I definitely have my work cut out for me. There are limitless way to increase my little world’s complexity to make it that little bit more realistic. But to what end?

Well, above all else this is a learning experience for me. I’ve already learnt so much about coding and I’m having tons of fun. To my surprise, the learning is not limited to programming, as I’m forced to think a lot about all kinds of economical effects and later (probably) about politology, as various systems of government come into play.

As for eventual gameplay, I’ll let the player live in that world and fight crime in any way the see fit (and since I know most players are sadistic bastards, doing crime is going to have to be an option as well). The precise implementation of the gameplay is not really on my radar yet, as I might not even get that far (I’ll probably start with something reminiscent of text-based adventures and build on that), but the idea is that once the player inevitably either fails or gets bored and aborts the game, the world resets back to square one and iterates back to the date where the player ended, this time without their involvement. That will allow me to give the player a “score screen”, showing just how big on an impact their actions had on the game world, whether their presence significantly decreased (or increased) crime rate and maybe even how long their legacy lasted after they stopped.

Current status:

I’ve uploaded the current version to my community page, though there isn’t much to see yet. There are three view modes:

- Map, showing peeps present in each building/corridor
- Peeps, showing a sortable list of all peeps, their stats, actions etc
- Jobs, which is an overview of all buildings/businesses. Note that a lot on that page is mislabeled or just plain confusing. I don’t care.

You can advance time by a specified number with the big black button at the bottom or by pressing space and see how right off the bat the peeps scramble to go get employed and then start going to work and fulfilling their needs (Eating and sleeping, that is. Boredom currently only goes up).

There’s a powerplant, selling electricity to all the other rooms in the background (you can see its owner’s money go up each week), hydroponic farm that produces protein, a food factory turning it into food and restaurants selling that to hungry peeps. There are two kinds of apartments the peeps can rent and “sleep pods” they can use for a single night if they can’t afford better housing. If that’s full, they sleep in a corridor. The dock does nothing at all.

You can’t have any impact on the game whatsoever and since the peeps are (mostly?) deterministic drones, it should play out the same every time. I’m having fun already! Well, I actually am, as I can change stuff up and see what happens (for example the restaurant in room 8 used to almost go bankrupt before I added the power plant and allowed more peeps to make enough money to be able to afford the apartments next door. Now it’s making way more money than the otherwise nearly identical Restaurant 5. Location, location location!), but I’m afraid you’re not going to have much fun with it in its current state.

Oh, I almost forgot! There’s a hidden feature - a prototype face randomizer I made when I wanted to take a break from optimizing and do something more simple and fun. Just mash F1 and a shitty peepface will appear. A few of the graphic elements were drawn by my 5 years old niece, though that hardly excuses the rest of it. She also game me the first “review” of the game:

“Uncle, this is more fun than Minecraft!”

6 Likes

Thanks! That is an ambitious project.
Also any new exciting development challenges recently? =]

1 Like

Not really a development challenge, but I wanted to set up food/rent prices, wages, opening hours and all that stuff so that all the owners and employed peeps would end up with a positive income before sharing this and it took me quite a while. The model I ended up with sees the owners get very rich while the workers barely scrap together any savings (worst off are the ones working in the power plant, since their wages are actually good enough to afford to rent an apartment).

So the select few will keep getting richer while the unemployed peeps slowly run out of starting money. Once they can no longer afford food, the whole food production chain will go as well, as they need mouths to feed to stay afloat. The homeowners will probably be fine the longest, since I didn’t implement evictions yet and I think the renters will be allowed to go to a to a debt just to pay their bills.

So overall I’d say the game’s surprisingly accurate!

Next step however, is to let the peeps set the wages and prices themselves, which might be the main reason I started this topic. Implementing that is going to be tough and I need to take a breather =D

1 Like

I actually DID have a little fun with it! But I always liked numbers and data. The variations are really cool.

1 Like

Haha… I was checking how much randomness I’m actually using and the only instances are that peeps who don’t own any business start in a random corridor at the beginning and when looking for job, if there are two positions that offer the same wage, they’ll pick one at random.

…but none of that really matters, since I left math.randomseed(os.time()) commented out, as I wanted to get the same outcomes while testing and forgot to re-enable it =D

You could get a slightly different outcome if you use the face generator before the peeps get employed, though, as that uses up quite a few random numbers.

3 Likes

Ambitious but fun! Slap some graphics on it and you have RimWorld or similar games!

3 Likes

I’ve officially fulfilled my current goal:

Stick with it long enough to see the code turn into a horrid inefficient mess I don’t understand at all

However - with one last exertion of will I’ve managed to make that confusing mess to behave the way I want, so I guess I can go on and hopefully I’ll be able to tame it by the time I have to revisit that particular part of the code.

One funny thing that happened to me - after a few changes the program started to hang up whenever I ran it. No errors, no crash, just hanged. After hunting the bug down, I realized that the equation to determine minimum price for a product was (expenses / demand) + 1 so that the business would always make some profit. Turns out zero demand made the minimum price Inf + 1, which lead to an infinitely looping for cycle somewhere below…

In hindsight, it makes sense. If you won’t sell anything, you’ll have to sell it for more than infinity to recoup your non-zero losses.

Anyway, now I need to fix anything that got broken, clean it up a bit, and I should have an update shortly.

2 Likes

One way to do it for wages is to configure a stress rating into jobs. Characters then randomly generate an expected stress rating for that job based on the value, and ask for a wage that “pleases” them with that stress rating. The hours/shift they would have to work could also have some sort of effect on their wage. If they are accepted and the stress is much higher than expected, they are more likely to ask for a promotion/raise earlier.

As for business prices, it looks like you’re already way ahead of me.

1 Like

I have something like that, though I call it “work shittiness rating”.

The problem I had was why would anyone offer better wages than 1 when there are jobless peeps for who even that would be an improvement? What I did was define a minimum wage (just enough to buy one portion of the most disgusting meal available each day) and an efficiency rating based on the percentage of this wage the workers are paid. The function is a hyperbola that goes through (0,0) (so that they don’t work at all if not paid), (1,1) (so that they have optimal work efficiency is paid minimal wage) and as wages trend towards infinity, the efficiency approaches 150%. I can multiply the minimum wage by the shittiness rating so that higher wages are required for the peeps to keep working efficiently for different jobs.

Later on I can add the peep’s own preferences and qualifications to determine how happy they’d be in a job should they take it and change their real efficiency based on that should they take it.

The system seems to be working just fine - the prices and wages usually settle so that the workers are paid slightly more than minimum wage. There’s one outlier though:
The power plant is currently underused, as there are only few buildings and only about one third of maximum production capacity is needed. I was expecting the owner to hire a third of the maximum number of workers and pay them minimum wage to meet this goal, but turns out it’s more efficient to hire close to the maximum number of workers and pay them shit. They hardly do any work, but it’s enough to meet the power requirements. Maybe later I’ll have to adjust the equation to make it ramp up more slowly, but for now I think it’s fine. It’s their lives, who am I to tell them how much to pay their workers?

As an aside - I took math when I graduated from high school and conic sections was the one question out of 30 I picked (and it also happened to be the only subject I didn’t prepare for, as it’s just too painful and hey… 29 out of 30 are not bad odds). My teacher later told be that as I was transforming the equations given again and again in front of the commission (trying to remember what the damn canonical forms were) she was thinking to herself: “Well, he has the correct answer there. I should stop him and tell him he’s made it. But… he’s having so much fun with it… I’ll let him work for just a little while longer”.

Anyway, that was more than 10 years ago and turns out I’ve forgotten so much since then. It took me two days to come up with this equation and it was only thanks to online plotting tools, though I have to admit it felt good to finally crack it.

1 Like

OK, the investment and price setting system works now. Here’s how:

The game starts with just empty rooms this time. Since there’s currently no way a built business can disappear and things don’t really change during “gameplay”, the investment function only gets run at startup, but I could call it whenever a new investment opportunity shows up, or just periodically.

It finds out which resources are in demand or being produced and then calculates the expected profit of each of the buildings that can be built:

If the building requires workers, it finds out the best combination of number of workers and wages that will allow it to meet the demand, based on the function I’ve described in the previous post.

Then it finds the lowest price for the product which (after expenses) gives it enough profit so that the construction cost (preset, different for each building, ranging from 1000 to 3000) returns within 30 days. The theory is that the price is set in a way that it’s profitable, but a hypothetical competitor can’t undercut it.

The investment which promises the greatest profit gets chosen and then a randomly picked peep (with enough money to afford it) builds it in a random empty room. After that every currently functional building checks its expenses and projected profits again and adjusts its prices and wages accordingly.

To solve the chicken and egg problem (if there’s no food production a dispenser can’t be built, but if there are no dispensers, there is no demand for food, so no production facilities get built), I’ve set up an external maket which sells and buys food and protein for preset prices. If there isn’t enough supply of a resource, the required amout can be bought there, and the prices also function as minimal and maximal prices for good produced by peeps.

So what exactly happens is this:

First a food dispenser is built, since there are 100 peeps who want to eat. It sets the price of a meal to something, based on the expenses determined by the price of food in the docks and some random pre-set price for energy.

The second time around there’s an option to invest into either a second dispenser (it’s still profitable even if it sells only half as many meals) or into a food factory, which can buy protein from the docks, process it and sell it as food at a profit to the dispensors at a cheaper price than that in the docks. The foot factory nets a higher profit than a second dispenser, so that’s what’s built next.

Since the factory lowers the expenses of the dispenser, it start offering the meals for a lower price, which in turn lowers the minimum wage expected by the workers in the factory, furher reducing the price at which it can sell food etc.

More buildings get added this way and the game world ends up with a farm, a food factory, a power plant and 2-4 dispensers. Since the price adjustment cycles through all active businesses based on the room number they happen to occupy, the prices end up slightly different each time, and so sometimes it seems profitable to build more dispensers.

Of course, reality ends up being different from the projections and some of the dispensers may end up not being used at all - if there are two of them adjacent to the same corridor, one of them is never closer than the other one (unless the peep deciding happens to be there already - and there’s currently no reason why they would be), so unless there is a really long queue (which can only happen the first day when everyone gets hungry at the same time, since I’ve made it that buying a meal takes only a minute), nobody will ever visit it.

On the other hand, I was expecting the dispensers closer to workplaces to have more customers, but since a majority of peeps are unemployed and have literally nothing to do than eat and sleep in the closest corriodor, they stay where they are and always use the same dispenser, so the profits tend to be distributed relatively well.

The factory tends to produce slightly more food than is consumed, so it just stockpiles it. I should have it sell off the excess food at the dock, but for now it’s not necessary, as it’s still the most profitable venture.

Next up:

I’m going to give my peeps the dubious gift of hopes and dreams, plus the ability to make a simple weekly budget. I had to cut appartments and such from this build as it’s more iffy to determine the demand there, but I’ll make a system where peeps who could affford better food or sleep in a bed for a change can have an unhappy thought about that not being available and thus get an estimate of demand.

3 Likes

I just read Artemis over a couple of days. Not only is it about a city on the Moon with ~2000 residents, which is pretty much what I’m trying to simulate here, but besides the everyday life there it at times delves into the economic and political aspects, which I’m thinking of a lot. It describes crime both petty and organized, as well as the minimal kind of law enforcement and mob justice that could be enough. It deals with monopolies, cartels and guilds.

While I won’t be aiming anywhere near the novel’s technical accuracy (think a more space-opera vibe will be better for my purposes), it has given me a lot of food for thought. Not to mention that the writing is excellent, I really enjoyed it.

The funny thing is, I got the book just by a coincidence. I didn’t even realize it’s required reading for me when working on this project.

4 Likes

I haven’t got much time/willpower in the past few weeks to move forward with this project too much (still working on the peeps’ budgeting skills) so I decided to ramble about some long term ideas I have instead of sharing my progress - because apparently I do have enough time and willpower to ramble about that sort of thing.

The setting

I’ve got a pretty good idea about the game world, even though that’s something that’s not going to be very relevant for a looong time. Let me walk you through the way I got there:

The original idea

The basic inspiration for this project was the Nemesis system in the LOTR game Shadow of Mordor. You can read about it here in case you don’t know how it works.

The system is relatively simple and just works. It’s awesome. I was honestly expecting pretty much every game made since to rip it off and do something similar, but as far as I know it hasn’t really been copied. Curious.

Anyway, my first idea was to use a similar system and give the player the role of a police officer. Most of the game would revolve around the fact that you’d do your best to get criminal scum off the streets, only to watch them walk after paying off judges or simply doing their time, while the real bosses laugh to your face. The game would give you the option to either stick with this “hard way” or simply snap and start dispensing lethal justice as a vigilante. This was actually meant to be a board game. This simple premise evolved and mutated and eventually I ended up with something completely different (more focused on on player in the role of journalists and/or crime bosses trying to subvert or eliminate various politicians and businessmen). Eventually I decided that the board game has become so different that I might as well give the original idea another go. I found Defold and here I am.

Basic genre

While I haven’t completely resigned on the original police officer approach, it will only be one possible way of playing the game, as I’ve decided to make the whole thing much more open-ended. Which meant that if I want bad guys coming back for more after being defeated, they must have a way to do that even if the player decides to go on a kill frenzy (and I expect that playstyle to be rather popular). So that rules out most realistic settings. For me that meant three possibilities - fantasy, sci-fi or something like superhero comics (comic villains are notorious for their refusal to rest even in pieces). And since sci-fi has always been my thing, I’ve decided to go with that, though I plan to utilize many comic book tropes as well, since they seem to fit my idea rather neatly.

As for subgenre - well, I don’t want to spend all the energy that would be needed to create a hard sci-fi world, so I tend heavily towards space opera (the game Strange Adventures In Infinite Space being a prime example of what it should be like). Additionally, since I’m currently heavily invested into the cyberpunk genre (as I’ve mentioned elsewhere), that’s going to colour the game a lot too.

So the idea is to have a big, colourful and a little bit silly futuristic world with heavy use of body augmentation, surveilance and cutthroat everyday life, which will neatly support the gameplay mechanics I want: character development way beyond baseline human - if the player so choses, higher-ranking NPCs being physically much harder to destroy, plenty of justification for enemies to come back from the dead to haunt you - by ways of cloning, consciousness upload or good old-fashioned miraculous medicine.

So… space station

Given the way I’m doing things, I can hardly simulate a sprawling metropolis (which is where I imagine most of the denizens of my world live). One option was for the game to take place on a tiny colony, a frontier town. Think Firefly. As seductive as that sounds, that lends itself to a western, which is a genre I never explored much. You could say it’s for me an unknown frontier it itself. And even though it would be an interesting challenge, what I don’t want is to add even more challenge on top of the whole actually learning programming to be able to do this.

Besides, space station offers me claustrophobic space with tight corridors, service shafts, possibly entire subspaces for the homeless and undesirable to dwell in and more. While I tend to think of Startopia when thinking about the basic systems I’m working on now, my idea is something like Omega in Mass Effect or the underground city in Demolition Man.

The grander scheme of things

I love when certain gameplay considerations push me towards concrete lore decisions. I want different space stations appearing in the game to differ from one another, especially when it comes to the system of government. For now I’m focusing on anarchy, but I’d very much like autoritative regimes, capitalistic societies, hell, even something like a monarchy isn’t out of the question. The question is - why would someone build something massive like a space-station and then let some rabble run it the way they see fit? And to take it from a different side: I want crime, and I want peeps to be able to hit one another over the head and take whatever money they have in their pockets. Or ransack their homes and find whatever is stashed there. Would there still be physical money in the far future? It always bothered me that in games where all payments you do by wireless transfer (often explicitly called that) you find credits stashed in all manner of places (I’m looking at you, Deus Ex).

Both of those problems can be solved by means mankind has been solving its problems for ages: war. The way I see it, mankind, possibly united in a single empire/alliance/federation has been spreading across the galaxy, until something happened. And since natural disaster on a galactic level sounds far-fetched, it’s better to use war, being a decidedly unnatural disaster. I’ll let the question of whether the war was waged against an alien civilization or “enemy within” undecided for now, but we now know there’s still a much diminished old empire, whose power extends over a couple of core worlds, while the outer planets and space stations have descended into anarchy or declared independence. Pirates reign supreme. Political situation is volatile. Much has been destroyed and/or forgotten, a lot of technology is rare. So the society where the game takes place can be both highly advanced in some ways and rather barbaric and low-tech in others. Perfect for me.

Some more details and gameplay modes

I spent some time thinking about game modes I’d ideally like to have and how they should differ from one another. Obviously the basic one is going to be simply:

  • Sandbox. A randomly generated station, put the player in and go! Do what you want and have fun! This can be spruced up by additional optional rules and customizations, such as an enforced no kill rule, different starting conditions, hell, that police officer thing I was talking about would fit in here perfectly. This mode would probably have heavy rogue-like elements.

  • Challenge / puzzle mode. The existence of this mode fully depends on whether the finished game will be able to support it, which is far from certain, but I imagine it like this: Say I build a set up a game world which is going to be blown up after a month of game time by a madman. It wouldn’t be directly scripted, just overwhelmingly likely (and 100% sure if the player didn’t do anything). The madman in question could be a normal guy who hates his life, works a dead-end job, has no friends etc. Within the month, he’d get fired, robbed and come across a way to sabotage the station’s reactor. The player could solve this in a number of ways - he could find out who the madman ends up being (over multiple playthroughs) and then just go directly to him and put a bullet in his head pre-emptively. Or he could wait and prevent to sabotage. Or he could go on a killing spree and hopefully make enough changes that the butterfly effect breaks something and the sabotage doesn’t happen. Or he could find the guy, befriend him, help him turn his luck around and prevent him from being suicidal.

  • Story mode. This is a personal thing. I tend to think that no game is complete if it doesn’t have some sort of single player campaign, some story, something more than just gameplay, no matter how good it is. Plus I’m a storyteller at heart. Of course there has to be a story mode. It does, however, come with some problems that need solving. Since the game is meant to be very open-ended, it would feel wrong to constrain the player too much, but the story still has to make sense no matter if you’re a by-the-book good guy or a murdering psycho. I’m thinking that each stage should take place on a different space station, so that it woudn’t derail should you decide to make it uninhabitable before your departure. Leaving would then be your objective each time, though it doesn’t have to be a matter of buying a ticket or stowing aboard a trader (though I’d very much like these things to be an option some of the time). You could have an authoritarian regime that simply won’t let you, unless you gain favour with it, topple it or work with the resistance to flee covertly. Other time there could be a blockade by ships outside and nobody could leave until a specific problem was solved, say an outbreak of a zombie virus.

One more note on the story mode

One core gameplay mechanic is going to be the ability to reset the game back to the original state where the (random) events will happen the same way unless you interfere, basically making the game a Groundhog Day simulator. Hopefully that will also allow me to skip making a save/load system, which sounds like pain anyway. What I always liked was when gameplay elements like this were explained in-universe (the Prince of Persia trillogy being a great example). So what I’m thinking is: the player character gets affected by… something. An experiment. A weapon test going wrong. An alien influence. A trillion-in-one freak occurence. What it does is that should he ever die, he’ll return back in time to the start of the game, Edge of Tomorrow style. In case of the story mode that would be time of arrival on the current space station. That can be neatly explained by saying that whatever it is, it’s influenced by whatever kind of warp-travel is typical in my universe and thus resets every time he travels somewhere. The story can then revolve around someone or something trying to get this power for themselves.

So yeah. That’s pretty much where I stand right now in terms of “lore”. None of this matters. It’s going to be ages until it’s time to implement almost anything mentioned above, and things will change. They always do. But the way I see it - you have to have a plan; just so you have something to modify or outright abandon once you get a better idea.

Hopefully I’ll have some actual development news next time, though I do have many more topics to ramble about. We’ll have to wait and see which it is.

6 Likes

Your idea is so great and huge, I wonder if it’s even possible to create such a world :smiley: So, I think you posted an accurate observation: when to end? In my opinion, game devs, especially independent, take care of their work like with an own child. They (/we) are artist, who want to create the opus magnum of their (/our) lives, not wanting to stop when there is at least one imperfection. There is a lot of thing you can add to your universe to make it more realistic and I hope you’ll decide to make it like this, because I think there could be a pleasure only watching those peoples living their lives. Because, I’m hoping you are planning to create a graphic representation for this, yeah? Anyway, awesome idea :wink:

2 Likes

I wonder if it’s even possible to create such a world :smiley:

So do I, really. For now I’m taking it one step at a time, trying not to think too far ahead, since there’s no guarantee I’ll ever get far enough. The other day I was describing the game to a friend and he sensibly pointed out that my plans are rather complex, but the way I see it, I should be able to increase the complexity gradually, until I get something that’s good enough to add gameplay. I can always continue that process if I want, or focus elsewhere.

Graphic representation is somewhere on my to-do list, if far in the mists of future. Once I think it’s good enough to support it, I’ll shift my focus to creating gameplay. At first I’ll settle for a text-based interface (though hopefully neater than what Dwarf Fortress has!) and only after I’m sure that the game can be what I want it to be will I think of graphics. For starters I’m thinking of something inspired by DoomRL, but I’ll see when I get there. If I get there.

I will say, though, that even though I didn’t expect to get far when I started, the positivity of this board is slowly convincing me I might get there after all.

Edit: Damn you! By quoting you, I got the “First Emoji” badge I was hoping to avoid forever!

4 Likes

After a little break I spent working on a different game (which shall remain unfinished for some time) I finally got back to this. I’ve more or less finished implementing housing for the peeps and they finally have a simple budget to inform their spending, though I simplified things a little bit by assigning discrete social classes to the peeps based on how many basic needs they can afford on their budget. Hopefully I’ll be able to replace this system with something more fluid.

It all needs a few small finishing touches, which means I’ve immediately lost interest and started working on something comepletely different - map generation. You can see the prototype here. Above is the old hard-coded layout I’ve been using until now. I’ve finally learnt to use tilemaps and even added some rudimentary graphics. Shocking. Now I have to make it play nice with the rest of the code, which mainly means rewriting the pathfinding system again. After that I’ll see if I can add some useful overlays to make it possible to view peeps in other ways than just the data dump I’ve been using so far.

The map generator works this way: After I specify the map bounds, it picks a random tile to place the first corridor and then loops to place additional corridor in a random tile which is adjacent to an existing corridor and a tile that is still inaccessible. When there are no more such tiles, the rest of the map is filled with rooms facing a random corridor and the corridors themselves are assigned tiles that connect correctly to the adjacent tiles. In some edge cases a corridor ends up adjacent to just one other corridor (other neighbouring tiles are rooms with doors facing elsewhere or out of bounds) so those get converted into a room or - very rarely - into an empty space.
You can notice that there are a few ugly clusters of corridors, but the results are good enough for my purposes.

Hopefully I’ll be able to show it off soon. In the meantime let this post be a resolute “I’m not dead yet”.

4 Likes

To celebrate my progress I’ve decided to set a version number. Allow me to present…

Version -1.00
(I’ll be slowly making my way to version 0.00, which should have a basis for the intended gameplay)

What’s new:

  • A starting menu with a few options
  • Randomly generated map
    • There’s a button in the bottom-left corner that turn on an overlay showing peep density in the various rooms.
  • Remade list of peeps which is nicer to look at and conveys less information in a less practical manner!
    • You can scroll with the mousewheel. The scroll speed is kinda too slow. I made it so the peeps leaving the visible part of the list fade away and any reasonable scroll speed would make the effect impossible to see, sorry. I’ll add some buttons to skip by pages later.
    • Selecting a peep in the list will track their position and activity on the map.
  • Similar list for all buildings.
    • Buildings are no longer placed randomly. Food dispensers, for example, will prefer to be placed close to Sleeping pods (as peeps tend to be hungry after sleep) but away from other dispensers. This helps to keep the buildings bunched up together, though some seeds still end up with some weird placements.
    • The production information might be slightly off, but it should give you a general idea
    • If you raise the number of peeps (and thus the number of built buildings), some of the sleeping pods and dispensers will go bankrupt over time if they happen to be in the wrong location. C’est la vie. Handling buildings that consistently lose money is probably going to be my focus going forward.
  • Peeps now have a name and a face. While it seems like a superficial change, it pushed me from relying on just their internal ID too much. Plus anything to make them feel more alive is good.
    • Additionally they start with randomized hunger and fatigue. Money is randomized as well, but the range is currently set to 5000-5000 to make sure even unemployed peeps are able to participate in the economy for a while.

And that’s about it. There’s a lot of changes under the hood as well including a big overhaul of the data structure, utilization of different collections, re-rewrites of many functions and so on.

Next up:

  • Aside from handling unprofitable buildings and improving the UI somewhat (for example making the job list clickable the same way the peep list is), I’d like to add a log window that would display some things that are currently just dumped into the console - some less frequent “thoughts” of the peeps, notification that power output of the power plant(s) isn’t enough to cover the station’s needs, stuff like that.
  • Higher-tier dormitories and restaurants have been almost done for a while but I still haven’t found the time to actually put them in, so maybe next time.
  • With a bigger map it is now possible for a peep to be late for work, as the peeps always set their clock to 30 minutes before the work starts and getting from one tile to another takes (kinda unreasonable) 5 minutes, but it’s rare and I’ve yet to see one be late by more than 5 minutes. Rather than fixing their alarm clocks, I’ll see if I can add some consequences, since right now all that happens is that the building loses a tiny amount of its normal production.
  • If you generate a map with multiple sleeping pods, you’ll sometimes see a peep ping-pong between them as they find out the queue is too long and try the other one. I’m going to give them some memory of places they’ve been to for this case.
  • In the longer term I’d like to start working on giving peeps opinions on the various rooms as well as other peeps, so that if a particular room has a queue every time a peep tries to use it, they’d eventually start to dislike it and maybe prefer to go to another one, even though it’s a bit farther.
5 Likes

Hi @Klear
Where can we try your sim ?

The community page.

Seems like I haven’t posted any updates this year. That is in part because I haven’t got much time to work on this lately. Additionaly, as I wrote earlier:

However - with one last exertion of will I’ve managed to make that confusing mess to behave the way I want, so I guess I can go on and hopefully I’ll be able to tame it by the time I have to revisit that particular part of the code.

Yeah. The time to revisit that code has come and it wasn’t pretty, but I’ve finally managed to make it work. I hope. Namely - I now have a function that can take real demand for a service over the past two days including the price the peeps would be willing to pay for it and decide how many buildings of said types is it worth it to build, taking into account that some of them might prefer a better but more expensive option and set the prices accordingly. I still have to implement this for most building types, but it’s a start.

Oh, and I have some pie charts now, so that’s nice. I was going to write a bit about some things I will have to solve further down the road, but this will do for now.

3 Likes

Sigh. I wanted to post a new version showcasing a fully supply/demand driven economy, but the last-minute addition of restaurants (better quality alternative to food dispensers) makes the economy really volatile, so I’m going to have a add a couple of extra things I thought I could do without. Trying to fix crashing economy might be harder than fixing crashing code, but it’s kinda eye-opening.

  • The major thing I didn’t take into accout is where the costs of a business come from. The idea was that a restaurant meal would be more expensive, because the price to build a restaurant is much higher than a simple dispenser, staff needs to be paid and energy demands are higher. While all that is true, turns out the biggest item on the budget are the raw goods and that is the same for the dispenser and the restaurant. As it happens, with enough demand the minimal price (to cover expenses and see enough return on the investment) ends up being the same for both types of eateries after being rounded to a whole number and as soon as restaurants start offering better meals for the same price, demand for dispensers drops dramatically (they still sell some to peeps who get hungry at atypical hours when the restaurants are closed) and that leads to the dispenser meal price shooting up. And since all wages are calculated from the price of a dispenser meal (which should in theory be the cheapest sustenance available), everything starts getting more expensive, which means less and less peeps can afford food at all, further increasing the costs for the rest of them and the whole economy goes down the shitter. It’s equally frustrating and fascinating to watch.
    Now, the easiest fix would be to make sure the price of a dispenser meal can never be equal to or more than any other available meal, but I’m trying to create a libertanian nightmare here, so I’d prefer to avoid code that could be interpreted as government intervention, no matter how small. Right now business owners are setting their prices so that their initial investment returns in 30 days, so maybe lowering this number could help me. Other than that, I’ll fiddle with the preset values and hopefully come up with a solution.

  • Additionally, I’ve noticed there’s more than few notifications of peeps being unable to pay for something. Right now there’s no penalty, as available money is checked before most transactions, so this only happens when business owners need to buy resources for their factories etc. They should have enough money to cover these expenses, but with the market being as volatile as it is, there are occasinal shortages, which means the rest has to be bought from the dock for more money.
    I guess I’ll require business owners to keep a certain amount of cash on hand at all times. They can buy the penthouse suites once their business starts consistently making money.

  • Finally, a lot of the volatility of the market is caused by the fact that a lot of demand/supply (and therefore prices/wages) are calculated based on the amounts needed/sold the day before, which sends the prices up and down dramtiacally if anything happens and it takes a while to settle… and by that time the homeless and jobless peeps run out of food money so the economy shrinks and causes new upheavals.
    What I’m going to do is to track supply and demand over longer periods of time to make any changes more gradual. It might lead to longer shortages as the market will take a bit longer to adjust, but the tradeoff in having all prices more stable should be worth it.
    Second, I’ll automatically be giving some free money to every peep who wants to buy food but can’t afford it. This is a stop-gap measure until I implement begging and stealing later, but it will let me observe the economy for longer without it crashing. And finally, I’ll implement a system to make the peeps actually close businesses that are in the red. I was avoiding this, as I didn’t want them to close buildings that just happened to have a bad day due to some hiccup, but with the other improvements to the economy it should work well.

So that’s about where I am right now. Depending on how much time I have, I should be able to post version -0.90 later this week.

9 Likes