THIS. this is more or less my specialty (digital signal processing), so sorry for the coming wall of text. I was debating weather I should actually 'send' this since I don't know how much use it will actually be.
I've been working on a few things, and since this is the first time I'm reading this, right now I'm not fully grasping what it is you are trying to do.
As I hinted at, it sounds like you are working on a graph/node/network/system 'thing' and are working with information being spread/propagated, which as core to 'digital signal processing' which is one of my favorite subjects! Infact, I am designing my own neural network based on my own philosophies of digital signal processing. The issue with that is, I have my own set of terminology, and think of the problem in ways that may not match how you are currently handling things, so I may not be able to sync up 1:1 with what you are saying or trying to do.
So the player (and only the player) states a rumor. For me, I imagine this as starting out with a basic game mechanic to 'start' a rumor. Lets say this game mechanic starts with the player needing to 'learn' a bit of information (catches node 6 doing something), that 'unlocks' a new dialog option to have with node 1. the 'starting' of a rumor is simply clicking on the now available dialog option.
From that point on, its up to your 'algorithm' to distribute the rumor, and for the individual 'AIs' to dynamically react to the character (and rumor) based on that AI's understanding of the rumor.
I say it like this to break down the problem into two separate parts, 'the algorithm' which computes a number for every node (relative to each unique rumor or something), and 'AI' which is where we throw all the complex 'reactions' and deal with that part of the puzzle later.
From what I understand, you have two issues you want to solve:
1) It sounds like you have some basic way of modeling how the rumor 'spreads' however, the first issue is that
and
and you are looking for suggestions on how to 'design' your system to achieve a 'spread' that you like, as right now its not behaving how you would like it to.
2)
Correct about the design part and the unsatisfactory spread.
I not sure if you are using 'graph' to mean, designing how the nodes should behave and shown graphically, or if you literally mean a graph, showing you how data would propagate over time.
Literally graph as in nodes and edges
The reason I am jumping into this, with my wall of text, is this sounds like the kind of work I do irl. Digital signal processing, control theory, and control systems engineering is my field of interest and occupation, and pretty much work with similar node graphs. There is a lot to say and do. I bring up the warning about my particular vocabulary and problem solving techniques because If I just start throwing words at you, that probably wouldn't be the most useful. Simple questions like "what are you trying to do" have lots of ways of answering them based on what kind of mental 'frame' or perspective one has when asking and answering the question.
In my particular case it wouldnt be a problem - engineer myself but for the sake of history and understanding for others i kept wording simplified
So, I'll first ask, what kind of output do you want? I'm not asking: how do you want information to spread? Lets skip that, that's getting too deep into the details when we haven't set up the basics yet.
The output i want is basically something that will be based on this information being available or not. I stick to 'knowledge' for the time being to avoid confusion. I use a simplified model for the nodes where each node has an array attached to them called 'knowledge'. New knowledge is simply a new entry on top of this stack.
So that means, it's boolean. Characters can either 'act' on information or 'knowledge' or they can't 'act' on something because they don't know it yet. Are you sure that's all you want to do? Do you need to worry about 'where' they got information from? I say worry, but really I mean, do you want. Is this like where the NPC's 'say' where they heard something from? Similarly, do you need to worry about when, do characters react different depending on how recent the information is and does it matter how long ago since they initially heard the rumor? You say they (NPCs) know or don't know, but do you need to generate any other data that NPC's will use for certain behavers?
Yes and no. Knowledge is in fact boolean - it is either there or it is not. But for this particular part i dont want to add too much difficulty or complexity as knowledge is basically the gateway for other functions to work through the network at other times. So knowledge does not get any attributes itself. In terms of narrative (where this is also used for) the text is kept general enough to avoid any possible specifics to break logic etc. So the how, who, why etc are not a concern because that would require far too much handling down the road. In this simplified system the player will fill the gaps themselves in terms of 'the info spread but how specifically and by whom is not important to make decisions. I (the player) know now that certain info can spread without me actively doing something for it'. In narative and gaemplay functions there are simple checks for certain knowledge and will determine what to do from there or how to further the narrative.
Lets say, worst case scenario, you want the following type of data than NPC AI could work with:
- Rumor Heard from 0 to 100% (aka analog rather than binary/digital) (AI reaction may change depending on how much they know)
- Rumor Confidence 0 to 100% (AI reaction may change depending on how much they believe the rumor)
- Rumor Source Ratio (who did they learn 'what' from)
- Rumor delay (how long did it take for the rumor to reach them)
- Rumor relevance (how old is this rumor relative to 'now')
It also sounds like rumors have 'sub properties' which also affect both the AI and how data is distributed through the 'network'
I handle this before the actual graph problem. The function will not trigger unless certain conditions are fulfilled which means i can work with a simplified model.
Even with all that 'listed out' we still wouldn't be ready to talk about how to model the network yet, because there are still some nuances that are important in designing the network. You already know them, but I don't, things related to gameplay. You said that characters will be walking (moving in some way) around in the world, which may or may not affect things, maybe in teh future you want a mechanism where relationships could change, and then you also seem to highlight a concept of 'time' as with the key word 'trickle'
Time is a part of the gameplay and also provides a challenge for certain things to be 'realistic'. Time advances while the player interacts with the world but i can define certain aspects with a bit of freedom in this regard. Worst case explanation is like a 'auto-share' info between people due to modern devices etc So ignore this for now
The reason i bring up game mechanics, is to figure out how would we measure things? What do NPC's do, this is why I bring up the concept of 'acting' on information/knowledge. knowing how npc's are affected by the 'rumor' is how we will measure things. Lets say, the simplest case is boolean, maybe you have it writen such that, characters will interact one way with the player, and interact another way when the npc hear the rumor. Since it is boolean, this measurement is simple, we check to see how the NPC interacts with the play. That's when we can get into the complex concept of 'time' and gameplay. What kind of gameplay is core to the game, what is it players are doing? are they doing fetch quests and each quest takes about 20 minutes? The reason gameplay matters is to know how often players will be interacting with NPCs. knowing how often is the same as knowing how many measurement will be taken in a play session. So when it comes to the question about time, we can actually frame it relative to what kind of experience you want the players to have. Slow and grand, as playres will only intereact with NPC's very infrequently, as they travel the world. Or does the players interact with the NPC's a lot and doing so allows them to feel the world 'shifting' as they start to notice everyone starting to react to the rumor within one play session. The reason I give the worst case senario, with an analog version of rumor rather than boolean, is to hint at just how detailed and complex this can be, as reactions to the rumor could increase in intensity and tone.
so lets say that's all figure out:
- Rumor starting mechanic
- NPC's reactions (behavior) to rumors
- Game play and pacing
- the type of effect rumor 'spread' (aka delay, and the how important 'confidence' is)
As in the answer before: This is taken care of. All the mechanics you list are depending on a foundation to work. This can be done by a shitload of flags etc or by a model i am going for. Think in terms of one giant state machine where each character (npc and player) has a stack of 'knowledge' about all kinds of stuff on a single stack. Functions check this stack for certain knowledge and decide what to do then. If the knowledge doesnt exist do one thing or nothing , if it exists do another thing. Along those lines.
And lets say, we use your image as a template for how character's know each other and feel about each other. with all that, is when its times to start building a network and designing it.
When it comes to the network, we would need to develop ways to talk about it and measure it. Here's the simplest solution: a simulation.
Have a graph of rumor vs time. The graph has multiple colored lines. each line represents one of the nodes. the height of the line can be used to measure different effect, such as Rumor % heard (or anything else). Time, gets tricky, which is why we frame the topic with regards to how often players will be interacting with NPC's. Trying to talk about time introduces a new tricky concept, and that is 'when' does data 'propagate?'
A lot of the time, 'when' is dependent on 'how' you want data to propigate. But isn't the 'how' the whole thing we are trying to solve? No, in this case, when I say 'how' I talking about, how do you want players to perceive 'how' rumors spread. While effects like having NPC's being able to say 'who' they heard 'what' from is neat, that's a bit too literal. From my initial read, this is the vibe I got. The rumor spreads in the background, out of sight from the player, but it does spread, and it does spread 'eventually.' I actually want to use the term 'evenly' but I worry that would get confused with the concept of everyone 'equally' knowing a rumor, which is a bit different and part of the nuance of my personal terminology that could get in the way.
anyways, the reason I bring this up is because its much simpler to just 'spread' or 'propagate' data by modeling a network than it is trying to actually have NPC's literally 'give' data to one another. Again, this may be a bit confusing due to the terms I'm using and the ideas i'm stealing from digital signal processing. Think of it like this. If you were actually trying to simulate 1:1, you would have to deal with the issue that code can (for all intents and purposes) only execute 1 instruction at a time. So data would spread through the network one branch at a time, and you can get stange situations where maybe 2 friends can't meet each other in a while so are never able to talk, but learn the rumors off handed. This is fine if the rumor is a boolean. But if there is any analog (ie some percentage), what you'll get as a network with resonance that feeds data back into itself and can cause strange oscillations. While this can be modeled and simulated and even equations writen, its probably nothing you need.
No worries - i am still with you on this and this is the reason why i posted it here. Certain models simply dont pop up for me when i am looking for a solution to a problem. Signal processing is roughly what i was looking for as it looks like a proper simple model that could work.
What it sounds like you want is rather than data spread one branch at a time, you want it to spread one node at a time. simpler to work with, simpler to model, simpler to make, and simpler to have repeatable and predictable results. Right now, this sounds like what you are doing, with weighted connections, and it sounds like you are working on the mechanism inside each node to get a 'spread' behavior you want. Such a system, better lends itself to the concept of a rumor 'spreading' in the background (hidden from players) and is able to be rather even with how it distributes data, with no data being 'feed' back into the system, thus no unstable behavior such as oscillations.
Tompte's suggestion is basically a node focused form of Boolean propagation, hence why you are considering having more 'virtual' connections as a means of influencing the rate and speed of rumor spread.
Because I am used to analog systems (or float type variables in code), my suggestion would be a bit different. Lets keep the weighted connection idea. In a node focused spreading technique, data propagates on 'ticks.' At the start of a 'tick,' every node that has data to share 'sends' data out, and the end of ever 'tock' every node evaluates and remembers what it hears. This is how most complex systems are modeled, with the tick being input data, and the tock being output data, and then the next tick you just set the previous output as the new input and recalculate the output. This is how circuits are simulated, how neural networks are built, and how digital audio filters work. The network, is just a neat matrix that represents the 'system' or the network, and the input and outputs are just 'state vectors.'
This is why I say this is my thing, because that's how I'd model it and I may be able to help if you are using this technique (assuming I can get python and matlab working again to generate some graphs).
anyways, here's how the process works for a 'node focus' type of spread.
Say each node has a variable called "rumor heard" which equals a % between 0 to 100%
The player tells node 1 a rumor, lets assume that this is 100% on the first try.
So the algoithm is just dealing with the NPC's and we'll ignore the player node.
So now we 'start' the algorithm.
The algothim starts with a 'current' state vector, lets say [1.00, 0.00, 0.00, 0.00]
where node 1 knows 100%, and node 2 3 and 4 know nothing
On the tick, every node 'broadcast' how much it knows (sending the previous output to be the new input into the 'matrix' or algothith)
on the tock, ever node computes what it hears
lets say 2 and 3 both connect to 1, and 4 connects to 2 and 3
both 2 and 3 started with 0.00, so 4 doesn't learn anything new from either.
However, at the same time, nodes 2 and 3 both learn something from node 1
Remember, everyone already 'broadcasted' so we avoid the issue where they start with nothing but at the same time are learning something
here's what could happen, and what I'm guessing you are trying, every node basically 'adds up' what they hear. lets say that they don't hear 100% lets say that the weights you are using can be used to describe how fast information spread. so between 1 and 2, lets say they are friends and call it 50% (aka 0.5 not 1.0 like with what you are starting with), so on the first 'broadcast' node 2 learns a lot (but not all). However lets say 3 is only a classmate, and only overhears 10% (0.1 weight)
so at the end, this is what the output looks like (what nodes now know)
[1.00, 0.5, 0.1, 0] = state vector
technically, all connections are 2 way, in this over simplified model, so technically 2 was also talking to 1, but since 2 started with nothing, its not like 1 could learn anything from 2.
anyways, that ends one single unit of time, you have to decide when there should be another tick tock.
next time this is what happens. we take the state vector, and use it as the input (thus the state vector acts as memory for all the nodes, you can have 1 state vector for each rumor, this way you can simulate any number of rumors without having to worry about managing data) (using it as an input is the 'broadcasting' )
so this time, node 2 says I know 50%, and 3 says 10% to node 4
again, the connections have weights, so maybe 3 is friends with 4, but 2 is a classmate, so 10% with 2, and 50% with 3
thus 4 learns 2's 50% * 0.1 weight = 5%, and 3's 10% * 0.5 = 5%
5+5 = 4 learns 10% total this round.
2 learn the next 50% and adds it to their existing 50% to learn 100% now all together, while 3 only learns another 10% to be at 20% total
Next tick tock
4 learns 2's 100% * 0.1 = 10%
and 3's 20% * 0.5 = 10%
10 + 10 + the previous 10% = 30% now
But remember, at the same time, all connections are 2 directional, so technically 3 will learn something from 4 (even if that deosn't make sense)
4 was 10%, with a weight of 0.5, so 3 learns 5% from 4, while also still learning 10% directly from 1
so 5 + 10 + the previous 20% = 35%
next tick tock, 4 will only learn 10% more from 2 (never learning any faster)
but from 3, its 17.5% now (growing!)
anyways, with this technique something happens. because of data feeding back between nodes, and adding up (even though that doesn't make sense and 2 people can't learn more about the rumor if they are just talking back and forth), it does generate an interesting effect you might like. 1 and 2 are like a group, and 3 and 4 are like another group, once the rumor reached the second group (by node 3 first), it will rapidly grow between friends, so what you will see in a simulation is one group will quickly learn a rumor, it will be slow to reach another group, but onec it does, it grows quickly.
This is a bi-directional integral system, basically, very predictable, and at the end everyone will be at 100%, so you don't have to worry about wierd things like resonance and the flow of data (aka this is how to simulate fire). You can do tricks like, maybe nodes don't prodcast until they learn enough about a rumor (so a delay effect), also because it only ever adds, you might want really small weights (0.001, and doing more loops to make things spread more evenly, even if the player only interacts with NPCs every 20 loops, it will let you get a perspective on how to look at time). With this, you could make a graph to know who learns what when depending on who learns the rumor first. Can NPC's Act on a knowledge (aka that Boolean effect) at 50% awareness, 90%, or do they need to be at 100% before players will notice? And what if knowledge isn't going two directions, what if its not a conversation, but rather, one direction (one AI overhearing another in class), well the system can simulate that, you just need to know how to model it.
This is actually an interesting method i could make use of on an extra layer. I wouldnt mind weird resonances actually as this is supposed to be a social network and not a technical network. Thus weird stuff would make certain things more natural aka unpredictable. As of now things are already kind of unpredictale since the user's actions can and will change relations between themselves and nodes. So even if the player never interacts with a certain group the 'rumour' system would still cause knowledge to trickle into other groups and cause consequences. The groups are only partially 'static' and the user's interaction with the world can actually change the composition of those groups thus also knowledge flow.
If this interest you at all, I'll be happy to talk about it further (I've talked enough as it is, sorry about that), and sorry if I wasn't all that clear on the first try.