/Yo, hello, before we started i very sorry for my language, english is not my native language./
For a month I decided that I wanted to make my own indie game using blueprints. It’s all in the planning stage right now. I really want the game to be with a minimum of bugs and with good optimization. The game will be a simple but complete project, that’s my goal.
Actually, I have a question how to optimize something. I have a slightly unusual camera and I need help. Below I will tell my plan with screenshots and video.
- There will be corridor locations for the main story, with dead ends for side quests or secrets. The player observes the character from points in space prepared by me. That is, the player does not control the camera. An example is Resident Evil 2, but adjusted for the fact that the camera rotates towards the player. An example is Dino Crisis.
- As the player moves around the location, the camera continues to change rotation, watching the player’s character, but also changes its position in space, according to pre-prepared points. In RE2, the camera jumped sharply, and I want it to smoothly move from place to place (I want to prepare a camera route in advance).
- How I implemented it:
There is a camera blueprint, it has two custom events (both are on EventTick):
- Move the camera if its current location does not match the one I send to it.
- Constantly rotate the camera so that it follows the player.
There is a level blueprint, it has a function, with an input parameter of type “Actor”. When I need to change the location of the camera, I call this function, overwriting the actor that is currently in it. The function takes the location of this actor and overwrites the “new coordinates” variable of the camera blueprint. When the variable “new coordinates” get another value, the camera starts moving to the new location.
A function that sends new coordinates to the camera through an actor (which I send to this function):
At the moment, this is all implemented in a crutch (poorly optimized): when the player passes the trigger box, EventBeginOverlap calls a function, that writes a empty actor and passes its coordinates(location) to the camera blueprint. After this camera starts moving to new location (the same location as that new empty object):
- What kind of help I’m asking for: I’m ready to set all emptyes in order to choose in advance from what angles the player will observe his character. But now this is implemented through trigger boxes, and for each change in the camera location, I need to create an event in the level blueprint that calls a function that changes the camera coordinates. In total in finished game there will be some insane amount of emptyes (i need then send their location to camera) and triggerboxes needed just to change camera coordinates. Can this be optimized somehow? I’m new to UE, and don’t know what tricks can be made with blueprints.
Is it possible to make the camera idontknow do get all actors of class (Empty), find out by itself which of the Empty is closest to it, and take its location? Or, for example, can I make a vector array, fill it with the coordinates of the observation points, so that the camera would take this array, compare the values in it with the current camera location, and move to the nearest point found in this array?
Of all the games I’ve played, the best camera implementation was in The Last Campfire. I really want to do something similar, without resorting to an insane amount of trigger boxes and emptyes if possible.
Below I am attaching links to a small piece of Last Campfire gameplay. and a link of video of my implementation.
The Last Campfire:
I would be grateful for any ideas how to optimize this whole process. Please help the newbie make a good, playable game, not a buggy crutch craft (we all started with this, right?)