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 run 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 parsing 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 compile…

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.

1 comment so far

Add Your Comment
  1. I really enjoy reading your blog, as your are currently developping what I will have to add soon to my own roguelike (for instance I still have to add field of view and NPCs…).

    I also find it hard to choose between adding new features and debugging or upgrading old ones. The best thing to do from my point of view is to alternate both, so I can stay motivated and my code remains clean.

    Please post more stuff ! What have you planned to add next ?