A better corruption method for games

Diconica

Well-Known Member
Apr 25, 2020
1,092
1,138
I know this works fine in C/C++ I am currently rewriting the system to python.
I think I got it refined enough it won't be to heavy for it.

There are multiple classes in the system the two most important are the character_ai and task. I previously called it event_type.
The task class keeps track of what stats it effects on the AI it has a function that can be assigned to run for that task. It also can track modifiers such as what makes that event possible to run. That last of those isn't as important as the first two.

Tasks:
You don't have permission to view the spoiler content. Log in or register now.
You can effectively make a task do anything. You can make a task of running multiple other tasks in succession. Such as if your Character had a job assignment. Or if they came home and wanted to cook something.
Tasks can be assigned to people, locations, jobs and objects.

Say your Character gets home from work. It wants to raise happiness up some and it looks for entertainment. It checks the location which also acts as the object manager. The object manager tells the character_ai what is in that area. It can make a selection from that or use a path system to check outside the area and find something to do away from there.

Anything: I said that didn't I:
Let me expand on that to the fullest extent. You could technically give it the ability to write and expand its own code.
If you wrote it a function to find the best answers to a question it could do that. If you added a neural net to a function to identify whatever it could do that.
But we don't need anything to that level for the game.

What this allows is creating a crap load of interactivity for pretty much anything in the game you can add without a lot of programming to do it.
If you want the AI to come home and study or cook or reload the fridge or watch tv go to bed ... all done with minimal effort.

You start off with a few basic tasks attached to the AI and a few functions that determine what the goals are and which one has priority at the moment.
Example: You don't want the AI deciding it should take a nap over going to the hospital if its health is low.

So what is so good about the concept. Well you get a huge amount of functionality without having to write most of the code you would if you use conventional methods.

Expanding it to handle corruption / sexuality:
There is a class for relation:
You don't have permission to view the spoiler content. Log in or register now.
Events is another name for tasks. They function identical and use the same class.
When the character performs that sexual act or performs in an event such as exhibition or voyeurism ... it runs the event at the end of which it modifies the specific stats of the AI listed in that event.

As I said above tasks can be anything. Including running other tasks or a list of tasks.
Drive, walk, strip one item or all items or show tits to full sex session.
You only need to create the task once for all the characters to use it.

The final 4 or now 3:
Location. It can be a scenic area or building or just a location on the map. It store a name and data for assets needed for it.
More importantly you can store them with parent child connection. This way your AI class can search for stuff it wants to find.
It can also stores ownership info such as for a home, occupants the people currently in that location, tasks / events attached to location.
Maybe, you are at the beach and want to have a volley ball event or a wet_T competition.
It also stores jobs available at the location.
Finally object management.This was originally a separate class but I chose to combine it into location.
It simply provide the Character with a list of objects in the area that can be interacted with. This way the AI can find stuff to do on its own.

Object. This can be anything the AI interacts with. Vending machine, tv, sword, stove, register ...
It has location orientation information. When placed it registers with the local area.
It also stores a list of tasks and states and depending on the state it can give out different tasks.
Example refrigerator doesn't need to advertise giving out food if it is empty.
So the task it gives out is go buy food to fill me up.
Then once the fridge has food in it. It switch back to I'm a source of food you can increase energy here.

Job: This has title location time start and end pay and the list of tasks that need doing and job requirements.

I mentioned the Character_AI class at the top:
You don't have permission to view the spoiler content. Log in or register now.
The biggest part about this class is the goal system and AI stats.
Goals can be added and removed. The priority of goals always changes depending on the state of the AI and its stats and its personality traits.
Each time a task is completed an evaluation is done to determine what is the new priority.
This system is mostly used for AI that are autonomous. Not one that is Player driven.
However, it could be left in to provide hints to the player. Things like "I'm hungry", "I'm horny" or it could even be used to give more precise hints like "I'm horny, didn't a new strip club open up?" ...

In addition to that system a lot more can be added on via the task system.

