konstructs / client

A voxel based game client.
http://www.konstructs.org
MIT License
48 stars 8 forks source link

Fixes for MSVC compile and issues while running #199

Closed caseymcc closed 7 years ago

caseymcc commented 7 years ago

Changes to cmake to compile on windows, then some error checking functionality as the chucks are empty on start.

nsg commented 7 years ago

Thank you for the PR, I like the CMake changes.

I have successfully build the project under windows with CMake and VS a while ago, then of course we do not test every master commit against windows so it's possible that master is broken atm.

From what I can see you have added plenty of checks in compute_chunk for not yet loaded chunks, I assume you had a crash? When did that happen, directly or when you tried to move? (there is a known bug that crashes the client if you tries to jump inside a unloaded chunk).

I prefer to find and fix the reason behind the crash instead of just adding a lot of checks and return dummy data (return shared_ptr<ChunkModelResult>(); and return{0, 0};).

I can help you track the problem down if you like.

caseymcc commented 7 years ago

As soon as the client connected to the server it began crashing. From the short time I played with it, it seems it was trying to render before the server had passed down the chunks to the client. Basically everything was empty and the code was assuming something would already be there.

After looking through the chunking code more I don't think it would be worth hunting down the issues. I am going to try on the side to build a new chunking library, when I complete it I will look into inserting it if you all want. I will create a pull request for just the cmake changes and a separate commit on my tree for the checks in the chunk (as I can't run with out them).

petterarvidsson commented 7 years ago

:+1: on the cmake changes in its own PR. Feel free to also include the use of vector instead of malloc in compute_chunk. (the function was inherited from the C-client).

For the crashes, I think the functions in world.ccp could be updated to return solid chunks when a chunk is missing, like what is done here: https://github.com/konstructs/client/blob/master/lib/src/chunk_factory.cpp#L107

Will take a look at it tomorrow evening. Thanks for reporting the bug and providing the PR!

nsg commented 7 years ago

I will close this now considering that the cmake changes was merged in #201 (https://github.com/konstructs/client/commit/7d538a2b39023c6afa7248aa81ec5593c7abc983) and the crash was (I hope) fixed with #200.