Download

Building an Animal Crossing like system in Unreal 4 using Blueprints

Hey guys!

I want to prototype some game ideas and I’d like to know what would be the best way to go about this. I’m not looking for specific code, but more of a high level overview on how to approach this. I want to build this as modular and as efficient as possible, this way I can build upon this core system and just add events as I go.

Basically what I want to do is:
-Have an internal “time” in the game that’s always ticking. This isn’t the computer clock, but an arbitrary time scale.
-Events happen at specific times. Example, if it’s 6pm in the game an NPC goes home or something. How often NPCs or objects check what time it is to behave accordingly?
-Turn on some lights at 8 pm.
-Have different days and different events happening on each one. For example, if it’s day 1 an NPC says X, if it’s day 2 an NPC says Y, etc…

I have a vague idea of how to make those things but my biggest question is: this timer also has to carry over when you load multiple levels, so I guess that instead of saving every NPC and objects states, I could just “rebuild” their states every time the map is loaded. I guess this would be safer and keep the environment more controlled?

Any thoughts and advice would be highly appreciated :slight_smile:

Thanks!
Thiago

You want to use the system time as a base. Create your in game clock based on the system clock, then when you do a save game you save the time with it and if you want events to happen/have happened while the game is shut down then you step through the time up until the current new system time. Eg. they were playing at 6am, saved and quit, came back at 6pm you would load up the game and set the new game time to 6pm and fast forward through all the events that would have happened in between.

To get the NPC’s to do specific things at a specific time you would just setup in their behavior tree to get the current time and go to different branches of your behavior tree.

Use either your Level Blueprint or create a Blueprint actor that will trigger events at certain times…So only 1 Actor is checking the time and just letting the other actors know what time it is…It’ll dispatch it’s 6pm or something to All actors of Class (whatever you choose) and they will do whatever you have assigned for them at 6pm… Likely a switch by int…in the do something at xO’Clock function that you set up…I’ve been watching someone play Animal Crossing for 2-3 months now and I’ve basically recreated the game in my head with Blueprints… so if you need any specifics or run into questions let me know…I know Animal Crossing and I know Blueprints so I could be of some help…besides it’d be fun to get some of this stuff out of my head…I think it’d only take me a day to get a prototype of that game running so I’m very interested in how this project turns out…Good luck and make sure to keep us updated…

Thanks Zoltan!

Hey man, this is exactly what I was looking for, thanks a bunch! That sounds much cheaper than what I had in mind. I’ll be prototyping some stuff soon and update this thread when I can get it to work.

Yep there is nothing too complex about firing off the events when something happens. It is just instead of pressing a button or hitting a trigger volume you check the time and fire the events off then.

When you get to this level of enlightenment… one day I hope to be there as well.

Sorry for the thread resurrection. I’m looking to create something akin to the playstyle of animal crossing (albeit with more procedural elements) and was wondering about how to go about creating AI like this. I’ve added you as a contact, President. I’d love to talk with you about this if you’re interested.

AI isn’t too complicated (luckily) in a game like this so I’d just create 10 (or so) tasks the Villagers would do. Pick a random Int and switch by Int to pick one of the random 10 tasks for the villager to do. All of this in a parent script and you can always override a function in the child script so say one of the random tasks is fishing but you don’t want the Walrus Villager to fish in his child script just random int one of the other options instead. “Ai move to” will work for most movement on them and when they reach their goal pick a random length they’ll do it for…Your World Clock Blueprint will tell them when the hour has changed and they’ll pick a random minute to stop from there (so that not everything changes exactly on the hour)…
Collision around the characters should be on to trigger the talk to me prompt when it collides with the collision on the player (or maybe just the “square” in front of the player)…lots of customizing really to your liking…