lucastle6969 / comp371

repository for comp371 final project Fall 2017 Concordia
0 stars 0 forks source link

Terrain #107

Closed benwiley4000 closed 6 years ago

benwiley4000 commented 6 years ago

A bit late, but better late than never?

Closes #22. Closes #25. Closes #113.

screen shot 2017-12-02 at 10 23 43 pm

We've now got rolling hills. The player and other objects get placed appropriately on the surface of the terrain, and the player follows the terrain as they move.

The terrain heightmap is generated via Perlin Noise, which I used a small library for.

Note that I renamed TreeC to TreeCluster and did a bit of refactoring (I made everything non-static static, since it's basically just a namespace, and moved most of the transformation logic into WorldTile, similarly to other objects). Some of this was necessary for terrain-wise placement but the rest was just to make the class easier to reason about while I was doing that.

A handful of remaining issues I want to solve before merging:

lucastle6969 commented 6 years ago

I saw your video on facebook . . looking good. I'm busy with another assignment until Monday . I'll take a look after that

benwiley4000 commented 6 years ago

probably won't be done until at least then, anyway 😄

benwiley4000 commented 6 years ago

Most of the important points are now dealt with but I still don't have collision knockback following the terrain. I might re-write how collision knockback works - I think Kai's solution was amazing as a last-minute push but it's a bit difficult to work with for what I'm doing now.

benwiley4000 commented 6 years ago

Also note I updated the Text and Rock classes to center their vertices around the model origin (rather than pushed to one side of the x or z axis). This helps with a couple of things:

  1. Rocks no longer hover above hillsides because of the anchor point being all the way at the end
  2. Seed position notices can be centered above the actual position, and are unlikely to be clipped by an adjacent hillside.
benwiley4000 commented 6 years ago

Ready for review

benwiley4000 commented 6 years ago

Feel free to merge when ready

benwiley4000 commented 6 years ago

Does it seem more painfully slow than before?

If not I might want to merge now and next work on performance improvements. I have some leads.

benwiley4000 commented 6 years ago

Did you check out the changes I made to the Rock and Text for centering the vertices?

benwiley4000 commented 6 years ago

@lucastle6969 do you want to try running this again? I haven't done much that I know of to fix runtime performance but the time it takes to generate new trees should be way way lower than before.

benwiley4000 commented 6 years ago

I'm gonna do some more optimizations later when I have time

benwiley4000 commented 6 years ago

Sorry this PR has become so huge. On the upside, I've merged in my work on water, and I also made some pretty dramatic performance improvements. There's still work that could be done but I think I've eliminated most of the CPU-side bottlenecks (besides the long tile loading times which I think can wait to be fixed with #70, although I did make tile loads faster).

@lucastle6969 could you check this out and try it on your machine? I'd like to know if it's still unplayable.

benwiley4000 commented 6 years ago

yayyyyy!!!