Author Topic: The things that aren't saved but should be  (Read 11777 times)

0 Members and 1 Guest are viewing this topic.

Offline zodiac44

  • Hero Member
  • *****
  • Posts: 560
  • Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
Re: The things that aren't saved but should be
« Reply #15 on: February 01, 2010, 04:36:40 PM »
Saving the item data or generating ID's automatically (in the MD5 example you gave) would require the player to start a new game in order to use items that he changes properly.  Having a user-generated ID's based on a well-defined namespace is simple and effective.  It is, in fact, the preferred method employed by game developers who intend to have user-created content in their games (see NWN, Oblivion, Fallout, etc).
Capitalization is the difference between "I had to help my uncle Jack off a horse" and "I had to help my uncle jack off a horse."

Offline necno

  • Core Developer
  • ******
  • Posts: 385
Re: The things that aren't saved but should be
« Reply #16 on: February 05, 2010, 05:54:24 AM »
Hmmm, this wouldn't be very difficult to implement. The suggestions here for methods of generating IDs are useful. There will always be a chance of conflicts but using a combination of time stamps and computer specs would reduce this to effectively nothing. As mentioned though it will have to be on the back burner for a while.
Click here to donate
After you do so please pm me the email address you used so I can add you to the donation forum.

Working on:
Whoremaster II (Official)
Birthright (Now a commercial rougelike)

Offline betatester

  • Newbie
  • *
  • Posts: 24
Re: The things that aren't saved but should be
« Reply #17 on: February 07, 2010, 08:35:20 AM »
my md5 method works well if you save all the owned and present in shop item data in the saved game.
You use the .itemx files only for generating new items.

if you modify an object in the .itemx file => new ID the old and new version exists but are not equal and don't stack anymore

Since you keep all the owned and buyable item data in the samed game if you delete an item in the .itemx file you don't have any problem since the item still exist in the saved game as long as someone owns at least one. The deleted item is not generated anymore since you use the .itemx

The md5 system is independant of computer so you can exchange saved games (usefull for debug)

it can be used for an Equipment.equals(Equipment) method.

Offline zodiac44

  • Hero Member
  • *****
  • Posts: 560
  • Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
Re: The things that aren't saved but should be
« Reply #18 on: February 07, 2010, 12:19:20 PM »
Here's where the MD5 system fails:

Create and item (say, "Potion of Healing" that gives +10 health).

In game, buy a Potion of Healing, save game, exit.

Edit item in editor (say, change potion to +20 health), save.

Load saved game.  Now, if the game saves the items' effects, you have two Potions of Healing in the game.  One gives +10 health, the other gives +20 health.  Apparently, you don't see a problem with this.  In every other game I've played that allows users to modify items, the changes apply to all copies of an edited item in the game.  They do not generate a new item that is wholly separate and distinct from the original.  The system you proposed breaks players reasonable expectations.

I could see using an MD5 method to generate a unique ID the first time an item is created in the editor.  Subsequent changes to the item should not generate a new ID, unless the item is specifically saved as a new item.

I vastly prefer user generated ID's in a well defined name space, though.
Capitalization is the difference between "I had to help my uncle Jack off a horse" and "I had to help my uncle jack off a horse."

Offline delta224

  • Dev Team
  • *****
  • Posts: 577
Re: The things that aren't saved but should be
« Reply #19 on: February 07, 2010, 12:54:05 PM »
For an id system I am thinking about using the file name and the item name.  That should be unique enough  for our purposes and will allow for some basic checking in case the user removes the items file. This also has the bonus of not needing to change the item file.

Offline betatester

  • Newbie
  • *
  • Posts: 24
Re: The things that aren't saved but should be
« Reply #20 on: February 07, 2010, 07:31:49 PM »
I think that a define namespace Misc-LSpack-Abortion2 is a better system than the MD5 because you can edit files with only a text editor
just be careful with modify, delete, creation of  items with the same name but with different effects (see philter of abortion in LSItem pack) and stacking.

