Sunday, 27 July 2014

Clean-up (x2)

The level generation is working again mostly. Some new bugs, but nothing major. Both FOV and light map routines are off for now until I have the energy to concentrate on them. Maybe it's best this way, I can directly see the topology of the level when creating level themes.

There are more important things to do anyway. Next task is mainly go through level themes and add more things, starting from basic topology and then moving on game object distribution. There is a "trick" involved in the process, an idea I had while working on the new version of Teemu. It's of course a secret.

I guess it's these warm days, but I was upset when I noticed that save game routines for each game object type has to be refactored. Most of them were easy to convert, but couple of them needs more work. When I get upset it sometimes makes me clean up places. It's a woman-like way to react, but who cares.

Sunday, 20 July 2014

Tile class - part 6

It took almost two months to refactor multiple maps to a single one. But it's not over yet...

It's annoying that I made mistakes even I should have known better. The bounds check is less reliable now, because it's not built-in like it was before. I don't know what was I thinking. I guess it can be fixed for at least those getters that return a class type, because returning -1 is dumb. It could be possible to create a type for a tile outside level borders that acts like any regular type, but the way that you can't reach or use.

FOV is not working properly. There was a coordinate translation change so it maybe has something to do with that.

The next task is a clean-up to fix bugs.

Saturday, 12 July 2014

Tile class - part 5

Mask maps are now mostly included in the Tile class. While refactoring terrain map I realized that Gameview class has to be refactored. It's a class that draws the final 17x17 tiles on screen. Previously it had both static and dynamic light maps copied into a special 35x35 buffer which includes nearby light sources still visible from that 17x17 view.

However I found out that there is no need to copy the light information to the gameview, or anything else, because Tile class can include them. Even dynamic light values can be stored in Tile and recalculated on a specific area around the player to show only light sources that can be visible to the player.

The original Gameview was a result of copying FOV data and then determining how tiles and light would be displayed, but FOV was moved away from Gameview even before I started this refactoring and I didn't figure out how much there was unneccessary copying until now. Another great thing is that the new code will completely remove difficult coordinate transformations. Also, tile graphics are now stored in Gameview which is a wrong place, because they belong to GUI class. Gameview wont become completely useless, because it still has the update map which speeds up displaying of tiles by remembering empty tiles from previous turn and not drawing them at all.

Even now the gameview routine is fast, but it's going to be really fast after this refactoring. Well, I'm going to need that speed to include lights that have FOV routine in them. At the moment lights are just simple spots that don't know anything about walls or other obstacles.