I am newer to the development side of the house so please forgive my ignorance. I have searched for days to try to find an answer to my question but, I came up short. So, I decided to post here hoping to find the much needed salvation I am looking for!
I do not have any code to back up my question. It is more of a theory at this point in my development. I’ve made levels before (many years ago) and I always took the long and pain staking way to achieve my goal (because I didn’t really know/understand how to code properly). I am trying to completely change that way of thinking and actually code more and design less. So, with that said, here is my question…
Lets say I am making a game and I have a basic door (with door frame) Blueprint. I have it coded in a timeline to open when activated. All fine and good there. However, I’d like to use this Blueprint of the door for numerous purposes without making a separate blueprint for each purpose. For example:
As a locked door in hallways - For aesthetic purposes, you can’t have a hallway without any doors in it! I would like to place multiple instances of this door going down a hallway and have the door not function/open at all, but if the user were to try to open this door, they would get a sound effect of a locked door and an audio cue that says “This door is jammed and wont open.”.
As a functioning locked door in a room - There is a key in the room with this locked door that you have to locate. If you try to open the door (without the key in your inventory), you would get a sound effect of a locked door and an audio cue that says “This door is locked. Maybe there is a key around here.”. Once you find the key (it is placed in your inventory) and you are able to use the key on this locked door and gain entry and progress through the level.
As an automatically opening door - Through code and triggers, this door opens automatically once an event happens (timed event or BeginOverlap event, etc).
One main caveat to this game is that the entire level is procedurally generated.
So, with all of the above being said, is it possible to utilize one blueprint of the door to achieve all 3 functions or will I have to create 3 separate blueprints of the same door and just code each function separately on each instance of the door blueprint?
I apologize if my question doesn’t make sense. Please let me know and I will try my best to further explain it! Thank you all in advance. I’ve been creeping around the forums for a while now, and everyone really seems helpful and understanding!
You could do this with one blueprint, you would just have to have two boolean variables that would say something like:
Jammed/Unusable: locked=true, openable=false
Locked: locked=true, openable=true, and the key would change this to locked=false
Usable/Unlocked: locked=false, openable=true
This would mean they have shared behaviour. Door 1 would mentioned the “jammed” message because of the openable=false when locked=true, when the player tried to open it. Door 2 would say that the door is merely locked, because openable=true, even though locked=true. When door 2 is unlocked, it “becomes” a door 3. You could then allow the player to open door 2 and door 3 using the shared behaviour.
Thank you so much for your insight! What you say makes sense to me. I didn’t consider utilizing a BOOL for “openable” in my logic. But that does make perfect sense!
I am trying to consider different computer setups with my end product. I want to “trim the fat” (so to speak) on anything that could be done under one blueprint (in this case, a simple door). I don’t know how much having one blueprint of the door to handle all of these different processes compared to having 3 door blueprints (one for each process) would be on overall CPU/MEM/etc usage. Since the game is procedural based, I’d figure loading/setting up the level itself would be taxing enough for a PC. Plus, I want to challenge myself out of my comfort zone to learn more about development and coding.
I am definitely open to any/all suggestions though! I like to consider any possibilities before making a decision.
Thank you for your input! I like the idea of having a Door Controller BP. Another reason why I wanted to try to have the smallest amount of BPs for a singe object as possible is to be able to add/edit either the objects or the code in once place. That way everything in the level will update at once rather than having to update every item on a level individually. Almost like a CSS for a website. Many years ago when I made levels or mods for my favorite games, I would painstakingly place objects all over the level and then have to go back and edit every instance of that object because I was not savvy in the development/coding field. I was young, dumb, and would rather just jump into my creation ASAP.
I digress… In terms of bottle-necking, this project would solely be for PC. One reason I am keeping the PC specs in the front of my mind is because when I used to make levels, my PC would bog like crazy. I wouldn’t want that to happen to anyone that would play on my levels. Also, I am still learning UE; anything from the basics to the advanced. The levels I am building are on an i9/64GB RAM/2080TI. But, would my finished project play on a 10 year old i5/8GB/1060? I try to consider as many outside factors as I possibly can. Granted, I know I will not consider EVERY possibility, but if I can mitigate those negative factors in order to have a quick loading, smooth playing game, then heck yeah!
Another point I am considering is the possibility to have these doors become damaged and break. There will be an AI component to this project at some point as well. The AI will be the ones breaking down the doors.