How do I center the camera on the player's view


#1

I’m trying to figure out, for future reference (next game, probably), how to do a FPS game. For that, obviously, the camera needs to see what the player would see, not the player itself. I thought I’d found the answer yesterday, but when I tried it in an example game, the game itself stopped working (the movement keys didn’t work anymore—just one static position).

I created an invisible object called camobject (and a png called campoint.png for camobject). I added a point between the player’s eyes called CamPoint and linked the X and Y positions of camobject to CamPoint’s X and Y positions, respectively, and then did the same, positioning the camera at camobject. I definitely changed the view, but didn’t get the view from the player’s perspective when the demo is played with the camera in the normal position (I was seeing the wrong area).

I thought that, plus a post here that I saw yesterday, was the answer. Apparently not. So how would I do this? Thanks.


#2

A point between the player’s eyes? In FPS, you don’t see the player, only his hands/guns, so why do you need a player?
A screenshot would be helpful.

If you want the camera to follow the mouse like in a FPS:
image


#3

So the camera follows the mouse in a FPS? I’ve seen about 50/50 for mouse vs wasd on the keyboard for “player” movement. Oh, and the reason I started with a player is just for the test. That, plus when I thought, since my graphics card supports GLES2, I could also use Godot 3, a tutorial for doing a FPS in it, and improving the camera movement, used a transparent oval thing as a player to attach a camera to. I plan, when I finish my current project (Asteroids Mk II), to re-watch it if, for no other reason, the great way it handled steps and climbing a ladder (to adapt to using in GD5). Thanks.


#4

Well, keep in mind that if you mean an actual First Person Shooter, as in full 360 movement and 3D environments, GDevelop 5 has no support for 3D, so you won’t be able to do that.

If you mean a FPS as in more like a lightgun game moving on a 2D plane, then you can do that with Gdevelop and yes, Gruk is right and you’d want to follow the mouse.

Most modern FPS cameras follow the player mouse. WASD just controls physical movement, including some turning. The only time that isn’t true is non-standard controlling FPS, like the old Metroid Prime games.


#5

Ok, I must admit, I’m not an expert (not even close) on a lot of this. Most of my game experience is from my high school bowling league days, back in the early '80s, spending tons of quarters every Saturday morning…Asteroids, Space Invaders, and more like that in the actual big video game boxes at 1000 Oaks Bowl in NE San Antonio (and at arcades, etc.). Oh, and one FPS, Quake 3, if I remember correctly. And then there’s Harpoon, by Larry Bond, but that’s actually a naval combat simulation (as close to classified as you can get without a clearance, and there is a classified, Secret//Noforn, I think, version that the US Navy uses for training, etc.). I’m learning about the various types of games as I go (playing, tutorials, reading stuff like “what makes a great rpg” etc). I know it isn’t the most ideal spot to be in, but cancer #1 forcibly retired me and dumped me into Social so-called Security Disability, which is horrible, and once I found GD5 (and, when/if I’m able to upgrade to a newer computer, Godot 3, too). Put simply, even a small amount of money from games would be a huge boost to my budget (to quote Geddy Lee on a Bob & Doug Mckenzie skit from long ago, “Hey, 10 bucks is 10 bucks.”)

