Sunday, 30 October 2011

Evolution of the code #7

Redundant code removal, interface log, camera improvements
Ive had to remove a lot of redundant code because everything was getting too blurry. This is also going to be helpful while porting to a newer version so I guess time was not really wasted.

The interface log really needed an update. The problem was that, the game is split into 3 DLLs - one which contains the interface, one which handles the actual engine and another which contained all of the entities. This created a major problem for the log with circular dependency because i had to send text updates to the interface from any entity. Thinking how I could solve the problem, I immediately remembered of the engine game console log. This log can be called to send an update or warning from anywhere so I figured this was the best method.

The problem? How do you catch an update sent to the console log in an interface control. Simple - by using a handler! This method is great as it does not need any extra code to generate that interface log, and I don't really mind if the console is getting spammed with in-game messages (hell, if valve did it with the source games, then i guess it should not bother me at all). So, currently, updates to the interface log can be sent from anywhere in the code (including lua scripts).

After working a bit more on the camera, it is now rotating as it should according the the azimuth angle (similar to the tech demo).

Ammo types in weapons, objective logs, turn based combat
Weapons now remember which corresponding ammo type it was reloaded with but does not affect the damage yet.

Objective logs have also been implemented and updates can be seen on the objectives window. Though it does not look rather good at the moment, until someone volunteers his awesome 2D graphics skills there is not much I can do. Its pretty optimized as it remembers only an integer array of the mission updates(with which updates are extracted by using it as an index into a database) rather than full strings.

Ive also updated the Anson mission lua code a bit: The locker can be looked into at all times but if the player looted the locker before he accepted the mission then a problem is generated; the "drugs" which are needed in order to accuse Marienne have already been taken. I solved this by adding new items in the locker(via lua) when the user interacts with it while the mission is active.

Regarding the turn based combat system - I think I broke it or there were some major flaws. I might have to literally get back to the drawing board with the combat manager next week...

All and all, everything is taking shape. Must take care of that turn based combat manager, implement a few features of SPECIAL, ammo and damage modifiers, missed shots, profile saving and loading system and I believe its ready to be remade the van buren missions on! Will post on a few places to get a bit more readers when that happens but for now that is all!

No comments:

Post a Comment