Posts: 9
Threads: 4
Joined: Jan 2012
Thanks: 0
Given 0 thank(s) in 0 post(s)
Hi all. This server is amazing! Thanks for good soft.
I am C++ programmer and I can help you with this project.
As I know , game logic cannot be run on many CPU cores now. I read sources and didn't find anything parallel in it. Is it right?
Chunks can be update independent from each other, so it is possible to make method tick() in cChunkMap parallel. Is it necessary? Does it speed up the server?
Posts: 59
Threads: 1
Joined: Dec 2011
Thanks: 0
Given 1 thank(s) in 1 post(s)
You're right that the whole of the server logic isn't threaded at this point but it IS something to look forward to and possibly with a configuration option so people can use all available threads or limit to how many they want (great for GSPs as well).
I myself haven't done much work with threading and with being thread-safe so I can't speak to the code of it much, but any such contributions would be appreciated by most, if not just me.
Cheers.
Posts: 9
Threads: 4
Joined: Jan 2012
Thanks: 0
Given 0 thank(s) in 0 post(s)
I started to move chunk generator and found some problems.
In your parallel version method cWorld::GetChunk returns 0 if there is not chunk and it start to generate it. Returning NULL is not correct because there is no result verification in some functions. Some other functions work incorrect with NULL. GetChunk is safety only with chunk generator in it.
I think that the solution of this problem is generating chunks in other place. Notch server generate 100 chunks near players. MCServer can do the same. On each Tick server will check all chunks near players and add tasks to ChunkGenerator if chunks don't exist.
If I'm right that the main problem is returnin NULL then generating immediate chunks will solve problem.
Did you find other bugs in your parallel ChunkGenerator? I didn't find anything bad.
Posts: 1,450
Threads: 53
Joined: Feb 2011
Thanks: 15
Given 120 thank(s) in 91 post(s)
AFAIK everywhere GetChunk() is used it also checks if it actually gets a valid pointer. There was a deadlock in the code that has recently been fixed, so I think it should work fine now.