Hi! I’m just your average, fairly beginner, computer science student doing personal programming side projects, and who is probably out of his depth and has no clue what he’s doing. So, I might need some extra help/explanation to understand things.
Games and Branching Narratives
It’s very frustrating to put this context into words, but this diagram/picture really helps frame my question (Note: Potential spoilers for The Stanley Parable):
Something that has always been on my mind is how games can branching ‘paths’. There is only so far you can go with nested if-statements before you get a horrible mess. Now, after some research – I discovered the ‘digraph’…
What I’ve Done
Well, I began to plan out a way to implement a digraph. I found this guide: https://medium.com/basecs/from-theory-to-practice-representing-graphs-cfd782c5be38 To be very useful, and I was going to implement an adjacency list.
To traverse the graph, I’d create a “graph cursor”. The graph cursor could be set to a position if needed, but otherwise had to follow the directional rules of whichever node it currently ‘sat’ on.
The nodes would contain the data for whatever the ‘event’ was (e.g. A story dialog event where the player would have to choose which fraction to side with), in addition, it would also contain rules for ‘prerequisites’ to disable certain branches if the player didn’t meet them (e.g. Player needs at least 100 reputation before being able to access a dialog option/quest line).
Now, there is the issue of how in the world each node would have any knowledge of what the other nodes are (How to know which nodes to link together) – which can be solved by taking a page from the web, and assign each node with a resource identifier…
But, here’s where my inexperience is really leading to my downfall.
I defined node as an ‘event’ but that… isn’t quite correct.
In an overview, a digraph is just a set of related data. The rules define the directional nature of the data, but does not define the conditions for choosing one path over another.
I’m trying to force the data structure to store ‘events’, as if that’s meaningful to the digraph. The digraph doesn’t care what data it stores, it just defines how it is stored!
So… what does that mean?
Well, I came up with an alternative model/abstraction. Based more so on webpages/choose your own adventure books. Rather then representing each nodes and the connections between nodes – there is just a list of “pages” with IDs. A page can contain outgoing links based on the ID. If a page is deleted or a link points to the wrong thing, you just get a 404 error, or just a wrong link.
But… you can create a digraph model of this too.
So at the end of it all, is there any point in trying to implement a digraph structure? At least in this sort of context, I mean, obviously it’s useful for any graph theory heavy stuff.
But like, was there any advantages of the digraph structure in the first place?
I haven’t implemented/attempted to create any of this yet… this is just what I’ve found out from planning things out.
I just want to make sure I’ve got it right this time.
If my question has issues, please contact me so I can improve it.
If my question is wrong, well… I don’t know what to say. I need help from someone more experienced then me. If this isn’t the right place to put it – tell me where else I should go.
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!