Procedural RPG OT: every action has consequences

Started by Legend, Apr 20, 2019, 09:02 PM

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

Legend

This is a new game concept I'm evaluating. Don't know when or if it'll be developed.


The medieval rpg is set in a fully simulated world. Every npc actively lives their life throughout all minutes of the day. Their jobs are real and their personality is based off their history. Every single item in the world can be tracked back to raw materials harvested from the earth. Kingdoms die and new ones take their place.

With this fully procedural world as a premise, actions have consequences.

Say a player goes on a killing spree in a small town. NPCs do not respawn and the town is abandoned forever. A young survivor might seek vengeance and train with a sword. In this fully dynamic world, this could start the survivor down a path that ends with them starting a rebellion against the corrupt king that let this happen.

Turn based combat and 2D graphics will keep this realistic to develop. Kinda more in line with a grand strategy game.


I think it should have an mmo style world where everyone can play together, and then people can generate their own private worlds to just play alone or with friends.

Legend

Could be cool if each playthrough gave you 10 random citizens to choose from at the start. That way your character can be a real person in the world with pre-existing social connections. Alternatively a custom player could be made as an outsider that just shows up within the game world one day.

A cool mode would be permadeath where you continue playing as your child.

A cool option would be end game events that change the dynamics. Zombies invade from the north, sea levels rise, mechanical automatons discovered underground, etc. Kinda like the end game events in Stellaris.


Anyway, on to the nitty gritty details. How would this self functioning empire really be implemented?


NPC AI will be handled with "roles." These are basically positions within society that define how an NPC operates. Farmer, smuggler, king, thief, guard, assassin, merchant, etc. Some NPCs might have multiple roles at a time and roles can dynamically change as needed. Each role has its own unique AI code and parameters, instead of it being a one size fits all situations.

Communication between NPCs/players will be mostly handled by a negotiation screen. The 1st person selects things from a list that they want to happen, and then the 1st person selects reasons from a list for why they should happen. For example a simple exchange could be buying a pie for 10 gold while a more advanced exchange could be threatening to burn down a person's house if they don't stay silent. This "desires & reasons" approach uses the same design philosophy as the previously mentioned "roles." Each desire and each reason is individually coded and only cares about itself.

Crafting is the cornerstone of the economy. "Wells" are places in the game world that produce raw materials from nothing. Everything else is crafted and produced. Oceans, lakes, rivers, forests, mineral deposits, snow, and such are examples of wells. Wells can be created, modified, and destroyed depending on actions within the world. The only defining trait of a well is that its resources are calculated as an approximation instead of as individual entities. The world map has wells defined with a heat map of sorts for each resource.


Extracting from wells is achieved with traditional crafting. When in the area, the well is inherently available as an input ingredient. These maps are also used when traveling and when new locations are founded (more on this later).




the-pi-guy

I feel like a lot of this stuff is what Todd Howard has been trying to do with Elder Scrolls.  

Legend

I feel like a lot of this stuff is what Todd Howard has been trying to do with Elder Scrolls.  
Well I certainly won't have the production value or graphics quality of those games!

A difference (at least in my mind) is that this game has less structure and is designed to be played many times. Instead of it being Skyrim with a more dynamic background, it's Civilization/grand strategy in first-person. At the moment I'm not sure if the game should have quests or story content.



Legend

I've started doing a little bit of coding just to block everything out.

The world logic runs on its own thread and is essentially a second application. All communication between the world and the player is abstracted and can be sent over a network if needed (so multiple people could play on the same game world).

Legend

Kinda making a nature survival sim lol. Everything alive needs food and water to stay alive. That way you could wage war by burning farms or damning rivers.

Not sure how I want to handle this though. I need a function that finds all objects that an animal is aware of. I guess I should just set it up to do it based on just visuals, and then again on just smell, and so on as needed.


I'm also thinking of using the inventory system for "everything." A backpack can hold a few pots just like a town can hold a few houses. Sorting things like that would make it easy to know stuff too.

If you are in a city, then you know of everything top level (unless it is hidden or small). There is no movement within a city or layout to a city. If a building is an open air cart, then you would also know what is in it.

The person is always either inside a specific building or outside without a specific location. Larger cities could have districts to split them up.


So either an item is inside nothing and has an xy position on the world map, or it is packed inside a parent object with zero information about the location inside.

(Some objects could have multiple places to store items, such as a human having a left hand and a right hand)


