To be honest I didn't plan a spotlight post for today, but my schedule got kinda scrambled around a bit. I literally didn't get any noteworthy progress in on the project itself, but still wanted to continue the bi-weekly posts. :D
The reason for this? On January 14th Substance announced and started their next Substance Painter contest ... and I just had to join in on the fun! #MeetMAT2 is a great chance to learn, network and generally just have fun. Definitely head over there and check out all the great WIPs on Twitter & the Substance Forums from artists around the world. :D
Trains ... yes seriously trains. As I, either said somewhere before or most of you have figured out by themself, 'Project Geneva' is basically only a train station ... and what would a train station be without trains? Ye ... kinda lame.
That's what I thought as well, so a couple of months ago, when I didn't want to model, unwrap, texture, etc... I just sat down and fiddled around with blueprints in UE4. I'm not completely new to the system, but for something that intertwined with different parts in the level it still took me a lot of trial and error.
Also ... it's probably nowhere near perfect ... please don't hang me @programmers :3
Today I'm gonna show you what this blueprint controls, how it works and what routes I chose to build it. First up here is a little .gif for you:
Train System Example [Speed: 1.5x]
What features are built in for now?
- Spawning trains on both tracks in different intervals
- 50/50 chances of them stopping or moving through
- Track display sequences for both options
- Safety LED lights on the track something's happening
- Some useless stuff, like decal colors?! ... why? don't ask me :D
The components & What's happening
So what different components / blueprints are interacting with each other? The answer is ... 6 (I think), let's see them in a list:
- Control BP - just chilling in the centre of the map - controlling everything
- Train BP - this one obviously gets spawned
- 3 different kinds of platform border modules - function to check which track they are on
- Track screen BP - basically the same functionality as the border modules
- Ceiling LED tube BP - again the same functionality
Ok ... well it's 7 different BPs communicating, but most of the communication isn't directly BP --> BP. Cause let's be honest, I'm an artist, so I'm gonna do it the 'creative' way. :D
The only really BP --> BP communication is the spawning & de spawning of the trains itself. The rest is handled via 'Material Instance Parameters', cause ... ye it's only changes in materials. The only reason stuff like the border modules, etc... are considered a BP by me, is that I needed to be able to set on which side of the platform they'll gonna be placed.
Modular border piece BP | In editor variables [Corner]
Even though this is one of the most simplest event graphs ever created in UE4, it still took me a while to figure this one out, so it would work flawlessly. And all of that, because I wanted it to be random, if the trains are stopping or moving through, in addition of them arriving in different intervals. :3
The real heart of this system is the 'Material Parameter Collection' ... you can find this one in every of the materials and the parameters are set in the big 'Control BP'. After testing a bit this was the best method I could come up with to achieve this kind of communication between assets and still have it quite easy to change stuff later on, without breaking something.
Material Parameter Collection
For an example on how I used this, here is a screenshot of the most complex material involved in this:
Static & Moving Parts Material [TOP] | Timer Material [BOT]
So now, that I briefly gone over all the different components let's jump into how it's all connected. :D
The big boi
The 'Control BP' might look a bit messy to you, but well ... I tried to build it as organized as possible. First up let's look at the whole thing, then I'm gonna break some parts down into smaller segments. Prepare for a flood of images. :DMain Control BPInfinite Looping of the SystemSimple Event Decider for 'Moving' or 'Stopping'
Event Graph for the moving train
Event Graph for the stopping train
All of those segemnt screenshots (except for the looping) are present for each track individually. There's still a lot of tweaking & polishing to be done, but for a working prototype and the state the project is in currently, it's working out fine.
That's it for the first spotlight (at least for now). Please let me know if something was written / described kinda confusing, or if you want to know a bit more details about some of the parts I've shown in here. I'm always glad to receive questions and / or feedback!
Also if there are some @programmers (or other people who are more proficient with UE4's BPs) please let me know what you would have done differently.
Hope you enjoyed it or even learned something ... even though this spotlight was kinda improvised, to not break posting schedule. :3
Cheers and have a great day / evening / night!