MonoGame.Extended icon indicating copy to clipboard operation
MonoGame.Extended copied to clipboard

[Camera] Camera improvement ideas

Open craftworkgames opened this issue 5 years ago • 3 comments

One of the things I'd like to do before the next release is to make some improvements to the camera system in Extended.

I always found this article about camera systems quite interesting. Maybe we could implement some of this stuff into our cameras.

https://gamasutra.com/blogs/ItayKeren/20150511/243083/Scroll_Back_The_Theory_and_Practice_of_Cameras_in_SideScrollers.php

craftworkgames avatar Oct 20 '18 03:10 craftworkgames

There are quite a few features in there I would love for us to add, but I was getting overwhelmed just looking at all the different options in that article. Do you have a checklist for the different movement types you feel we could implement? Any we should try to tackle first? Since I'm quite terrible at making demos, are there any which our current demos could utilize? If I have a thing to play with, I can usually get something to work somehow. haha

stefanrbk avatar Nov 05 '18 23:11 stefanrbk

Personally, the main thing I would change for the camera is to have 3 cameras. The target camera, the in-between camera and the view camera. We can come up with better names.

This setup is nice for interpolation.

  • The view camera is what the game shows. It first copies the values from the in-between camera. After that effects can be applies to it.
  • The in-between camera tries to interpolate to match the target camera's values.
  • The target camera is where the camera should be. It can teleport around, zoom, etc.

With this setup, you can control the target camera to move around the game world and the view camera will interpolate nicely towards it. You can have interpolation functions for each value that a camera can have, such as the position, origin, zoom, rotation.

Apostolique avatar Nov 06 '18 08:11 Apostolique

There are 2 main reasons I raised this issue.

First, it's simply a reminder that of something I'd like to look into at some point. At this stage the exact details of how things should be implemented are undecided.

Second, having an issue is a great place to discuss the different ideas. I think it's great that you guys have started to think about how things might work.

Most importantly, I don't think we should just jump into writing code and adding these features. Like most things there's likely going to be dozens of approaches to the problem. Each of them with their own merits and pitfalls.

For example, off the top of my head maybe rather than making changes to the existing camera classes we could introduce the concept of a CameraController and have different implementations of that. Or alternately, we might have a set of CameraStrategy classes. Honestly, I haven't put much thought into it yet.

That said, if you guys do have some ideas it's often useful to create a fork or a branch and play around to see what works and what doesn't.

craftworkgames avatar Nov 06 '18 10:11 craftworkgames