Inventory is mostly like the forum rpg. Containers have a max xyz per item and a total limit on weight. I think the amount of items should be limited in some way too. A hand can't hold 500 gold pieces for example. Putting gold in a bag should be encouraged.

Legend

Apr 23, 2019, 11:18 PM Last Edit: Apr 23, 2019, 11:44 PM by Legend
Ignoring the background sim, what should the game look like?

I'm thinking a 3d board game style overworld. A flat classic style map with 3D pieces for points of interest: castle, city, town, and outpost.

Icons on the map would show you and nearby people. Entering a point of interest could zoom in on the 3D icon and that would be it.

I guess it actually all should be a common hud.

Traveling out in the overworld and traveling within a poi are mostly the same. So the screens I need are:

Out and about. Show all nearby objects and show your current location.

Conversations. Have the fancy desire/reason screen.

Combat. All the combat specific screens.

Party management. Move items and restructure things.

They could be mixed around though. Conversations could happen mid combat (such as telling the enemy you yield or saying you will pay them to stop) and moving items could be whenever.


I think I'd have a generic "things that are relevant" menu that can dynamically reorganize and what not. So this menu would be the universal menu for showing every item/thing the player knows about.

This menu would include quick stats such as health, hunger, thirst, etc. for things that make sense. This way it is easy to see your whole party and what state everyone is in.

Clicking on a sentient object would let you open the dialogue screen. This window would show everything needed to construct a statement...

this is kinda just word soup.

I'm not sure how to structure these screens. Let me think about it some more.

Legend

I'm reworking the conversation system to make it more accessible and simultaneously deeper.

It is now a more traditional conversation where the NPC gives you a text response and you have a few text options to respond with.


Code: [Select]

NPC "Hello traveller"

"It's nice to see a friendly face"
"Show me your wares"
"Anything I can help you with?"
CUSTOM



I might quickly abandon this idea but along with a few default options, I'm going with full on freeform conversations where you can say whatever you would like!!!

It's not as crazy as it sounds. The game uses an internal language for all communication. This language is essentially a programing language with how it is set up. Only very specific words can be used and the structure is rigidly defined.

This internal language can be translated to English with some flavour text thrown in depending on the speaker and the situation. It cannot translate from English to this language.

The above conversation in the internal language could look like:


Code: [Select]

NPC "Greeting"

"Greeting"
"Ask wares"
"Ask help"
CUSTOM



It's a very simple internal language. From the game's point of view, it is very easy to understand what is being said and how things should react.

As the player, it allows the game to be quick and traditional when it's acceptable and slow and methodological when specific things are desired.

Instead of clicking on a response and directly saying/executing it, the player can click to edit the response first. For example.

Code: [Select]

NPC "Here is all I have to sell"

"Buy apple for 10 gold"
"Buy bread for 15 gold"
CUSTOM


Code: [Select]

NPC "Response wares"

"You give me apple and I give you 10 gold"
"You give me bread and I give you 15 gold"
CUSTOM


The response could be edited to "You give me apple and I give you 9 gold" if the player wants to haggle for example. Then all the calculations behind the scenes can determine if the NPC accepts.

By writing a custom response from scratch, the player could say "You give me your shoes or else I cut your legs off" and take the conversation in a completely different direction. Once the internal language is set, it can be parsed into a less wordy representation in English.


I'm not sure how exactly the internal language should be written, but I'd probably go with drag and drop blocks. Verb will have one or two slots for subjects and they can be joined with logical connectives. Essentially it is ((clause && clause) || clause) > clause which the AI can evaluate without a problem.


Because this system makes dialogue such a powerful tool, a lot of actions can be handled exclusively through dialogue. Talk to party members to give them instructions, talk to yourself to do things or initiate an auto pilot of sorts, leave notes around the game world, etc.



Heck if you thought custom dialogue was crazy, I'm even thinking of having all communications go through messengers. If a king is killed, everyone does not instantly know. Instead messenger birds would need to be sent out. On that note, I should also program it so that communication can work across species. Simple commands could work with animals but more complicated ones would not (unless the speaker is speaking the animals language).

This game is so bloody over the top and yet I think I'm going forward with it lol.

Legend

Animals and humans have a few survival stats.

Hunger
Thirst
Sickness

Health
Energy

The top three are stats that can be directly managed while the bottom two can only be improved by improving the others. If an animal is very sick then their health will decrease over time until they die.

