During my childhood, me and a few friends of mine used to play a PlayStation 1 game called Team Buddies quite a lot. So I’ve decided to do a fun little project and try to re-create this in UE4 to sharpen my skills a bit since I’ve been away for some time.
So far things have been coming along pretty nicely, and I’m working on the platform at which players will drop boxes in certain shapes in order to build certain things. See this video for a showcase on how it worked in the original.
So I’ve been working a bit at this, and I think I’ve come up with a solution - though, it’s a rather crude one and I believe it will become very messy. So before taking this further, I’d like to see if you guys got any ideas for a better approach.
So here I have 8 smaller collision boxes and 4 larger ones covering the entire platform. The way it currently works is like this;
The large collision boxes will detect if the player drops a box within.
Each large box covers up 2 smaller ones.
For example, if a box is dropped in the large box to the far left of the picture, it will check if the bottom small box is occupied - if true, it will put it in the box above. If both are occupied, it should move to one of the adjacent corners*(only implemented this for one side thus far)*.
It’s quite the noodle soup just to do it for one corner. Is this a good way of doing this, or should I look at doing is in some other way?
Thanks in advance!
What if you have an array that represents your cube in the image. When a box is dropped use the collision to find an array index. If this index is occupied then it will be easy to search through the array to find an open spot. There are various methods to map from array back to the cube location. It can be done by program means or you could have a second array that holds the locations in the cube. Or you could use a single array of struct…
Aye, I’ve tried using an array of booleans and then add boxes accordingly. Thing is, I need to change the shape of the boxes when they’re placed in a specific order. See this image for an example;
Left-To-Right (Single, QuarterVertical, QuarterFlat, HalfVertical, HalfFlat, Full)
I made some progress using enums, however, doing this to support all various setups would become an utter headache. I was hoping there was a better - more automatic way of doing it. But I’m starting to think this is as close as I’ll get to it being automatic.
I’ve changed my method from the OP. I now have 4 child actors, one for each spot on the platform and I update those instead. I’ve also tried just using one actor as a whole, with the boolean array I mentioned above.
The complications are because I should be able to continue building and break boxes separately. For example, if I have one HalfVertical(2x2) and one Single(1x1) next to it - I should be able to break those separately.
I recorded a video of my progress thus far if that’s of any help.
Updated video of most recent progress, still buggy and unsure about this approach.