But you can also add in a dialog system. There are a couple different levels to what this can be built up.
The easiest is using sentence pools for sentence substitution. It requires writing multiple sentences to represent the way different characters with different personality types may act at different levels. You can even have an AI that is hanging around another one pick up sentences from the other ones pool.
You can also vary reactions between AI's and the player driven character based on their levels and personality types.
A cut above this would include word supplementation. You basically use a format for a number of different sentence and then create pools of words and rewrite sentences as the personality changes.

It is also possible to build in a rating system so the AI evaluates how well different tasks work in increasing stats or accomplishing the goal.
The same can be done for the dialog system.

Sexual corruption:
The way this ties into corruption is you can write a task for each type of sexual event. It will work for all characters if done correctly.
It can be done in such a manor as the correct assets and scenes are used for each AI and location as needed.
that means the work to make 1000 characters in your game isn't much more than making work for 1 character.
The primary means of using it would be create various tasks for sexual acts or events. These tasks modify stuff like character experience for that task.
it might also increase happiness or other attributes of the character. The skill level and mental stats can be used as gates for making other sex acts available.
Those levels can all vary depending on the AI personality you setup. So one character may be easier to get in bed vs another. One may be worried about getting pregnant more so be more willing to do anal over vaginal ... Use your imagination!!!

What about the story?
I want to make this clear up front. It by no means prevents linear story telling. You just need to know how to use it!
Easy, you use tasks for that also. You simply set the requirements for that task to run and attach it to a location or the character.
For that matter you could connect it to an object or even a job. Maybe, you want the trigger to be when your AI uses the water cooler at work or goes to work on such and such day or after they reach a certain level of sexuality.

You also can use different methods to corrupt a person. You could use incrementalism or you could force them under threat of life the AI would most likely do so if there isn't some personality trait you gave them that prevents it. You could use carrot and stick methods. Because it has goals of being happy and not wanting to be hurt you could create tasks that provide the pain make them suffer by lowering happiness it could then evaulate the behavior of saying no as not leading to being happy. But that would require adding the evaluation method performance. Over time it would rate each action based on how much it affects stuff like happiness, comfort, energy, health ... It would then create modifiers for various actions to influence what the character does.

Really the only limiting factor to what you can do with this is your own imagination.

The code snippets are just from a test demo I have been working with at home.

All the functionality discussed in this is because one simple concept being able to pass a container for task from one thing to another. The character_AI can get a skill from an object such as a book. It then could use a task to teach other AI to propagate that task to others. Technically the AI never has to do anything more than run most the tasks. It has no need to store them long term because when it goes back to a location it will still be there.
In C++ this can save a crap load of memory usage and boost performance in large scale simulations. The reason being is all those tasks are really just created one time and accessed via a pointer to it. Not sure exactly how python does it.
 
Last edited:
  • Like
Reactions: DuniX

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,179
3,610
You've clearly put a lot of thought into this and I don't want to criticize your efforts or intellectual rigor.

However I think you've made a significant incorrect assumption being that players want an "accurate" simulation. I think in general what players really want is a fun game. This means the game designer can and should *design* the game for player enjoyment as the primary goal. The designers, writers, and programmers thus might build a system that "cheats" to cause certain outcomes that would not otherwise "realistically" occur in an accurate simulation.

I think games that are purely "mechanical" simulations can very easily end up feeling lifeless and robotic

Non-linear design can of course go too far and poorly thought out gameplay can be confusing or frustrating, especially where the connection between player actions or choices and the result is not clear. But when done well, then the game designer/writers can design an experience that is "human" and rewarding, and allow surprising twists that are not the result of exact calculations.
 
Last edited:

Tompte

Member
Dec 22, 2017
215
155
This kind of stuff appeals to my interests, so allow me to share some of my thoughts.

I have tried to achieve something similar in my game. I'm not going for realism, rather in my game you can play with many different player-made characters and I want them to behave differently, true to their character, and not just be carbon copies of one another with different base stats.

