Download

Klonoa/Pandemonium like path and camera

Hi everyone!

I’m planning to make a platformer game like Klonoa or Pandemonium. On these games, the player follow a path instead of moving back/forward on same axis. The camera follow the player giving the impression that you are moving just back and forward.
Does anyone know if there is some example code for achieving this?

Sometime ago, I was developing my own engine, and I achieved this using complex algorithms for managing catmul-rom splines. I was using a spline for character path and another one for camera path. It is working with a few bugs, but is working. Now I’m moving to UE4 'cause I can’t waste more time developing an engine that will take years to be as good as UE4. My engine was written all in c++ and manages a lot of graphics effects, basic physics, animations, etc, but nothing compared to UE4. Anyway, what I’m trying to say is, I’m new to UE4, but not that new to game programming.

Thanks for your time!

Anyone?

Someone made it with Unit3D: http://forum.unity3d.com/threads/klonoa-or-pandemonium-game-camera-like-path-camera-for-2-5d-platformer.168449/
But I really liked UE4.

Pointing me to a direction will help a lot.

Thanks!

just watched a video to understand what you mean. It definitely looks like there is an extra path for the camera to follow on each level, while it is still rotated into the direction of the player camera and controlled by the players position on the z-axis (elevation).

So either you need a path for the camera to follow, probably nothing out of the box will achieve directly what you want, but take a look at matinee?
Or you need a “free” camera that follows the character while there are areas in the level that block the cameras movement.
Both would probably result in something that looks like Pandemonium, but how they did it, we don’t know, right?

So, why not try to get your old code working as a plugin?

Hi Jeffmeow,

Check out the new spline component in 4.3. You should be able to create a Blueprint containing one along with a camera component and place it in the level. Use the spline to edit the basic camera path, and position the camera component on the closest point on the spline to the player. You ought to be able to do stuff like offset relative to the camera spline based on the player’s relative height, etc… too (so it follows them up when they jump or fall).

Cheers,
Michael Noland

Thanks for helping, alfalfasprossen!

I was reading about matinee, it seems very nice. I don’t know yet if it is possible to use it to move the camera as the player moves through the level, 'cause everything I’m reading points me to understand that it could be used to make cutscenes. I’m still reading everything I can to find out.

I need to learn how to override camera movement with cpp code, then I could use all my spline based algorithms.

I made a **** video with my cellphone showing the path following of my engine. Take a look:

Thanks!

Hi Michael Noland!

I was just updating to the new 4.3 version. When I was reading about its new features, the splines took my attention! Tomorrow I’ll try to understand how it works and see how I can put everything together.

“Unreal Engine Developer”, eh! Congratulations for your job! You make part of the team that make the dreams possible! :wink:

Thanks!

Hey Jeff / Michael

If either of you guys have some ideas along these lines then I’d appreciate it if you could have a look at my thread here and let me know - Seeking guidance for movement system (spline locked, side on, free "flight") - Blueprint Visual Scripting - Unreal Engine Forums

Thanks :slight_smile:

Sure, Monophobe! It would be very nice if we can help each other.

Thanks!

Michael,

How can I edit the basic camera path? I created a spline component and a camera in a blueprint actor, but I couldn’t find any options to set the spline for the movement.

Thanks!

Reposition the camera component to somewhere on the spline each tick. The basic spline component just provides data, it doesn’t have built-in functionality for positioning other things along it, but you can get the location at a specific ‘time’ along the spline and the tangent at that point.

Cheers,
Michael Noland

Hey Jeoff,

I’ve made quite a lot of progress on my project with this. My “character” (still just a static mesh) moves locked along the spline with free vertical movement, turns with it (as does the camera) and also points in the direction of ‘flight’.

Lots of that won’t be necessary if you’re having a ground based character or you’re only bothered about the camera sitting on the spline but when I get chance (at work atm) I’ll post up my setup for the initial spline derived world position - very much as Michael has suggested. You should be good to move on from there.

Monphobe,

It will be a great help! I can’t get to make my mesh move based on control input. It is working with values updated from a timeline.

Thanks!

No problem. I’m just writing up a tutorial now (it’s all blueprints but the same principles will apply if you’re coding it) and will add a link here when I’m done.

Hope this helps Jeff. Taken all night but feel like it should help a few people out - Tutorial: Blueprint Spline locked sidescroller (e.g. Klonoa / Pandemonium style game) - Community Content, Tools and Tutorials - Unreal Engine Forums

WTF!! This is really awesome!!! Thank you so much!

I think I found a way for that problem with character speed. I’m multiplying Max Speed with axis input value, and then, multiplying with delta seconds. This give me the amount the character need to move based on FPS and analog control pressure. As soon as I implement the jumping part, I’ll post it here.

As for the whole thing, I was trying a similar approach, where I was using “Add Movement Input” function instead of “Set World Location”. The character moved using “Spline World Direction at Distance” and it almost work. And I say “almost” cause is hard to maintain the character locked to the spline (as I’m just using it to give direction to the character), after a few movements, the character position don’t match spline position. Anyway, your solution is really better, cause character is realy locked on the spline. I think there is a way to make the character hit the floor only using physics. I’ll try something and post later.

Monophobe, you’re the best! Thanks!

You’re very welcome :slight_smile: and make sure you post up any progress.

I’ve yet to get collisions working in my project as the spline distance is always added to (or taken away from) which means if you hit an object, you will stop, but once the distance is great enough that you would be at the other side of the object, the character snaps through to the other side and the physics goes haywire sending you spinning across the level when there is no input, and snapping back to the spline when there is.

If you do get it working then please let me know, cheers :slight_smile:
(if you can post any solutions in that tutorial thread to help flesh it out further, that would be great)

Hi Monophobe!

You can make the character hit the ground just with default gravity. You only need to break the result of “Get World Location at Distance Along Spline” into three floats, then you get only “X” and “Y” to create a new Vector. But you will still need the “Z” and you will get it from the “Get World Location” from the “Capsule Component”. Use this new Vector to feed the “Set World Location” or “Set Actor Location” (this don’t need to get the “Capsule Component”). Take a look:

You will need to break your rotation as well, and use only the “Yaw” component:

You can use the default function for jumping, like this:

ec0a34f564ac71caabe6bbab17620c258d8f098d.jpeg

To control the character speed, you will need to get “Delta Seconds”, multiply by “Max Speed” and “Axis Value”:

This is the whole thing I did:

Now I’m trying to figure out how to lock the camera on the character side.

Cheers!

I did it!! And it works very nice!

This is the result:

Special thanks to Monophobe and Michael Noland!

Thanks for everyone!

Hey Jeff,

Only just seen that video. Good stuff :slight_smile: I’m still fighting a few collision issues myself but almost nailed things (basically an issue where the distance you’ve travelled along the spline will still update and let you fight your way around objects). Just wondered if this was something you’d continued with?

Ive been trying to follow the other tutorial and yours, but you got components in your BluePrint i just cant find, or see how to create. Could you create a fast video just running through the blueprint? I realy wanna use this in one of my levels.