#Store Generation Script

1 messages · Page 1 of 1 (latest)

glad plank
#

I want to make a store generator in my game, but I'm not very good with generation in c#. The one I have barely works and I just need help making one.

copper swallow
#

What help do you need

glad plank
#

I need help writing the script

#

I already have one but its really bad

unkempt coyote
#

Post the code that you have. We don't know what you ar trying to do

#

!code

hidden radishBOT
glad plank
desert olive
#

Explaining what you're trying to do is the first and most essential step to making this work

#

without a good description of the desired behavior, nobody can help you.

#

What is a "store" exactly? What parts of it need to be generated? What are the properties you want for the generated things?

#

You need to start by writing a simple explanation, in english, explaining how you want it to work, before you start trying to code anything.

glad plank
#

I want it to pretty much be for the layout of a grocery store (ex: Walmart, meijer) but I want tit to generate shelves in sections, with prefabes, like 5 food prefabs and etc. The items are just going to be on those prefabs and they will be randomly generated in a random layout.

desert olive
#

ok and what are the properties of the items? Do they have different sizes? Do the shelves have well defined lengths? What kind of spacing is needed between them?

What about how they are generated? Should it be completely random? Or should it be in sections, with duplicates and related items near each other?

#

Should the shelves be totally full?

#

If the sizes matter you need to think about it in a purely mathematical way at first. Like. if a shelf is 10 units wide and you have random elements with sizes between 1 and 5 units, how do you generate things that fit? One option is basically to look at the remaining space on the shelf and select a random element from the elements that are smaller than or equal to the remaining size.

E.g. if you have 3 units of space left on the shelf, you can only select things with size 3 or less.

glad plank
#

They should be in sections that are defined in the inspector, so I can have like 5 food shelves and 3 electronic shelves together in their own sections, they don't need to be in any specific order. The items on the shelves won't be randomly generated. The shelves are just one mesh and while gnerating it looks for the scale of them and tries to put them together.

desert olive
#

ok so the shelves themselves are like predefined? Like... an "electronics shelf" has a preset set of items?

#

so it's the arrangement of these preset shelves that is random?

glad plank
#

yes, the shelves should have a specific tag of what section theyre in. The arrangement in the sections should be random, yes.

desert olive
#

I would make each "shelf" e.g. collection of items into a prefab. Then you can just select a random "shelf" of items from a list and populate each empty in-game shelf with those prefabs.

glad plank
#

Each in-game shelf should have the items randomly generated, just the store layout

desert olive
#

I'm confused you said:

The items on the shelves won't be randomly generated
But then you said:
Each in-game shelf should have the items randomly generated, just the store layout

#

So I'm not sure if the items on the shelf are random or not

#

either way, if they are, you just need to pick random items from the category that the shelf you're generating is

glad plank
#

I meant shouldn't, that was a typo

desert olive
#

Then you just need to pick random shelf prefabs and place them in each shelf spot

glad plank
#

yeah

copper swallow
# glad plank yeah

(To be clear they are asking questions to help you make it, no one here is making you the script)

glad plank
#

Yeah, i already fixed the one I had