Monday, September 10, 2007

Oops I almost did it again...

Damn habits, to rewrite things that work because you find a better way to do it...

I'm currently trying to smoothly migrate the code from C to C++. By smoothly, I mean that the game must always compile and ru
n by the end of the day. I must absolutely not start a major rewrite which could stale the project for another year. But bad habits are hard to break...

While figuring out how to add the shopkeepers to the city generator, I started thinking that migrating the existing merchant code from C to C++ would be a good thing. Shopkeepers are NPC, which rely on creatures... A few hours later, I was indeed in a major rewrite including the datafile p
arsing system, the whole item hierarchy and the creatures... Fortunately, I realized before it was too late that it would be a motivation-breaker, with maybe two weeks without being able to run the game... I decided to rollback two days of work and do instead a quick-and-dirty link between the city generator and the current npc system.

Now the code is really ugly with all those new shiny C++ classes using old C functions, with duplicated fonctionnality like the Color class and the col_t structure... But I'd better have ugly code that works and keep going forward that a nice work-in-progress set of classes that does not even c
ompile...

Of course I'll have to clean all this junk, slowly remove old C interfaces to replace them with clean C++ ones, throwing away all that D20 SRD stuff that will never be used by the game, but if I want to keep progressing, I must do it SMOOTHLY ! ;)

Anyway I started adding merchants in this empty city. When the player is in the city, he can hit TAB to hide/show the available services. I still have to work a little bit on shops and items, then I'll be able to start the sewer generator.