cursed comment time
All checks were successful
Web/pipeline/head This commit looks good

This commit is contained in:
Ell 2021-05-24 19:37:12 +02:00
parent c263947095
commit 24c375fd2d
4 changed files with 189 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

@ -180,5 +180,12 @@
"book": true, "book": true,
"prompt": "https://blog.reedsy.com/creative-writing-prompts/contests/90/submissions/63882/", "prompt": "https://blog.reedsy.com/creative-writing-prompts/contests/90/submissions/63882/",
"discuss": "https://twitter.com/Ellpeck/status/1385686796911185920" "discuss": "https://twitter.com/Ellpeck/status/1385686796911185920"
},
{
"name": "One Year of Tiny Life, and Cursed Comment Time",
"summary": "It's been exactly one year since I started working on my isometric Sims-style life simulation game Tiny Life, and since then, a lot has happened, especially in the realm of weird, funny and cursed comments in the code.",
"id": "tiny_life_one_year",
"cat": ["Programming", "Featured"],
"date": "5/24/2021"
} }
] ]

View file

@ -0,0 +1,182 @@
On this day, exactly one year ago, I made my first commit to the Tiny Life repository. Since that first commit, which included some code for the isometric perspective that the game uses, Tiny Life has come *a long way*.
![](res/tiny_life_one_year/commit.png =100%x*)
If you don't recall just how long of a way it has come, or you don't even know about the game yet: Tiny Life is, as I wrote on its [itch page](https://ellpeck.itch.io/tiny-life):
> Tiny Life is a fun simulation game that tries to capture the essence of games like The Sims, but in an isometric pixelart style.
>
> In the game, you control a set of people that live together in a household. You take care of their daily needs, build their skills, forge new relationships... or just mess up their entire life in whatever way you can think of!
So, to celebrate, and because of a Twitter poll I did a while ago that made it clear that yall are interested in something like this, let's go through Tiny Life's current code and fish out some funny, cursed and weird code comments that just naturally come about when making a game that tries to simulate the personalities and behaviors of human people.
While this blog post *does* include a lot of programming-related humor, most of the comments are still funny and a bit ridiculous out of context, so you don't have to be a programmer to laugh along by any means.
![](res/tiny_life_one_year/search.png =100%x*)
That should do for now. *Oh, boy.* Note that I'll just be going through them using the order they appear in these search results, so the funniest ones won't be at the start or the end, but just... somewhere in between.
First up, this is one that most of you will probably find pretty relatable.
```cs
// we want people to clean dishes when they're hungry to make space for food
Ai = {
SolvedNeeds = new[] {NeedType.Hunger},
}
```
This one is for the introverts (to whom I most certainly belong) out there.
```cs
// we only want to visit someone when we're currently at home for long enough
if (a)
return i.Person.LotVisitCooldown <= TimeSpan.Zero && i.Person.LastVisitedLot == i.Person.HomeLot ? Valid : Hidden;
```
Teenagers should probably remember this one. Consent is (very unironically) important, yall!
```cs
// automatic romance interactions should only happen if we're already romantic towards each other
return relationship?.RomanceLevel > 0 ? Valid : Hidden;
```
Fair enough.
```cs
// eat food if we're hungry
if (person.GetNeedPercentage(NeedType.Hunger) <= 0.5F && obj.ServingSize <= 1)
return ActionType.Eat.Construct(person.GetHeldActionInfo());
```
Especially in the city! Don't linger around too long, kids.
```cs
// move to the sidewalk once we're done driving
var road = this.Map.GetClosestRoad(car.Position.ToPoint(), Map.RoadRadius + 1);
```
You: Oh no, my car broke down!
Me:
```cs
// if the driving fails, we always want to walk to the goal in the end
return base.ShouldFail(completedAction, completion) && completedAction is not DriveAction;
```
Do yall also do this thing where you're like "I cleaned *a single dish*, now I can take a break"?
```cs
// should we start to take a break between actions?
if (this.OnBetweenActions(time, passedInGame, speed, current, completion)) {
this.isBetweenActions = true;
return true;
}
```
It might be sad to hear, but this is something *you* have to do as well.
```cs
// we want to prioritize going to work over sleeping automatically
if (this.StartedAutomatically && this.Person.Job != null && this.Person.Job.Type.IsTimeToWork(GameImpl.Instance.CurrentTime + TimeSpan.FromHours(1)))
return CompletionType.Canceled;
```
A bit creepy, don't you think?
```cs
// follow our partner until we reach them
if (this.IsMain) {
this.followTimer -= time.ElapsedGameTime;
```
Jesus Christ, mom, how many more times do you want to tell me that *same story*?
```cs
// we add the recent social to the relationship of the recipient
// so it represents an "I've heard this story already" list
relationship.AddRecentSocial(action.Type);
```
Also... fair enough.
```cs
// make lots more interesting if we have friends on them
lot = Random.GetRandomWeightedEntry(lots, l => l.Type.GetVisitPriority(l, this.Person));
```
It really *is* based on our mood how efficiently we work.
```cs
// if we're currently working, we should increase job performance based on our mood
var performance = this.Person.Needs.Values.Count(n => n.Percentage >= 0.75F) * 0.004F;
```
Does this also apply to *sleepovers*?
```cs
// the bed that we last slept in should be the one we try to sleep in again
if (this.HasCategory(person, ObjectCategory.Bed) && categories.HasFlag(ObjectCategory.Bed) && this.Id == person.LastBedSleptIn)
return 10;
```
Fair... enough.
```cs
// pee puddles should be more disgusting
DecorativeRating = f => f.Colors[0] == 1 ? -30 : -10
```
For this one, I especially like that I chose to name the variable `naked`.
```cs
// if someone isn't wearing pants and they aren't romantic with us, we should get (them) embarrassed
var naked = room.GetObjects<Person>()
.Where(p => p != this && p.GetRelationship(this, false)?.RomancePercentage < 0.25F && !p.WornLayers.HasFlag(ClothesLayer.Pants))
.ToArray();
```
This comment is, of course, in the `Person.Die` method.
```cs
// make friends sad
foreach (var rel in this.Relationships) {
```
You: I'm bored!
Me:
```cs
// if we don't have anything else to do, also try random actions
if (this.person.ActionQueue.Count <= 0 && this.person.CurrentActions.Count <= 0)
avail.AddRange(RandomActions);
```
Drunk people, anyone?
```cs
// don't do stuff that's inappropriate here
if (type.Settings.IsInappropriateElsewhere) {
```
Am I wrong? I say no.
```cs
// the front door is the closest door to the mailbox that connects outside and inside
var mailbox = this.GetObjects<Furniture>().FirstOrDefault(f => f.Type == FurnitureType.Mailbox);
```
Oh no, I *really* hope it isn't.
```cs
// is it just turning monday now?
var game = GameImpl.Instance;
if (game.Weekday == DayOfWeek.Sunday && (game.CurrentTime + passedInGame).Days != game.CurrentTime.Days) {
```
Clearly.
```cs
// if we're not loading from disk, we want to replace the floor with concrete
if (initializeRooms) {
```
*Am I wrong?*
```cs
// drywall should be considered ugly
if (wall.Wallpapers[side].BaseName == "Default")
rating--;
```
I said it once (multiple times, actually), and I'll say it again: *Am I wrong?*
```cs
// energetic people should be able to stay awake longer than others
public static readonly NeedType Energy = Register(new NeedType("Energy", 0.5F, p => ActionType.PassOut, p => p.HasPersonality(PersonalityType.Energetic) ? TimeSpan.FromHours(1) : TimeSpan.Zero, 10));
```
There we go, that's most of the funny human-related comments I could find with the very simple search I did. I definitely think some of these are *very funny* out of context, but what makes it even better is that some of them are also pretty funny *in* context. Humans really do act very weirdly sometimes, don't they?
All of that being said, thanks so much for reading this blog post. If you haven't already, you should definitely check out the game, as it is very much a passion project of mine, and I think it currently has enough content to be quite a bit of fun to play already.
You can download the game for free (or for a price of your choosing) on its [itch page](https://ellpeck.itch.io/tiny-life).
❤, everyone.