The way I look at it is there's an end point in a character's progression, which is when they've become the player's own ideal sex slave. Characters may start at different points in their progression, due to their stats and traits, but they should all end up at the end point eventually. All I am doing is trying to get them to take different paths to it. Ideally, there should be multiple end points as well.

I did not go for an neural network solution. Rather it's a trigger-response system. When an action targets a character, an event gets sent, giving them an opportunity to respond to it. Things like "had a nap", "sucked a [large] cock", "had sex [with a loved one]". Events are composed from a list of generic actions plus contextual flags. Then I combine those into a list of highly specific events [Had sex] + [Male] + [Non-consensual] => "Had sex with male", "Had non-consensual sex". A single action can generate dozens of these types of events.

How the character responds depends partially on what they're into, what and whom they like or dislike, so there's a whole underlying affinity system as well. There's nothing fancy going on. Just a list of values paired to each event. I can also take the sum of all events to get a score for the entire experience. No opinion is fixed, so the character can learn to love anything the player wants them to.

The effect is that the player starts out feeling a lot of friction with their subjects but over time that friction dissipates, as they align more and more with the player's wants and needs. But it also creates enough of an opportunity for a player to realize that maybe certain characters need a different approach.

I don't necessarily recommend doing it this way. Despite being mostly successful, it turned out to be quite a large engineering problem and it took me a long time to iron out the details and to complete. It also became quite an ordeal to surface important numbers and clues to the player in a pedagogic way, without dispelling the illusion.
 
Last edited:
  • Like
Reactions: DuniX and Diconica

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,262
15,061
Non-linear design can of course go too far and poorly thought out gameplay can be confusing or frustrating, especially where the connection between player actions or choices and the result is not clear.
Exactly.

While it's not realistic that, by example, a slut become addicted to MC's dick as easily than a virgin, it's what the players expect, because it tell them how to play the game. All games, even real-time strategy ones, rely massively on patterns because of this. It give to the player the level of predictability needed for the game to present a challenge while still being enjoyable.

This don't mean that all the characters have to follow the exact same pattern, there's obviously place for adjustment due to their personality. But the outcome of a given action with one character should give you a good overview of what would happen if you do the same with another girl, accordingly to her personality.
That you need to have a fabulously romantic date night with the "princess" girl before she agree for sex, doesn't mean that you need to have the same fabulously romantic date night with the "rebellious" girl. But it still imply that, the girls need to have had a marvelous time with you, before they agree for sex. What "marvelous time" mean depending of their personality.
And this don't need a complex mechanism. A basic flag system and a counter are enough to make this looks realistic enough for the player ; the key word being "enough".

It's not even rewarding for the author, because most players will just assume that it's just a randomization. Many will probably even complain because of this.


But when done well, then the game designer/writers can design an experience that is "human" and rewarding, and allow surprising twists that are not the result of exact calculations.
Agreed again.

The problem have never been on the coder's hands, but on the writer's ones.

Having a counter to follow the progression of the corruption only mean grinding when you are a bad writer. When you're a good one you'll have, let's says five different BJ scenes, all different in the place where it happen and the way it goes, and after the third one, boom, the player unlock the next step. And like he can still view the two extra scenes, if he want and when he want, it will feel even less grinding, because the scenes aren't limited to a pure progression.
And, obviously, the same apply when it come to the girls personality. A game mechanism can permit to represent it, but it will never permit to show it. It's the writing, and only it, that permit this.


But there's a point way more important...

The predictability of the advancement ensure that you'll have all the content you need. Since you know exactly how many steps there's between each level of corruption, you also know how many scenes you have to write ; what don't prevent you to write more, in order to give more freedom to the player.
What fall back on the lifeless and robotic feeling you talked about. The only way to make a game with such complex game mechanism is to rely exclusively on generic scenes. In the end you'll have spent days working on a marvelous game mechanism, to have a game that will looks exactly like all the pure grinding games that require the player to see the same scene ten times before he can finally see the next one.
And obviously, the players will not praise you for your skills. No, they'll shame you because your game is a shitty grinding one.
 

