Choose Your Language

Wednesday 10 April 2013

Bashing Objects

Just a quick post this week, as I have had to sort out a few personal issues, which have taken some of my time and energy. Just to say that I have been continuing to write for conversations and quests when I can, but coding in this area is progressing slightly slower than hoped. I was held up for a short while when I discovered an issue when I made my PC bash an object. The screen froze for about a second before continuing. I had not been expecting that to happen, and it diverted what attention I had on conversations to sorting this problem out.

I had not noticed the problem when bashing an object before, and so wondered if it was due to me creating a large number of items on the object at time of being destroyed. (Treasure! - Yes, large treasures might happen!) Doing a few debug checks (complicated a little by the fact that I have coded hardness factors for objects), and rewriting the function didn't resolve the issue. However, when I tested the code in a different area, it worked fine. So, I broke the code down to fire bit by bit, and eventually discovered the problem occurred on a large area with many objects; I was closing in on the problem. Eventually, I tracked it down to a loop call that was not "breaking" out of itself when an object was beyond a certain distance from the destroyed object. So, in large areas, the loop was processing a lot of objects ... and, hence, being frozen "in thought" for a brief moment.

A very simple addition of a break in the code had me up and running once detected. Now, I need to get back to writing the conversations and quests .... :)

No comments: