Here's the dilemma. I want to have a huge variety of custom objects in my games, whatever they may be, that are totally customized using numbers and flags, so no custom procs or anything. I want all these to be based off one item type, /item.
Now, here's the problem. I want to store an archive of pre-set items that have all the flags and variables defined, including their icons. I want to be able to load things from the archive at a reasonable rate, and make sure that any graphics used within are downloaded with the rest of the game resources (as opposed to whenever they encounter them). From there, items could be withdrawn from the archive using a proc and reference number, such as "GetItem(312)"
It seems simple enough, but it also runs against the grain of what I'm used to with BYOND. I'm used to having all objects hard-coded into the game, which is bad bad bad for what I'm trying to do here.
I'm not quite sure where to start in building something like this, and I'm not entirely sure that what I want will work the way I want it to, either.
ID:153883
Nov 13 2002, 12:23 pm
|
|
Foomer wrote:
Here's the dilemma. I want to have a huge variety of custom objects in my games, whatever they may be, that are totally customized using numbers and flags, so no custom procs or anything. I want all these to be based off one item type, /item. Heh. Sounds a lot like what I did for storing objects in my MUD. So, what you want to do is save all of the /items, and be able to load them and reference to them whenever? If I'm wrong, then feel free to correct me. var/global/list/items = new // Our list of items in the game So basically, you are setting their number to an index number inside of a global array. 1) When the game starts up, load the items from the file. 2) Make modifications to the items/create new ones (make some ingame OLC-ish system?) 3) Call the saving proc to save the list to the file when the game ends Hope that helps. |
In response to English
|
|
English wrote:
I just want to make sure I understand a few things: /item is the only item type. 2) What exactly do you mean by "load" the items from the archive? For example, do you want monsters to have a few numbers that can be used to refference (load) the protype for that item from the archive and drop a copy? Do you want to use a text editor of some sort to create new items easily that can then be loaded into the world as a new item? That's about right. I think I could store a list of all objects by simply creating an instance of that object and saving it to the list, then loading the list whenever the game loads. Then I could copy the necessary variables to a new instance of /item, and do whatever I want with that new item. The only question is how laggy it would be to pull an item's data off a list of (maybe) several hundred items, especially if done in mass. And, if the archive is loaded from a savefile, then how could I get the icons used in the archive to be stored in the resource file? |
In response to Foomer
|
|
Well assuming you'd use a normal, one dimension array (perfect since you're using only numbers as refferences and you can fill the entire array without many, if any, holes) so the lookup time should be virtually non-existant. As for copying data, if there are very many vars that could mean lots of loops going through many iterations unless you have some nifty trick (which you may!) to copy the values to a new instance of an item.
Maybe you could come up with a bit based system for flags and storing information about items that would only take loading 1 or 2 variables which shouldn't be that bad. As for loading the icons, wouldn't browse_rsc do what you descibed (storing the filename along with the item)? Sorry I wasn't that much help, but I figured sometimes throwing back ideas worded differently and with different spins can help people solve their problems. |
In response to English
|
|
English wrote:
Well assuming you'd use a normal, one dimension array (perfect since you're using only numbers as refferences and you can fill the entire array without many, if any, holes) so the lookup time should be virtually non-existant. As for copying data, if there are very many vars that could mean lots of loops going through many iterations unless you have some nifty trick (which you may!) to copy the values to a new instance of an item. Would copying 20-30 variables take that long? It wouldn't need to do much if any looping, just 'item.var = source.var' stuff. Maybe you could come up with a bit based system for flags and storing information about items that would only take loading 1 or 2 variables which shouldn't be that bad. Maybe. As for loading the icons, wouldn't browse_rsc do what you descibed (storing the filename along with the item)? No, browse_rsc loads things into the cache to be used by the browser. It doesn't, as far as I know, have any effect on what is used in the game, browser aside. What I'd really like is some way to include the icons inside the archive file in the resource file, and being able to put the resource file up for download somewhere. I don't know that there's any way to do that, though, which bugs me. |
In response to Foomer
|
|
Copying 20-30 variables should not be that big a deal if they are just text and nums. Copying datums may take a bit longer, but I imagine you'd avoid making so many of those per item anyway.
Also, the client.preload_rsc var will handle multiple resource files. However, I'd look up some form of icon id when an item is loaded instead of saving icons in the item file. That way the archive can be independent of the resource file. Perhaps I'd even avoid creating an actual object until a player would see it. Sure, the initial creation might take a little longer as it searches the archive for the definition, but you'd know that unused items were not bringing you past the instance limit. |
In response to ACWraith
|
|
ACWraith wrote:
Perhaps I'd even avoid creating an actual object until a player would see it. Sure, the initial creation might take a little longer as it searches the archive for the definition, but you'd know that unused items were not bringing you past the instance limit. As techy and neat as that sounds, I prefer keeping my sanity to improving things at all cost. I've had enough occasions of over-featuring things in my head before they ever get off the drawing bored, and I need to keep this one relatively simple or it'll never be finished. Besides, if Eternal World can handle endless hordes of monster-dropped objects scattered all over the place everywhere you look and still run relatively smoothly, I think my game can handle objects that are generated before people ever see them. But then, you have to kill the monster before it drops anything. And items get deleted if no one uses them for a while anyway. |
In response to Foomer
|
|
Oops, I guess I shouldn't suggest a feature I've only used sparingly once quite a while ago :p
Anyways, by looping I meant copying the vars for each new item. I'm guessing I used the term looping because you would be performing the same procedure (copying every var) over and over again for multiple items (although they would be from seperate events/monsters/players). If 20-30 vars are copied on hundreds of items at basically the same time on regular intervals (enough worth thinking about), then it seems that could cause some slowdowns. |
1) Is /item the parent type of every item type or is /item the ONLY item type, which contains all the necessary variables to reach the configuration of any item you want?
2) What exactly do you mean by "load" the items from the archive? For example, do you want monsters to have a few numbers that can be used to refference (load) the protype for that item from the archive and drop a copy? Do you want to use a text editor of some sort to create new items easily that can then be loaded into the world as a new item?