When eating something, the item has 3 values to affect the first three stats and a third value that can hurt the eater. For example a beer would slightly decrease hunger, greatly decrease thirst, and super slightly increase sickness. A sword however would increase sickness and directly hurt the eater (why would you eat a sword lol).

Hunger and thirst can not go below zero. Sickness can go below zero and speed up recovery.


Items can be seen, smelled, or heard. Animals have a good sense of smell and can notice a pie in your backpack before they notice you.

Memory is something I'm not sure about. Things should be able to remember what they have seen in the past but I don't know a good way to program that. Simple method would be snapshots of the world with old information but that would use way too much data.

Legend

Apr 25, 2019, 01:08 AM Last Edit: Apr 25, 2019, 01:22 AM by Legend
I think I've figured out a knowledge system.

A central database of facts exist. These could be written in the internal language to make it pretty straightforward. A creature/human has a list referencing all of the facts that they know. Outdated/wrong facts are dereferenced as new information comes in and older facts can be dereferenced as they are forgotten. Once a fact is known by no one, it can be deleted from the central database.


This system is incredibly powerful and allows facts to truly spread through the game world conversation by conversation. For example say a king dies. That fact goes into the database and then the people near the king can spread it out. One person will tell another person until the whole city knows. Messenger birds and people can be sent to pass the fact to other cities. Traders could also spread the fact. Like a virus, the fact would spread out until almost every person knows.

For simpler facts it is just as useful. If the player sends an NPC companion off on a quest to assassinate someone, then that fact is stored in their memory. The player does not know what the NPC is up to until they learn an updated fact. If the player has no facts mentioning the NPC, then the player doesn't remember the NPC existing.

There are two unsolved problems though. The first is that this does not cover opinions and feelings towards other objects. I still need to have another data system for keeping track of who every NPC likes and dislikes. The second is that this system doesn't support lying. I might not want to support lying since that could be frustrating as a player, but at the same time it does increase the world possibilities. I think initially I will treat everyone as 100% honest. I can change this later on during development.


EDT: I think I will just use this system for likes and dislikes too. A person will remember their actions with another player so I can look through that data to generate an opinion when needed. This is the best approach because then it can work for people that have never met. Say the player does a good dead for someone. A person in another town might hear of it and offer better prices once the player gets there.

the-pi-guy

A lot of this is stuff that I've thought about too.  ::(
Someday.  

Legend

A lot of this is stuff that I've thought about too.  ::(
Someday.  
It's weird finally doing something with the forum rpg. I'm a bit nervous that this will crash and burn once I've sunk more time into it, but I'm excited to see how it turns out.

I'm not planning to have any growth mechanic with plants or nature, so I'd love to see how different your game could be!  

Legend

The core "obstruction" system is implemented and so far it seems like a good approach.



This is a snippet of code for calculating the obstruction between two objects. "Obstruction" has 4 internal values for sight, sound, smell, and touch. It is essentially a distance system that works with the game's unconventional layout and factors in the properties of materials.

I added an "isFocusedOutside" variable. Without this the obstruction between two objects was symmetrical: if you couldn't see a human, they couldn't see you under normal circumstances.

Now a sentient object can be focused on looking outside of whatever structure they are in. This could be looking outside the window of a castle or peaking out of a crate. It slightly makes the person more visible while greatly increasing their visibility of the outside world. The drawback is that it significantly decreases their visibility of things inside. For example a guard could be along a city wall looking out and wouldn't notice a thief sneaking around behind them. There will also be a slight time penalty when changing focus since it relates to physically moving too.

Legend

My AI system and my dialogue system have merged.

Since the dialogue system is so advanced and can give complex orders, every NPC just has a voice in their head looking out for them. A bear would just be a bear sitting there with no brain, but then an inner voice would say "eat when hungry." The bear from that point on will have this job and try to not starve.

This pushes the development focus from making AI to making complex verbs for the language. AI gets solved either way but this greatly increases what can be done with the language system.

Legend

Since I'm progressing with the game, I now need a progression system.

It's kinda hard since on one hand I'd like the game to be simulation focused where progress isn't a stat. Your friendships and your property are your progress.

At the same time, I'd like to let players enjoy the game like an Elder Scrolls rpg. If you want to become better than the people around you then that should be possible.

I think I'll go with an optional mechanic. You can play as a normal person, or you can be "blessed by a god." Normally stats do not change. A strong man is born with those genes and a weak man is not. Natural selection gets people where they need.

If blessed by a god however, a person has a simple xp system. Every level up they get to boost a stat. Eventually they can be a walking tank that kills dragons with ease.