How would C++ be used for randomizing something such as loot in a game? And how do you manipulate percentages for certain drops?
I am trying to understand C++ but I need examples I'm familiar with to kind of help me. Not trying to steal any code or anything like that. I just need help understanding. Is rand() used? or is srand() ? please help. I am confusion lol
I think, it depends on the Developers. they use anything which is suitable and faster executable for the game. You are talking about games like PUBG? PUBG is made in unreal engine, they might used something from the certain engines? who knows? BTW you accidentally posted this question two times please delete the another one.😊
Those things are not random. the place is random where to you will find those things, but amount is fixed and predefined. Like you will find only 2 medkits from whole map, and only some number of kar98 and all those guns. but the place where they got spawn is random.
after completing gameplay, it calculates everything, like I have a mission to get one 4x scope, after game completed, it checks that in that game I got a 4x? if yes mission successful and you got rewarded else it will check that again in next game.
One uses rand() to generate a pseudo-random integer between 0 and RAND_MAX. The srand() function is meant only for providing a seed to the rand function, so that we get a random output on every run. Thus, we pass the system time to srand, as that is the best seed possible. To get a range from rand, you can take the mod of the resulting number in the following way : int rnd = L+(rand()%(U-L+1)); This generates a number between L and U, both inclusive. In case you require random floating point numbers, you will have to use the new C++ random, which is somewhat different.
More like...in Destiny when you get loot how it has a random percentage drop for commons, legendaries, exotics, etc. I'm just curious as to how that works. Also thank, I deleted the duplicate post.
So in a game like The Division, let's say you complete a mission and it gives you a weapon. How does the computer know which reward to give you?
dang that's a lot to process haha