Shelter dev. update 07/28/2010

Proper encounter handling is now complete.

Of course, if I didn't have a computer job and dry eye syndrome, this would've been finished 3 weeks ago. I always feel my eyes "battery" and how much "text reading tolerance" I have left at any given moment. I wish I could get an e-paper screen just for coding.

Anyway...

The new encounter system was lacking two things:

1) encounter "big map" radius management/selection (completed a week earlier)
2) deleting assets after you exit the encounter

2) proved to be more of a problem than initially anticipated. Deleting "encounter people" and "encounter objects (like shelves)" was easy - just cutting off the tail of the arrays containing them, because the encounter always added them at the end. Voila. That took about 7% of my time.

The other 93% was taken by ITEMS. I couldn't just do the same with items. Picture this:

Player enters encounter.
Two NPCs are spawned.
Player kills them, and takes ONE pistol from their corpses.
Player exits encounter.
Item array is shortened to previous size.
Player discovers that his pistol has vanished, because it was part of "encounter items", and the inventory slot references NOTHING.

So I put a tracker on each item, to be able to see which person it belongs to. With this knowledge, I could go through "encounter items" when encounter is exited, and delete those that DO NOT BELONG TO A PERSON (or corpse) THAT EXISTS.

This presented challenges, as the item equipment&generation routines couldn't discern between inventory of objects(shelves,etc) and NPCs, and also they didn't return anything if the equip action failed (as it was previously considered a non-critical, quit-and-whatever, error), so a new "datapath" had to be laid through these routines.

Then I realized that item deletion wasn't actually implemented. To do it the traditional way, by shifting the array by one element onto their former space, would require me to go through each container and person and reindex references in their entire inventory for each single item deletion.

This broke my brain for a while, until I realized that there is a simpler approach - just "zero out" the item, and modify the AddItemToGame() function so that it doesn't append new items at the end of array. First, it scans the entire item list for a "zeroed out" item, and sees if the new item can take that spot.

And so, finally, it works.

Goodbye, encounter system. Hello, random new task which is not yet chosen out of many.

 
Comments (1)
Grats
1 Tuesday, 03 August 2010 12:50
Mr. T
Congradulations on finishing the Encounter system :), hope you won't have to go back to it and that other problems will go just as "smothly" as this.

Forum

You can visit our hosted forums at
"No Mutants Allowed"

No Mutants Allowed

Shout Box

Latest Message: 4 months, 1 week ago
  • generic : «link» medication, Generic Viagra is highly recommended pill for impotent men. So, Buy Generic Viagra Online from the pocket friendly online store
  • generic : About: «link» | Yale: «link» | Stanford: «link» | Google: «link» | FDA: «link»
  • generic : About: «link» | Yale: «link» | Stanford: «link» | Google: «link» | FDA: «link»
  • Seroquel : «link» «link» «link» «link»
  • Seroquel : «link»
  • Seroquel : «link»
  • kamagra : «link» | «link» | «link» kamagra jellies | «link» L:o)
  • shihonage : Thank you Gerasim :) Hope Mumu is doing well ;) Release date is still unknown. Good luck w/your projects as well :)
  • Gerasym : Hello! What is the date of release Shelter (demo) and full version?Will be editor to it? The game looks very intresting and promising. I am beginner programmer I making program on C#,I think about remake Van Buren,Tactics and I think your work is brilliant.Carry on and good luck!
  • Mr. T : Yes plz add rendom screenshots it's nice to follow your prograss also I support the Fallout tipe of camera insted of Diablo, this is a thinking RPG afteerall :).
  • shihonage : I don't know whether we'll run into legal problems with digital distribution outside U.S. borders. We'll cross that bridge when we arrive to it.
  • Mr. T : I'v writen before how GREAT this game fils, and have no problem with it been commercial, what I have consernes about is that the game may not be aveluble to all countis if that is the case do you have any paln on making it international?
  • shihonage : Commercial and Windows-only for the time being - too tightly integrated into Win framework.
  • Tuxedo : Hi guys. Looks really promising. Will it be commercial or free game ? Will it be Windows-only or crossplatform ?
  • Mr. T : A coroner :) that one shuld go in to Shelter
  • shihonage : Спасибо :)
  • Mr. T : Боги как же здорово выглядит игра, такая настальгия по F1и2 :)
  • Deele : I'm using brilliant system of RSS feedreading :P So, fewer times to visit page...
  • shihonage : Thanks sir :)
  • HoboWithAGlo : Well, seeing as the last message was over 3 months ago, I'd be glad to update this message box. Keep up the work guys.

Only registered users are allowed to post