Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Barry Pythagoras
12
Years of Service
User Offline
Joined: 14th Mar 2014
Location:
Posted: 19th Apr 2014 13:36 Edited at: 19th Apr 2014 13:52
I am making a game with a possible 3,838,380 spells. I want to generate them all.

You have 40 ingredients to choose from.

It takes 6 ingredients to make a spell.

That's 3,838,380 spells.

I need the spells to be the same every game.

So I need a seed. I need to know that all of the spells can be made.

So I generate the spells with a spell editor. What do I do after I generate the spells?

Do I store them all? Would that take up a lot of HD space?

Would storing them all take ages to load them all?

I don't want people to be able to look at the spells, they are secret to the game. Looking at the spells would give the player an advantage.

I could generate them during the game if I knew how to seed 3,838,380 results without any missing patterns.

A Lottery generator looks a bit like this...





I don't want any 2 spells to be the same...Any ideas?
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 19th Apr 2014 15:37 Edited at: 19th Apr 2014 15:39
Quote: "3,838,380 spells"


This is not exactly accurate. You have 3,838,380 possible combination the ingredients can be placed in. This doesn't equal nearly 4 million spells which no one on the planet would bother defining for every possible combination. Even if it's was seed generated, you'd have to define each possible spell that the seed would pull from anyway. It's just too many by miles.

Instead, you need to define each possible spell in the system, depending on the type of game you can set up a spell system that works off modifiers and types which could be generated. Once you've got all the content ready then you can work out how they will be made in game.

"Get in the Van!" - Van B
Barry Pythagoras
12
Years of Service
User Offline
Joined: 14th Mar 2014
Location:
Posted: 19th Apr 2014 17:05 Edited at: 19th Apr 2014 17:20
Quote: "This is not exactly accurate. You have 3,838,380 possible combination the ingredients can be placed in."


Yeah that's the same as 3,838,380 spells according to a lottery calculator that I tested it on. I have enough spells, it's not that hard. I use spell strength..

40% to 100% ...that's 60 options already

Then the spell...

Love Potion... so 60 times all of these
Hair Growth

etc

Then to that you add random side effects...
Bad breath
Blue tongue

etc

You can quickly make nearly 4 million spells. You see the 40% spells are not very good, so you have to remember the good ones that you find. Then you can share them online. 4 million quickly becomes too few in a way.

What I want to know is how do I seed 4 Million results on the fly?

I know how to store them, but is that too slow, and too much HD space?
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 19th Apr 2014 17:31 Edited at: 19th Apr 2014 17:31
Quote: "4 million quickly becomes too few in a way."

Quote: "I have enough spells, it's not that hard"


Have you actually done the math on this?

Taking the figure 3,838,380 and say every spell had 60 strengths or levels to each which then spells really aren't that unique. You'd still have 63,973 unique spells, that's one hell of a lot of spells you have to name, give attributes to and etc. Still far too many.

"Get in the Van!" - Van B
Barry Pythagoras
12
Years of Service
User Offline
Joined: 14th Mar 2014
Location:
Posted: 19th Apr 2014 17:40 Edited at: 19th Apr 2014 17:56
Well you have 40 ingredients, and you have to use 6 of them.

So I thought that something like this...

40 spell names.
60 power choices.
40 side effects.
The cost of the ingredients as a price result.

can cover most of the 4 million without coming up with all the names.

you get...

Love Potion
42%
Side effects = Bad Breath 10%
Price = £20
Score = 1

Maybe think of more outcomes. The spells don't need to be very unique.

This wins...

Love Potion
43%
Side effects = Bad Breath 10%
Price = £20
Score = 1

So just one change wins in a battle. The game is mainly just based on the percentage. But I don't want it to be easy to get the high 100% percent spells. And you have to think about the 40 ingredients. Some are very rare, and hard to find. But I don't want different ingredients to make exactly the same spells.
ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 21st Apr 2014 20:07
I'd just make it completely procedural. For instance, you could use the first two ingredients to define the spell type - which would make 1600 different spells already, which is always quite a lot obviously, but anyway..
You could then use the remaining 4 ingredients by calculating a unique number (for instance ing(3) + 40*ing(4) + 40²*ing(5) + 40³*ing(6)), use this seed as parameter for DBPs randomize, and then compute the spell's parameters with variations of the rnd command.

The details of each spell would not be stored on the hard disk, but computed on the fly every time they're needed.

This method surely isn't perfect as 1) different configurations of ingredients can result in the exact same spell and 2) not all possible outcomes are covered (for instance you could never be sure a love potion with 100% power can be achieved, as the power attribute is randomized). There are probably ways to deal with this though. For instance by not using the seed as a base for generating random numbers, but by interpreting it as a sort of encoded permutation of the spell's attributes, if that makes any sense.

Barry Pythagoras
12
Years of Service
User Offline
Joined: 14th Mar 2014
Location:
Posted: 22nd Apr 2014 00:18 Edited at: 22nd Apr 2014 04:10
Yeah I've been thinking about it.

It goes something like...

Dim SpellType(40)
Dim Power(60)
dim SideEffects(38)
Dim Colour(37)
Dim Special Ingeredient(36)
Dim BottleType(35)

Then you have more than 3,838,380 combinations.

Use the ingredients as a seed with letters.

Ingredient 1 = Zu
Ingredient 2 = la
Ingredient 3 = hab
Ingredient 4 = ar
Ingredient 5 = an
Ingredient 6 = gy

So when you get 6 ingredients you have a seed like

Zulahabarangy

Randomize val(Zulahabarangy)


Which you can use as the name of the spells special ingredient. So you never get 2 spells with the same special ingredient.

Love Potion
Special ingredient Zulahabarangy
60%

etc.

Which gives you almost 4 million spells, because you have deliberately made the name never repeat, although the rest may repeat at some point.
Barry Pythagoras
12
Years of Service
User Offline
Joined: 14th Mar 2014
Location:
Posted: 22nd Apr 2014 04:23
Oh yeah you have to split the string up with Mid$()

seed = ASC("a")

Login to post a reply

Server time is: 2026-07-07 08:42:21
Your offset time is: 2026-07-07 08:42:21