You’ve heard the term needle in a haystack? That doesn’t describe what I’m up to at the moment. The Torqe engine comes complete with 200k+ lines of C++ source. I’ve found a function I want to implement (adjusting the terrain height dynamically during a game, so that you can deform the terrain with explosions. Something not supported at the moment), and decided hell with it, it’s time to just dig in and try it.
Job 1 – find the code that the terrain editor that comes with the package uses to change the height of terrain. Ouchie. Found it… sort of. Documentation inside the engine is EXCELLENT in some places, and non-existent in otheres. Guess what – I had to pick a non-existent area to play with. (I think they didn’t expect that someone would want to modify the editor, so they didn’t stress over it.) Found the function, read the function. Scratched head. Many times. Had a smoke. Read the function. Scratched head again. Repeat a number of times.
Without documentation on the function, I’m kinda flying blind. It’s ugly.
Job 2 – declare a new console function that’s accessable from the scripting engine. Surprisingly, that was much more simple than expected, and thier functions for doing it are pretty robust. I got it right (compiled without warnings, and ran just fine) the first shot – I’m impressed 😉 In fact, thier console function system is smart enought that if you don’t bother doing error checking in your code, it does it for you to a certain degree. Pass it the wrong arguments, etc., and it dumps the error back to the console instead of dying hideously like it should. VERY nice, and makes hacking a new function in very friendly – you don’t have to do the edit, compile, run, crash, repeat method if you are hacking without a clue 😉
Of course, I’m still a LONG way from getting my function completed. And I still haven’t got much of a clue how to pull it off – the set terrain height command that exists is very interdependant on other code within the terrain editor, which means you’ve got to rewrite huge sections just for your own purposes. EEEKS.
And – if you haven’t guess, I’m having fun. This is what I like to do, no matter how many headaches it causes. And in the middle of writing this, I was looking back at some documentation, and saw a way that I might be able to ‘cheat’ it and make it work the way I want without writing entirely new functions. Go fig 😉