Diconica

Well-Known Member
Apr 25, 2020
1,092
1,138
You've clearly put a lot of thought into this and I don't want to criticize your efforts or intellectual rigor.

However I think you've made a significant incorrect assumption being that players want an "accurate" simulation. I think in general what players really want is a fun game. This means the game designer can and should *design* the game for player enjoyment as the primary goal. The designers, writers, and programmers thus might build a system that "cheats" to cause certain outcomes that would not otherwise "realistically" occur in an accurate simulation.

I think games that are purely "mechanical" simulations can very easily end up feeling lifeless and robotic

Non-linear design can of course go too far and poorly thought out gameplay can be confusing or frustrating, especially where the connection between player actions or choices and the result is not clear. But when done well, then the game designer/writers can design an experience that is "human" and rewarding, and allow surprising twists that are not the result of exact calculations.
Like I said at the top I don't suspect it would appeal to everyone. Especially those who just click through stuff to get to fapping.
This was originally made for a much bigger system.
I decided to try and move what I could of it to python because I find so many games that just have shitty progression systems.
There isn't any logic to some of them. Such as the girl is going to fuck a total stranger in public but is self-conscious of her tits so won't do a bikini comp.

There are some issues with it. Depending on your perspective and how much you choose to put into the system.
Lets pretend you are on the couch fucking. The problem is for some reason her health is low she hasn't eaten and she is starving. The goal priority could be switched to getting food immediately. If you set up the minimal means to solve it she would head to the kitchen grab something out of the fridge and eat it then probably come back to you. However, if you created a routine to were she can meat both goals she could choose to drag you with her to the kitchen while she starts scarfing down food has you banging her ass while she is bent over the counter.

The point:
If you look at it from the minimal stand point yea it gets real clinical and predictable. spend time with her build up her trust comfort around you, then touch and kissing, then making out .... Standard progression system.
However, as you pointed out it is up to the writer.
You can also add in routines or events for basically any combination of scenarios you can think of.
You also aren't required to stick to standard progression. You can also use goals such as staying alive making money to allow abuse to accomplish personality changes or just get them to do stuff they wouldn't normally do.
Hell you could even write a routine that adds positive weight to negative actions. You know such as how some people like some pain at times.

Think about it when you write a story you think about what the characters goals are and what their intended actions are and so on. Well in this case you are doing the same thing you just building routine methods from it.

In the original version the goal system is more adaptable.
But this is for writing a story and creating personality types. You probably want to control the direction of the character a lot more. So the goals priority level is more fixed and under the authors control.

This also means I can make a lot of characters with very little work and they will act very differently.

What it came from:
That said it also wasn't originally designed for these types of games it was more for a better AI in a larger server based RPG.
I wanted a way I could build in lots of abilities with ease into the AI and give it a fairly reasonable communication system for general use. So you don't have the issue like in skyrim were you hear the same line repeated 80,000 times in a play through. I can't count the number of times I heard, "I used to be an adventure like you,...".

The system also used to have the ability to rate the success of various actions and thus figure out what worked better for different situations.
The response system had sentence struct modification by using word substitutions. Then the paragraph would use a rating system for what each sentence was for. Such as if a sentences was used to display displeasure in something or with a person it could select from a pool for that sentence. Sentences that were intended to convey specific messages were standardized to keep it simple.

I cut it down for a several reasons. First, is pythons performance is much lower than C/C++. Secondly, ease of use.
But what I left in was the blend of a neural net and state system that can respond with unique behavior for each character.
Take a girl who goal is to become a pornstar vs one that wants to get a law degree. Different set of goals so different priorities and weights. So they are going to react very differently from one another.
The best part is you don't have to change the underlying code to create each of them you change the goal and values. Then if you want to speed things along faster use incentives / modifiers for the events.
If you want them to talk differently assign different response tables.

Since you can add any form of action that includes combat.
Since it is goal based depending on the AIs situation they can prioritize goals and thus change what they are doing.
 