So what, exactly, is a lightgun game moving on a 2D plane? And how would I proceed with that, and do you know of any YouTube tutorials (no music video tutorials, please, and only ones where the narrator isn’t swallowing the microphone—sadly, I’m not able to get anything at all from those, probably due to the three tumors that were in my brain—2nd met, cancer #1 in 2006–7). Thanks.


#6

TLDR I talk about lightgun games. Next paragraph has actual coding info
While I’ve only played clones of it(second picture), Virtua Cop (1994) fits into the “lightgun game” category (“light gun” refers to the prop you use to aim/shoot in the arcade game).
image
But it’s in 3D, so in 2D, the gun moves a bit relative to the mouse/crosshair.
the backgrounds aren’t as elaborate due to the amount of work involved. You can imagine the “scene switches” in Virtua Cop to be simplified with fade-outs instead of moving around in real-time, or just take place within one shooting range scene (comparable to carnival shoot-out games).
Here’s a video that showcases “lightgun game moving on a 2D plane” in a simple game.
The link should start you at the shootout scene.
image

But, to actually say something on topic:
Yes, GDevelop 5 doesn’t have 3D feature yet, so you won’t be recreating Quake 3 or Virtua Cop in it for the moment.
You might be able to achieve something closer to this, where the background creates an illusion of depth and the camera moving according to the mouse. Is this how it would look like?
image


Knowing what type of games you want to achieve would really help.

#7

Thanks. Lots of great information there. I am still learning, and still finishing my first game (thanks to the aftermath of cancer #1, and low energy levels common to cancer survivors in general, I can’t work on the same schedule as normal people, so it takes me longer). So right now, I’m just tossing ideas around in my head for what’s next, and at the same time, trying to learn more about different types of games and gamedev in general and specific to GD5. :slight_smile: When I finish Asteroids Mk II, I’ll dive into #2 which, by then, will be a specific type of game that I can do with GD5. I WAS going to look at the blender game engine (still exists in the highest version I can run, 2.79). Odd thing, blender 2.79 works with my old computer’s graphics card’s GLES2 … but Godot 3 doesn’t. But unlike Godot 3, which after I found a YouTube tutorial that didn’t fly through stuff a light speed, didn’t seem that much more complicated than GD5, the blender game engine, from the tutorials I saw, seems like a really tough one to learn. So right now, it’s either 2D or isometric.

So, any suggestions on games a newbie gamedev can make with GD5 that have a decent chance of making money (even an average of $10/day would be nice, more than that would be a big or maybe huge bonus)? Thanks

PS: the (then 11 month old) cat in my avatar pic is my (as of 6Feb20, 18 month old) Maine Coon, Jinx. He seems to be getting bigger every day. :slight_smile:


#8

I’ll assume your Asteroids Mk. II is the game in question for this topic, and it’s first person.
To start, a screenshot(s) of your events sheet will be a great help. Currently I (and the others) are just assuming everything, so if I know what’s in your code help will be much faster and accurate.
From said assumption (and your initial post), making sure: you are using CamPoint.X() and CamPoint.Y() to follow the X and Y coordinates of camobject? That should be correct, if you apply the same principle from that example game.
I don’t see you mentioning using a “Center camera on object” event, which could be your issue. Here’s an example camera code screenshot:


The bottom event is where the game’s camera actually centers itself (the blue text “camera” is an object with invisible sprite), and above it is the calculation. It’s a top-down game, though.
So, yes, send a screenshot of what your events are, like the above picture, It’s much easier to understand and help your project that way.

TLDR below is offtopic?

Quite the story there!
However, I have to burst some bubbles, the biggest one first:
It takes grit, time, and persistence to make a game that sells enough to pay your bills ($10 DAILY is really awesome…). It might also take months, maybe a year or two, to make a game of that quality.
Not intending to discourage - but what I mean is, making games don’t immediately bring income, most of it depends on your idea, and how well you keep telling about it to the world as you develop said idea (interacting with communities on social media), among other factors.
If you can live with that, and still want to make games, then…

I don’t have any winning game-ideas (the one I have is too broad it may not ever get completed), so the best I can do is give you some pointers. Most independent/indie studios or one-person developers make it big by making a unique game that does its own niche (specific genre) so well that the people otherwise uninterested by normal games decide to buy it - in salesman talk, an “untapped market”. (The other part about making people aware you and your game-in-development exists is important because today, there are so many games it’d be nigh impossible to really get meaningful results by simply listing it on a digital store like Steam.

On a serious note, I feel this topic / category of the forum isn’t the place to discuss the other stuff you’re bringing in to the table here, so you can consider making a topic in the Community section since they’re pretty discussable broad topics. Otherwise if you just want to talk, just hit me up with a private message (you can ask for my other social website handles there as well).

PS: Your cat is fluffy and chonky, yet so classy. amazing (but I will not say more of him than that)


#9

First, no, the FPS question was for future reference, not Asteroids Mk II. And I’m not good at marketing at all (engineering degree, not related to business), so it sounds like I may not have much of a chance, after all. :frowning: And finally, what you’re seeing on Jinx that looks chunky is his mane. It’s going to get much longer as he grows up over the next four years or so. I’ll probably keep trying with games, if only just for fun. And who knows, from what I read, the guy that did Flappy Duck basically just got lucky (and the article said it wasn’t even a very good game). It’s a billion to one long shot, but as long as I’m not wasting my money on it, one never knows where/how the cards will fall.

Thanks,
Jim