• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] An efficient way of city life

Status
Not open for further replies.
Level 19
Joined
Apr 21, 2013
Messages
1,194
I want the villagers in my city have dynamic lives(at least an image of it).

During day time, villagers will work/wander/chat/shop etc.

During night, some will go into their houses while some go to the tavern for some fun

After 12:00 am everybody(except some special npcs) will go into their houses.

So I can pick all units in the village matching some conditions and send them randomly to some points but this would cause leaks all over the place for each villager. But I don't want to create one point variable for each villager to keep track of them. So what would be the most efficient way to send all to some points and removing the points. If I remove the points before a villager reaches that point, does that villager still move there or not?
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
for my harvest moon game, I made a huge system, that assigns preset tasks to units in response to certain situation. I think it works quite well despite some minor flaws.

It works something like this:

Preset tasks in a hashtable with the unit as parent key
define all reactions to certain weather conditions or whatever, that may influence that task. Define, what to do in that hashtable.
However, it is quite generic, so it will be something like if weather == bad, go to save rect and if hide, go to home and hide, etc.

then there is a business count and a range detection system, that enables npcs to talk to each other and assign time for their tasks.

The next task will always run when the unit reached its last target destination and business count is off.

I may post the code if you are interested. I cannot access it at the moment but hopefully soon.
 
Level 19
Joined
Apr 21, 2013
Messages
1,194
Inside the unit group, create a temp point, order the unit to move to that point. Remove the location.

Removing the point prior to the unit reaching the destination is not a problem.

Nice this is good to know thanks mate ^^

for my harvest moon game, I made a huge system, that assigns preset tasks to units in response to certain situation. I think it works quite well despite some minor flaws.

It works something like this:

Preset tasks in a hashtable with the unit as parent key
define all reactions to certain weather conditions or whatever, that may influence that task. Define, what to do in that hashtable.
However, it is quite generic, so it will be something like if weather == bad, go to save rect and if hide, go to home and hide, etc.

then there is a business count and a range detection system, that enables npcs to talk to each other and assign time for their tasks.

The next task will always run when the unit reached its last target destination and business count is off.

I may post the code if you are interested. I cannot access it at the moment but hopefully soon.

Awesome man!! I could use some of it :D :p I'd be glad to get some and not write a system from scratch and what I need isn't as complicated as yours anyways. Just some basic stuff for the villagers to do during the day. Maybe I'll add more things but this is just to show that there is some life in the village :p
 
Status
Not open for further replies.
Top