DuniX

Well-Known Member
Dec 20, 2016
1,109
742
I don't think you system is achieving much even in terms of a "Dynamic System" that couldn't be achieved with some Traits, Stats and Tags.
The Sims is already a Dynamic System that could achive all you are proposing.
However, as you pointed out it is up to the writer.
You can also add in routines or events for basically any combination of scenarios you can think of.
If you need to write it, then you can tag it, that makes most of your AI system pointless since you can just use tags and the various stats to define the context of the situation.
AI and Simulation is also not magic, making Content be compatible with it means you really don't have that wide of a Possibility Space as you think. There is no Prostitutes without Prostitution Content, and if you have prostitution then you can give Traits and Stats for that.

Neural Networks are also notorious for being Black Boxes which is awful for the player gameplay.
By Random Chance you can makes some girls Completely Unfuckable! Surprise!
And neither you or the player will know what is happening or if it's a bug or a feature.
And Surprise Again! you can make ALL Girls Unfuckable by the model spazzing out for some reason.
 

Diconica

Well-Known Member
Apr 25, 2020
1,092
1,138
I don't think you system is achieving much even in terms of a "Dynamic System" that couldn't be achieved with some Traits, Stats and Tags.
The Sims is already a Dynamic System that could achive all you are proposing.

If you need to write it, then you can tag it, that makes most of your AI system pointless since you can just use tags and the various stats to define the context of the situation.
AI and Simulation is also not magic, making Content be compatible with it means you really don't have that wide of a Possibility Space as you think. There is no Prostitutes without Prostitution Content, and if you have prostitution then you can give Traits and Stats for that.

Neural Networks are also notorious for being Black Boxes which is awful for the player gameplay.
By Random Chance you can makes some girls Completely Unfuckable! Surprise!
And neither you or the player will know what is happening or if it's a bug or a feature.
And Surprise Again! you can make ALL Girls Unfuckable by the model spazzing out for some reason.
It's funny because I was just coming back on here to Rewrite the main post so it explains stuff a bit better.
When I am done I hope it clears stuff up a bit.
 

DuniX

Well-Known Member
Dec 20, 2016
1,109
742
That said I do have an Abstract System that is meant to represent similar more Advanced Corruption mechanics.
It works with Cards, more of the philosophy of Cultist Simulator throw everything on the table rather then Slay the Spire.

The problem I wanted to solve is precisely of that of Grinding while still maintaining Challenge, and make it as part of actual gameplay.
More specifically I wanted to make it possible for One Day Fuck(actual sex) if the stars align right for the player and they are particularly savvy.

How it works is All Sex Scenes and the like are Locked behind Resistance Cards and if you can disable or remove those cards By Any Means then you can do those scenes.
Cards Interact with each other in various ways and you want to setup things to attack those Resistance Cards even if temporary.

Of course in reality things aren't as simple, most cards are Hidden so it takes time to discover them so that you can eventually use the for your strategies. But all cards behaviour and interaction is deterministic so experienced players will eventually find some strategies that are more powerful in how fast they discover and break through, but that depends on the girl's overall "deck" that on top initially being random with various cards representing their "personality", they are also dynamically ever changing and can interact with other NPCs not just the player.
The "deck" they have today isn't going to be the deck they have tomorrow.

I wanted something Spontaneous for things to just Click and the Player and Character to have Chemistry with each other that makes things fast.
I also wanted for things to Spontaneous Explode Miserably if players are making egregious mistakes by pushing things too far, where their unstable house of cards they build comes crumbling down and when they manage to step on some landmines.
Slow and Steady should also be possible by building familiarity and trust and gradually progressing the relationship over the long term with a stable base of cards representing that.
 
Last edited:
  • Like
Reactions: Diconica

Diconica

Well-Known Member
Apr 25, 2020
1,092
1,138
I rewrote the original top post for this. I figured it might help if I actually explained what the AI system does and how it works and what it allows.