Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Reverse engineering game projectile trajectories in c++ how to learn and key words to search? Any help would be lovely!
Post Flair (click to view more posts with a particular flair)
Post Body

I am fairly competent at using c to control hardware such as Atmega chips esp32 etc.

So I wanted to have a go at a simple bit of software as a challenge because I've found thats how I learn best.

I picked something very simple I was familiar with, a basic 2d artillery game. I then set about plotting sample shots to hopefully gain insight on what was going on, after getting some data points I tried to predict where the shots would land; some small successes but not entirely accurate.

The program is as simple as it gets as of now: Just a console app, you right click firing position, right click the target, then it displays vertical and horizontal distances in pixels, then click 'o' to simulate a mouse click for the calculated duration for the power such that at a 45 degree angle the target is hit

As the shots move further away from the player they no longer fall off in a linear fashion but do so exponentially (I think) as you'd expect.

Height difference is also a factor, for example if you are higher than your target assuming 45 degree shooting angle you'll have to use less power by an amount.

I was just wondering the best method and by which means you'd try figuring this out, at the moment I've just got a huge amount of if statements which are essentially just recorded sample shots instead of an actual equation that describes the trajectory itself.

I suspect it is my weakathmatical skills holding me back here.

So my questions:

  • How might I come to an equation that describes the trajectory?

  • Is just tagging on a modifier to the firing solution based on pixel height difference between shooter and target sufficient?

Thanks for any useful answers! :)

Author
Account Strength
60%
Account Age
1 year
Verified Email
No
Verified Flair
No
Total Karma
10,892
Link Karma
396
Comment Karma
10,496
Profile updated: 2 days ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 months ago