Search Unity

Generating content by a seed value?

Discussion in 'Scripting' started by Mazena, Mar 22, 2019.

  1. Mazena

    Mazena

    Joined:
    Aug 16, 2015
    Posts:
    5
    I've been bashing my head against a wall with a programming and design issue with my game for a while now. I'm creating a location-based game for mobile devices, and I want to spawn enemies and other objects around the map (kinda like Pokémons spawning in Pokémon Go). I want to generate these locally for each player and yet for each player to see the same things. I don't have a huge server that could keep track of everything spawned, so I know I'm going to have to use some seed generation to give the appearance of randomness, but have total control over it.

    Basically, I thought of creating a seed for every Point of Interest on the map upon loading it by probably using it's longitude, latitude, current datetime's day and year (which is checked using a http call upon game start and rechecked every time game's been minimized to prevent any easy shenanigans). I know what I want to generate, which is a few sets of 10 random objects from lists of objects, generate spawn locations, spawn order, and a start minute/second for when the first object would have been spawned on the current day. Well, all these are subject to change, but I have no idea how to generate all this using a seed value.

    Are there any resources you know that would be helpful? Or any suggestions or ideas on what I'm currently planning?
     
  2. Laperen

    Laperen

    Joined:
    Feb 1, 2016
    Posts:
    1,065
    Youve shared what you want to accomplish, but i doubt anyone has any idea how to respond since you have not shared what youve tried and how it failed/crashed or performed badly.

    We also have no grasp of your skill level giving us no idea what solution to give.

    As a shot in the dark however, have you went over this link?
    https://docs.unity3d.com/530/Documentation/ScriptReference/Random-seed.html
     
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847