Sokomine wrote:I want that code as well, please! It annoys me to always have to press w to run forward, sometimes in combination with e. It's particulary annoying on Android devices, but also on the desktop. Please get it merged into the main branch of MT. My fingers would thank you!
As you know, I posted this earlier as
a patch. I haven't looked into what's required for merging into the game. However, I still find it suspicious that all the autorun code is already there, but not tied to a key. I think someone must have decided that it was a bad idea at some point, so I wonder if it would be accepted anyway.
Sokomine wrote:As to the speed gain you encountered: Most of it seems to be related to the noise calculation/handling if I got you right? Of course I'm intrested in any speed gains. The village code runs pretty fast by now, but it can't be as fast as a native mapgen.
The biggest cpu load I found in profiling vmg-c was the generation of 3D noise tables. Everything else together took about a tenth of that time. After that came lighting and liquid handling, and again, everything else together took about a tenth of that time. I was always taught that optimizing for a 10% performance gain (or less) is usually a waste of time.
I wonder if people aren't overstating the speed of C++ mapgens. There's certainly a performance cost for calling to lua and back, but I don't think it's nearly as great as a lot of other aspects of the game. And lua is designed to be very fast for a scripting language. I've heard it's about half as fast as C at number crunching. There are probably a few compiled languages that can't manage that.
The version 7 mapgen code shows a lot of thought about how to avoid wasted time. The terrain (and cave) generation may be a little strange, but it's efficient. That may have more of an impact than the C compiler.
Edit: I put in a
pull request. We'll see what happens.
Edit: Since the two ports are now handling about the same features, I did a set of average chunk times on each. I set vmg_caves to false in the lua version, since we already know that's an issue. The times I got on my rickety, old laptop were 745ms for the C++ version (with its lua companion code) and 1482ms for the original, so the C++ is running about twice as fast. Ok, that's fairly significant.