top of page

When things stop working for no reason...

So I went back to building my world again to test the new staging options, and set up more complex routines for the NPCs to follow.....and upon loading the map, much to my dismay, the end of the loading bar brought a spinning cursor then an abrupt crash to desktop.

These issues are normally caused by the memblock code if I address an area of memory in an invalid fashion, but on this occasion no such change had been made. Queue the long period of restoring to a previous version, then trying again. Eventually, after numerous mixed results, I found that the NPC loading code was causing an intermittent crash, and when it didn't crash the textures and models were completely corrupted for no reason.

So now I knew the cause of the crash to desktop (sort of) but still no idea why. So I reverted to the tried and tested method of adding a MESSAGE(<STATUS>) to every second line of code until I could eventually pin point the exact line which was crashing. This took several hours before I eventually discovered that the issue was corrupted save files, though again still no idea why this was happening randomly, especially since it seemed only to be this one map, and after I made no changes to the NPCs within the world.

After about another hour more it struck me...the NPCs are powered by two arrays; one which holds all their details, and the working array which controls their objects, textures, status, animation phase etc. It took ages to find the corruption, but I finally tracked it down; the models were loaded as array variables which assigned a free slot to each object, but I had been saving this array as well. That meant when it loaded, the code was trying assign specific properties to those stored object numbers...except I had added a few new objects to the world, which changed the structure of the object numbering, and the code was trying to apply NPC creation to existing objects within the world which were not NPCs.

Apparently trying to make a windmill walk like a human doesn't work very well...who knew. So finding the issue took nearly 5 hours....fixing it took roughly 10 minutes.

Ah, the joys of coding.

 
 
 

Recent Posts

See All
Welcome

Welcome to my blog for the AGK World Builder. Here I will update on progress milestones weekly, as well as what features I am working on....

 
 
 
Changelog 20/03/19

· fixed LOD on paint layer shader · moved interface – painting and path layers now in relevant menu only · reworked object interface...

 
 
 

Comments


  • facebook

©2019 by AGK World Builder Development Site. Proudly created with Wix.com

bottom of page