   Loot mechanics.
  Can anyone point me in the right direction on how the mechanics work for loot drops.Something similar to WoW.I now have a very simple system with a pseudo-rng. eg. I check if the random number lies between 0.0 and 0.1 (10 percent) and if so the item is looted.Not the best way in my opinion because I have to go through all the items to check if they are beeing looted.   
  You mean you're designing a system that determines what loot is dropped from a loot-producing entity?   ;  Exactly.I want some sort of exponential random number where white items are more likely to drop than purples. But I don't want to limit it to 1 item drop, the system should be able to drop more than 1 item.   ;  each mob loot is rolled when it is created.try using a function that generates a random number between 0 and 100, and decide for each item its drop change, lets say white items got 50 drop change,epic items got 1.5; then you use the "random" function and check if the recieved number is under the drop chance. if its 27 for example then the white item will drop but the epic will not.is that what you wanted?   ;  If I understand your problem right you know how to do the looting but you are worried about performance issues of having hundreds of random events the moment the loot is generated.I would work around it like that:1. Have a random event determining how much loot the mob drops2. Have a random event to get the quality for each piece of loot3. Have a random event that picks an item out of a table only including items of the same qualityEvery mob needs to have a special multiplier for those random events so that stronger mobs tend to drop better/more loot.Also you might want to split up further to seperate potions from weapons etc. So that you can create mobs that are likely to drop a potion or magic book but unlikely to drop a heavens sword +5Example:I kill a weak ork guard. Since the mob is weak it only has 0-1 possible pieces of loot. You roll a 1, then you check the quality. Orks only have poor quality equip so you have chances for very poor/poor/medium quality with values like 60% / 30 % / 10 %. Then you have to split up what kind of item you get, since it is a guard and not a schaman you will propably receive a weapon. Then rolling on the weapons table you might get a normal axe or s.th. like that.   ;  I never understood the point of loot dropping randomization.  One of the best ways to get around this was first demonstrated to me in Elder Scrolls III: Morrow Wind (X-Box).  Simply, make what equipment a certain enemy uses available to the character.  Basically, "you get what you see."  Of course there are plenty of variables to consider.  In the example of an orc warrior they probably have an extremely low chance of carrying any spell books or advanced healing items.  Also, unless you are going to include a system where equipment can be damaged, you should have a chance that certain weapons and armor will have broken and be unfeasible for continued use (creating my preferred double standard that while equipment is in your possession it cannot decrease in quality or be broken from use).  In addition, keep items in the context of an enemy (very rarely will you ever find an Excalibur-esque sword on an orc grunt), but if the enemy in question does have special equipment have it shown and make them use it.  Furthermore, to cut this rare situation a bit rarer have set rarity ranks for all items in the game.  Obviously I have no idea as to the algorithms behind a random number generator, but make the game shoulder the item dealing to the enemies, making your only input the chance of damaging/destroying the enemy items in battle.  Hope this was food for thought.   ;  What's wrong with...void loot_roll(){r = rand() % 10;switch(r){ case 1: case 2: case 3: case 4: case 5: case 6: case 7: drop(item[r]); break; case 8: drop(god_item[r]); break; case 9: drop(god_item[r]); loot_roll(); break; case 10: loot_roll(); loot_roll(); break;}}This will use few rolls on the average, allow any number of drops, and it has a bell-curve like distribution, making the better drops rare. Adjust the numbers to get the desired probabilities.   ;Quote:Original post by samothWhat's wrong with...void loot_roll(){r = rand() % 10;switch(r){ case 1: case 2: case 3: case 4: case 5: case 6: case 7: drop(item[r]); break; case 8: drop(god_item[r]); break; case 9: drop(god_item[r]); loot_roll(); break; case 10: loot_roll(); loot_roll(); break;}}This will use few rolls on the average, allow any number of drops, and it has a bell-curve like distribution, making the better drops rare. Adjust the numbers to get the desired probabilities.I really like this recursive function. It's simple you have enough control on the drops. But how do you handle items that should drop 95 percent of the time? Like cloths and stuff?;Quote:Original post by samothWhat's wrong with...void loot_roll(){r = rand() % 10;switch(r){ case 1: case 2: case 3: case 4: case 5: case 6: case 7: drop(item[r]); break; case 8: drop(god_item[r]); break; case 9: drop(god_item[r]); loot_roll(); break; case 10: loot_roll(); loot_roll(); break;}}This will use few rolls on the average, allow any number of drops, and it has a bell-curve like distribution, making the better drops rare. Adjust the numbers to get the desired probabilities.That should be 0-9, not 1-10.RegardselFarto   ;  Since RPG's usually feature a wide range of creatures, and a wide range of drops, hard-coding items and chances is probably not a smart approach. Things like this are better treated as data, stored in an external file (text/csv file, database, whatever that's easy to modify for a designer).The actual implementation depends on what kind of system you want for your game. It's first of all a design issue. Once you've got that sorted out, the implementation is easier to determine.Now, I wouldn't go for a switch case like that: too little control over percentages, too inflexible. The original approach (comparing a random number with the change for a given drop) allows for finer control. Checking against every possible drop is a higher-level problem, and that's where the design comes in. What do you actually want? Should any kind of mob be able to drop any kind of item? If so, do you want different mobs to have different chances for certain items? Do you want mobs to be able to drop multiple items? Or sometimes no items at all?   