#how to design camera constraining for games

1 messages · Page 1 of 1 (latest)

rancid parrot
#

Let's ignore how it wold actually be coded. And just think about how it would ideally work. How does other big good 2d games deal with?

Locked track (like the camera is stuck on a 1 dimensional line and tries the best to follow)
Follow loosely and just constrained at specific walls (the same as stanncam right now, though it's hard to set up the constraints in the room editor)

Something else?
open to ideas for how to best think up this system

zealous patrol
#

There’s a lot of possible complexity to that… I think the “ideal” approach depends a lot on the type of game and the feel you’re going for

drifting scaffold
#

you've done lots of work on this problem before, why are you asking ? are you looking for novel answers you haven't already considered ?

rancid parrot
jade cedar
#

I have linked this same article to stann like 3 times lol

rancid parrot
#

i've read it, and forgot about it since, (the ideas about constraining to/following the player i used and i dont want to change) But i guess i should explain what im pondering more clearly. The example of vessel and limbo in the article i guess is closer to what im trying to solve

#

like constraining the camera to zones

#

i recenetly started on an early blockout of a level, and im wondering how i could make the tools to constrain the camera as easy to use as possible. whilst it still looks good

#

here's a section of a level, and the red might be where i'd want the camera to roughly be restricted to

#

the question is first.
what would be the most intuitive/easy system to place these borders, maybe paths could be used, but myself and others do not like working with them. Maybe a bunch of zone puzzle-pieces. I kinda already do that, but they have their own kind of shortcomings, in that they only constrain edges when you're inside the boundary of that particular zone, so tight corners are difficult. Also it doesn't do slopes

Second question for me is.
I right now constrain the camera based on the cameras edges. But take that narrow hallway where the green square is. If constrained hallway is narrower than the dimensions of the camera, it would be nice if it constrains to be smack dab in the middle of it. Like a perfect horizontal track.

But transitioning from a perfect railroad into a more open area, i do not know how to approach right now

#

this is the current system

#

each "zone" has some borders, that are marked with a stronger pink. so like the zone with penguwatching in it, is constrained on top and bottom, making camera be in the middle.
But it is only active as long as penguwatching is actually inside it. that works for the most parts, but there's some instances where you want more zones to be connected. There i've set it so you can add the names of other zones to the instance variables and then they're connected

#

i don't think it's a bad system, i just wonder if it could be better

#

also this is a way tighter more complicated sections, where there's a chance that zones can overlap, in which case the best solution i can think of right now may be to disable/reenable zones with triggers, but that's kind of annoying

jade cedar
#

Simpsons meme:
So you want arbitrary polygon, want them visually intuitive, and you want them to be editable in the room editor.
But also you don't want to use paths.

rancid parrot
#

like if we just imagined that sure i make a system where you place paths, how the camera can transition from an open space to a narrow space i don't know

#

like check this, right square, it is being constrained to the left wall,

the left square it is constrained to be inbetween.

If the system constrains stuff at the edges, then how would it be able to enter into that narrow space?

#

the system i have now, where it's only constraining once you're inside a zone kind of solves that problem i guess, but also looks a bit messy sometimes, so yeah

#

maybe if it wasn't the actual camera bounds that got constrained, but just the cameras center it could maybe work

#

but then also it means it would be a little less intuitive to place the constraining "paths" down

drifting scaffold
#

you have two area types, corridors and rooms, with different constraints. you need to evaluate them as such and then handle the transitions. how your editor works is a second order problem. you can either pass over raw geometry and add markers internally, which will be unintuitive and you will struggle against while editing, or you can just make a "rooms and corridors" editor

#

surely you already have some sort of nodes and paths thing for constraining the camera ? use that where you need it, in your example, the corridors. the sensible answer for a 2d game is to couple camera area to character collision, fill the level art in, and let the camera see what it sees (with the rare exception of scripted sequences where different constraints are necessary for real reasons rather than imaginary ones) so you don't have to define what are essentially the same boundaries twice for no real reason

rancid parrot
#

I dont have a node or paths thing right now. The zones things i shared is all, where once inside any one zone the camera gets constrained against the highlighted edges on that zone.

Or in the middle if the zone boundary is smaller than the camera boundary.

Without any zones, the camera already follows player of course, like the examples on the article, theres a tiny box around the player and the camera moves when player leaves it.

That on its own is not enough because the camera will then often be looking mostly at the floor