This topic is not about a system but about the necessity to save in the savefile the item description of all item owned by master or girls and shops. If an Item file is deleted it still works and you can't reload to respawn the shops.

On the other side the new possible item stack is loaded each time you load a game, it's dynamic and any modification is used asap (there you can, if you want, checked it the owned items if you have to modify the item array based on unique ID).

Offline zodiac44

  • Hero Member
  • *****
  • Posts: 560
  • Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
Re: The things that aren't saved but should be
« Reply #21 on: February 07, 2010, 11:44:27 PM »
For an id system I am thinking about using the file name and the item name.  That should be unique enough  for our purposes and will allow for some basic checking in case the user removes the items file. This also has the bonus of not needing to change the item file.

Right off the bat, this conflicts with LS's items pack, which has several items with the same name but different effects (the abortion potions come to mind).  I don't know if the game handles them correctly as is, but they would definitely cause collision with a <file name><item name> ID.
Capitalization is the difference between "I had to help my uncle Jack off a horse" and "I had to help my uncle jack off a horse."

Offline Graen

  • Full Member
  • ***
  • Posts: 121
Re: The things that aren't saved but should be
« Reply #22 on: February 07, 2010, 11:51:33 PM »
*cough*[00000000] - [FFFFFFFF]*cough*

That's 16^8 combinations... or 4,294,967,296. ::)

Offline zodiac44

  • Hero Member
  • *****
  • Posts: 560
  • Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
Re: The things that aren't saved but should be
« Reply #23 on: February 08, 2010, 02:20:41 AM »
So?
Capitalization is the difference between "I had to help my uncle Jack off a horse" and "I had to help my uncle jack off a horse."

Offline delta224

  • Dev Team
  • *****
  • Posts: 577
Re: The things that aren't saved but should be
« Reply #24 on: February 08, 2010, 08:58:23 AM »
Fine add the number of what item it is in the pack at the end of what I suggested and that issue is fixed, and I don't think the game tracks it correctly anyway.

Offline LordShame

  • Jr. Member
  • **
  • Posts: 94
Re: The things that aren't saved but should be
« Reply #25 on: February 08, 2010, 10:26:12 AM »
Well, my solution of using several items with the same name but different effects is just a basic kludge. If a legitimate way to get some random item effects is ever implemented, this won't be a problem.  :D

I don't think the game tracks it correctly anyway.

As far as I've tested, it works, but not exactly as you'd think. The store generates the separate items randomly, but if you have multiples that stack up in your inventory, they seem to merge and only have the stats of one of the items. Using the Test brothel, you get seven identical Philtres of Abortion at the beginning (all of them are the -2 Constitution version, presumably because it's the first one on the item file), but if you get rid of all of them, and then buy one from the store, the new one you get is randomized "correctly". I would guess this has to do with how items stack up in the player's inventory but remain separate entries in the shop inventory.
« Last Edit: February 08, 2010, 10:36:06 AM by LordShame »

Offline betatester

  • Newbie
  • *
  • Posts: 24
Re: The things that aren't saved but should be
« Reply #26 on: February 08, 2010, 07:04:21 PM »
that's exactly the way I though it worked (see my example with disguised slave band in your pack topic)... it's buggy because items doesn't have unique ID.
your choice to make multiple item with the same name is the only way to have actually some kind of random effect...

But maybe we could make another topic for discussing unique ID

Offline LordShame

  • Jr. Member
  • **
  • Posts: 94
Re: The things that aren't saved but should be
« Reply #27 on: February 08, 2010, 07:22:23 PM »
that's exactly the way I though it worked (see my example with disguised slave band in your pack topic)

Oh man, that's right, I had forgotten about that... Heheh, I should have remembered, it would have saved me a bit of testing.

That's why I'm so nervous about whether it's my fault or not when I find out something doesn't work right with my stuff: I worry that I'm just being absent-minded again and forgetting something important or obvious.