public RandomRoom(int posX, int posY, int minWidth, int maxWidth, int minHeight, int maxHeight, RandomSeed randomSeed =null) { this.minWidth = minWidth; this.maxWidth = maxWidth; this.minHeight = minHeight; this.maxHeight = maxHeight; x = posX; y = posY; if(r == null) { r = new RandomSeed(DateTime.Now.Millisecond); } else { r = randomSeed; } width = r.getIntInRange(minWidth, maxWidth); height = r.getIntInRange(minHeight, maxHeight); initializeBitmap(0); center = new Vector2(x + (width/2), y + (height/2)); breakables = new System.Collections.Generic.List<Vector2>(); exits = new System.Collections.Generic.List<Vector2>(); }
void Start() { r = new RandomSeed(DateTime.Now.Millisecond); //First we create the buffer. This will contain all our sprites buffer = new GameObject[NUM_LAYERS,WIDTH,HEIGHT]; //Second, we find a pointer to the level data LD_Cave ld = new LD_Cave(WIDTH, HEIGHT, r.getSeed(),new Vector2(0,0)); //LD_Dungeon ld = new LD_Dungeon(WIDTH, HEIGHT, r.getSeed(), new Vector2(0,0)); ld.generate(); //Next, we generate a color palette palette = new Palette(r); //Third, we translate the level into sprites for(int layer = 0; layer < NUM_LAYERS; layer++) { for(int y = 0; y < HEIGHT; y++) { for(int x = 0; x < WIDTH; x++) { buffer[layer,x,y] = makeSprite(x,y,ld.mapData[layer,x,y],layer); //ld.mapData[layer,x,y] }//for }//for }//for }
protected void btnRegister_Click(object sender, EventArgs e) { try { BookReviewDbEntities db = new BookReviewDbEntities(); RandomSeed rs = new RandomSeed(); int seed = rs.GetSeed(); PasswordHash ph = new PasswordHash(); Byte[] hashed = ph.HashIt(txtPassword.Text, seed.ToString()); Reviewer rev = new Reviewer(); rev.ReviewerFirstName = txtFirstName.Text; rev.ReviewerUserName = txtUserName.Text; rev.ReviewerLastName = txtLastName.Text; rev.ReviewerEmail = txtEmail.Text; rev.ReviewerDateEntered = DateTime.Now; rev.ReviewPlainPassword = txtPassword.Text; rev.ReviewerKeyCode = seed; rev.ReviewerHashedPass = hashed; db.Reviewers.Add(rev); db.SaveChanges(); lblErrorSuccess.Text = "Reviewer Saved"; } catch(Exception ex) { lblErrorSuccess.Text = ex.Message; } }
public AStar(int width, int height) { w = width; h = height; //MAKE THE ARRAY OF COORDINATES SO THAT WE SEARCH THEM IN THE RIGHT ORDER coords = new System.Collections.Generic.List<Vector2>(); coords.Add(new Vector2(0,-1)); // UP coords.Add(new Vector2(1,0)); // RIGHT coords.Add(new Vector2(0,1)); // DOWN coords.Add(new Vector2(-1,0)); // LEFT if(allowDiagonals) { coords.Add(new Vector2(-1,-1)); // UP-LEFT coords.Add(new Vector2(1,-1)); // UP-RIGHT coords.Add(new Vector2(1,1)); // DOWN-RIGHT coords.Add(new Vector2(-1,1)); // DOWNLEFT } relCurrent = new Vector2(); relLast = new Vector2(); startNode = new GridNode(); endNode = new GridNode(); open = new NodeList(w*h); closed = new NodeList(w*h); createGrid(w,h); r = new RandomSeed(THE_SEED); }
void CreateRandomSeedWidget(GimpTable table) { var seed = GetVariable<UInt32>("seed"); var randomSeed = GetVariable<bool>("random_seed"); var seedWidget = new RandomSeed(seed, randomSeed); table.AttachAligned(0, 0, _("Random _Seed:"), 0.0, 0.5, seedWidget, 2, true); }
void Start() { long seed = System.DateTime.Now.Ticks; r = new RandomSeed(seed); r.getBoolean(); database = new StoryDatabase(journeyFiles); print(database.ToString()); }
public AdvancedDialog(Variable<UInt32> seed, Variable<bool> randomSeed) : base(_("Advanced Settings"), _("Splitter")) { var table = new GimpTable(1, 2, false) { BorderWidth = 12, ColumnSpacing = 6, RowSpacing = 6}; VBox.PackStart(table, true, true, 0); var random = new RandomSeed(seed, randomSeed); table.AttachAligned(0, 0, _("Random _Seed:"), 0.0, 0.5, random, 2, true); }
public System.Collections.Generic.List<Vector2> createListOfRadomPoints(int numPoints = 10) { RandomSeed r = new RandomSeed(DateTime.Now.Millisecond); // Make a new seeded randomizer System.Collections.Generic.List<Vector2> points = new System.Collections.Generic.List<Vector2>(); for (int i=0; i < numPoints; i++) { Vector2 point = new Vector2(); point.x = r.getFloatInRange(0.0f, (float)numPoints); point.y = r.getFloatInRange(0.0f, (float)numPoints); points.Add(point); }//foreach return points; }
public LD_Dungeon(int width, int height, double seed,Vector2 returnSpot) { this.seed = seed; r = new RandomSeed(seed); this.width = width; this.height = height; type = LevelData.TYPE_DUNGEON; astar = new AStar(this.width, this.height); this.parentStartLocation = returnSpot; this.fogClearRadius = r.getIntInRange(4,6); COLLISION = AsciiMapSymbols.MOUNTAIN; }
public Dialog(Drawable drawable, VariableSet variables) : base(_("Swirlies"), drawable, variables, () => new AspectPreview(drawable)) { _progress = new ProgressBar(); Vbox.PackStart(_progress, false, false, 0); var table = new GimpTable(4, 3, false) {ColumnSpacing = 6, RowSpacing = 6}; Vbox.PackStart(table, false, false, 0); var seed = new RandomSeed(GetVariable<UInt32>("seed"), GetVariable<bool>("random_seed")); table.AttachAligned(0, 0, _("Random _Seed:"), 0.0, 0.5, seed, 2, true); new ScaleEntry(table, 0, 1, _("Po_ints:"), 150, 3, GetVariable<int>("points"), 1.0, 16.0, 1.0, 8.0, 0); }
public LD_Cave(int width, int height, double seed,Vector2 returnSpot) { this.seed = seed; r = new RandomSeed(seed); this.width = width; this.height = height; type = LevelData.TYPE_CAVE; astar = new AStar(this.width, this.height); this.startLocation = new Vector2(width/2, height/2); // START IN THE MIDDLE? this.parentStartLocation = returnSpot; this.fogClearRadius = r.getIntInRange(2,5); COLLISION = AsciiMapSymbols.MOUNTAIN; //this.isFoggy = false; }
public LevelData(int width,int height, double seed, int theType) { this.seed = seed; r = new RandomSeed(seed); //SET THE COLOR FOR MY ASCII TEXT THING UColor.HSL theMainColor = new UColor.HSL((float)r.getRandom(),0.7f,0.3f); //Choose a main color MainColor = theMainColor.toColor(); this.width = width; this.height = height; type = theType; md = new AsciiMapSymbols(type, MainColor); astar = new AStar(this.width, this.height); this.startLocation = new Vector2(width/2, height/2); this.parentStartLocation = startLocation; clearTo(0); }
public PseudoLinearLevel(uint levelWidth, uint levelHeight, uint numberOfLG_Rooms, uint minLG_RoomWidth, uint maxLG_RoomWidth, uint minLG_RoomHeight, uint maxLG_RoomHeight, uint theTileWidth, uint theTileHeight, RandomSeed randSeed = null, uint roomSpacing = 3) { if(randSeed == null) { r = new RandomSeed(DateTime.Now.Millisecond); } else { r = randSeed; }//else rooms = new System.Collections.Generic.List<LG_Room>(); borderThickness = (uint)roomSpacing; rooms_sorted = new System.Collections.Generic.Dictionary<Vector2, LG_Room>(); roomCenterPoints = new System.Collections.Generic.List<Vector2>(); roomConnections = new System.Collections.Generic.List<Edge>(); tileWidth = theTileWidth; tileHeight = theTileHeight; //super(levelWidth, levelHeight); width = (int)levelWidth; height = (int)levelHeight; //AStar.grid_width = tileWidth; //AStar.grid_height = tileHeight; astar = new AStar(width, height); initializeBitmap(1); placeLG_Rooms((int)minLG_RoomWidth, (int)maxLG_RoomWidth, (int)minLG_RoomHeight, (int)maxLG_RoomHeight, (int)numberOfLG_Rooms); digHallways(); //findStartAndEnd(); //findCriticalPath(); setupAstar(); doSetupLogic(); }
public Vector2 getRandomCorridorCell(RandomSeed r = null) { System.Collections.Generic.List<Vector2> corridorCells = new System.Collections.Generic.List<Vector2>(); for(int yy = 0; yy < height; yy++) { for(int xx = 0; xx < width; xx++) { if(bitMap[xx,yy] == 1) { corridorCells.Add(new Vector2(xx,yy)); }//if }//for }//for if(r == null) { r = new RandomSeed(DateTime.Now.Ticks/TimeSpan.TicksPerMillisecond); }//if return corridorCells[r.getIntInRange(0, corridorCells.Count-1)]; }
public void GenerateRandom() { List<string> randomNames = new List<string> (); randomNames.Add ("Alpha"); randomNames.Add ("Beta"); randomNames.Add ("Gamma"); randomNames.Add ("Delta"); randomNames.Add ("Epsilon"); randomNames.Add ("Zeta"); randomNames.Add ("Eta"); randomNames.Add ("Theta"); randomNames.Add ("Iota"); randomNames.Add ("Kappa"); randomNames.Add ("Lambda"); randomNames.Add ("Mu"); randomNames.Add ("Nu"); randomNames.Add ("Ksi"); randomNames.Add ("Omicron"); randomNames.Add ("Pi"); randomNames.Add ("Rho"); randomNames.Add ("Sigma"); randomNames.Add ("Tau"); randomNames.Add ("Upsilon"); randomNames.Add ("Phi"); randomNames.Add ("Khi"); randomNames.Add ("Psi"); randomNames.Add ("Omega"); this.randomizer = null; this.squarePoll = null; List<PlanetSquare> tmpPoll = new List<PlanetSquare> (this.SquarePoll); for (int i = 1; i <= 10; i++) { if ((this.Randomizer.Rand (i) / 2f + 0.5f) < this.planetRate) { Planet p = GameObject.Instantiate<Planet> (this.PlanetTemplate); int nameIndex = Mathf.FloorToInt(Mathf.Abs(this.Randomizer.Rand (4 * i) * tmpPoll.Count * 42)) % randomNames.Count; string planetName = randomNames [nameIndex]; randomNames.RemoveAt (nameIndex); int size = Mathf.RoundToInt (7.5f + 1.5f * this.Randomizer.Rand (5 * i)); int pollIndex = Mathf.FloorToInt(Mathf.Abs(this.Randomizer.Rand (2 * i) * tmpPoll.Count * 42)) % tmpPoll.Count; PlanetSquare sTemplate = tmpPoll [pollIndex]; tmpPoll.Remove (sTemplate); float orbitAlpha = (this.Randomizer.Rand (3 * i) + 1) * 180f; float orbitDist = i * 50000f; int heightRangePercent = Mathf.RoundToInt (10f + 5f * this.Randomizer.Rand (6 * i)); float atmDensity = 1f + 1f * this.Randomizer.Rand (7 * i); int atmRangePercent = Mathf.RoundToInt (20f + 10f * this.Randomizer.Rand (8 * i)); float gravIntensity = 10f + (size - 6) * 5 + 4f * this.Randomizer.Rand (9 * i); gravIntensity = Mathf.Max (gravIntensity, 1f); p.Setup (planetName, sTemplate, size, orbitDist, orbitAlpha, gravIntensity, atmDensity, atmRangePercent, heightRangePercent); p.Initialize (); } } }
void CreateRandomEntry(VBox vbox) { var table = new GimpTable(1, 3) {ColumnSpacing = 6, RowSpacing = 6}; vbox.Add(table); var seed = new RandomSeed(GetVariable<UInt32>("seed"), GetVariable<bool>("random_seed")); table.AttachAligned(0, 0, _("Random _Seed:"), 0.0, 0.5, seed, 2, true); }
public void randomStartAndEnd(int seed = -1) { if(seed>-1) { r = new RandomSeed(seed); } startNode = grid[r.getIntInRange(0,w-1),r.getIntInRange(0,h-1)]; endNode = grid[r.getIntInRange(0,w-1),r.getIntInRange(0,h-1)]; startNode.squareType = GridNode.WALKABLE; endNode.squareType = GridNode.WALKABLE; }
public ForestOverworldLevel(RandomSeed randSeed, int levelWidth, int levelHeight, int startAreaSize, int rockiness, int treeDensity ) { if(randSeed == null) { r = new RandomSeed(DateTime.Now.Millisecond); Debug.Log("ForestOverworldLevel.cs got a broken random seed request."); } else { r = randSeed; }//else ld = new LevelData(levelWidth, levelHeight, r.getSeed(), LevelData.TYPE_FOREST); ld.fogClearRadius = 3; ld.COLLISION = MOUNTAIN; //ld.isFoggy = false; //SET THE TEXT BUFFER COLOR //TextBuffer.MainColor = ld.changeMainColor(ld.getMainColor()); //--------------------------------------// //PUT LEVEL GENERATION CODE HERE //--------------------------------------// BlankMap(); // SET IT ALL TO 0 TO START WITH (UNWALKABLE) placeMountains(rockiness); //Ring the area with mountains and put a few scattered mountains in OutlineMap(LevelData.BASELAYER,MOUNTAIN); // Outline the map with a blocking or warping tile placeRivers(); //Rivers are uncrossable except at bridges and come with walkable space on one or both sides placeForests(treeDensity); //Put down a thick layer of trees all over placeStartArea(startAreaSize); //The start is a safe zone. Needs to know what side of the river it's on. //////////////////////////////////////////////////////////////// ////////////////////////////PLACE LOCATIONS/////////////////////// //////////////////////////////////////////////////////////////////// //placeSetPieces(); //Stamp all outdoor "dungeons", no load -- just content (huts, lakes, camps, etc) placeDungeons(); //You go inside these (dungeons (LD_DUNGEON) and caves (LD_CAVE)) //placeZoneExits(); // UGH. Maybe to make the game infinite. Maybe... //////////////////////////////////////////////////////////////// ////////////////////////////QUEST STUFF/////////////////////////// //////////////////////////////////////////////////////////////////// //placeTutorial(); //Takes the player up to getting the axe and the boat (to prevent getting stuck) //placeCriticalPath(); //From the list of set pieces and dungeons, place the critical path quests (post-tutorial) //placeMajorOptionalLines(); // From the remaining set pieces and dungeons, choose the optional quest lines //placeStubs(); // Anything left gets a stub quest that points to it and a reward at the end //////////////////////////////////////////////////////////////// ////////////////////////////STORY STUFF/////////////////////////// //////////////////////////////////////////////////////////////////// //setMetadata(); // Go through all the quests and generate/mark the necessary story metadata. //--------------------------------------// //--------------------------------------// //setupAstar(); // Set the a-star grid to be equal to the newly generated overworld level (needed?) }
public void ResetRandomizer() { this.randomizer = null; }
void Start() { long seed = System.DateTime.Now.Ticks; r = new RandomSeed(seed); player = GameObject.Find("Player"); //tiles = new Transform[1]; PseudoLinearLevel psl = new PseudoLinearLevel((uint)numberOfTilesWide,(uint)numberOfTilesHigh,(uint)numberOfLG_RoomsToSpawn, (uint)minimumLG_RoomWidthInTiles,(uint)maximumLG_RoomWidthInTiles, (uint)minimumLG_RoomHeightInTiles,(uint)maximumLG_RoomHeightInTiles, 1,1,r,4); //This line isn't really useful but has to be here string baseMap = psl.toReadableMap(); print("SEED:" + seed + "\n" +"--CLICK HERE FOR PRINTED ASCII MAP--\n"+ baseMap); place3DFloorTilesTest(psl); placeFurnitureTest(psl); placeEnemyTest(psl); }
public void ReCompute() { this.randomizer = null; this.heightMapRange = StellarSystem.squareLength * Mathf.FloorToInt(Mathf.Pow (2f, this.maxSubDegree)) + 1; this.radius = 2f * this.heightMapRange / Mathf.PI * StellarSystem.TileSize; this.heightRange = this.radius * this.heightRangePerCent / 100f; this.atmRange = this.radius * this.atmRangePerCent / 100f; this.Grav.mass = this.gravIntensity * this.radius * this.radius; }
public void randomCover(int seed = -1) { if(seed>-1) { r = new RandomSeed(seed); } else { r = new RandomSeed(this.THE_SEED); } for(int i = 0; i < ((w*h) * COVER_SCATTER); i++) { int x = r.getIntInRange(1,w-2); int y = r.getIntInRange(1,h-2); (grid[x,y] as GridNode).squareType = GridNode.UNWALKABLE; } }
public Palette(RandomSeed r) { makePalettes(UColor.RandomColor(r)); }
void Start() { levels = new LevelData[MAX_LEVELS]; numLevels = 0; //long seed = 635174884170085700; long seed = System.DateTime.Now.Ticks; r = new RandomSeed(seed); //TextBuffer.createBackgroundTexture(Color.white); // CREATE A TEXTURE OF THE APPROPRIATE BACKGROUND COLOR //Debug.Log("TB_B " + bgHSL.Hue + "," + bgHSL.Saturation + "," + bgHSL.Lightness); startingAreaSize = 4; ol = new ForestOverworldLevel(r,numberOfTilesWide, numberOfTilesHigh, startingAreaSize, 45,35); currentLevel = ol.ld; //Helper.overworldLevelData = ol.ld; //Helper.startPos = ol.ld.startLocation; //TextBuffer.MainColor = ol.ld.MainColor; GameObject player = GameObject.FindGameObjectWithTag("Player"); Helper.pPlayer = player.GetComponent<PlayerScript>(); Helper.pPlayer.teleport((int)ol.ld.startLocation.x, (int)ol.ld.startLocation.y); ////////////////////////////////////////////// ol.ld.updateCollision(); //List<Color> compc = UColor.SplitCompliments(new Color(1.0f,0.0f,1.0f,1.0f)); //foreach(Color c in compc) //print(c.ToString()); }
public static Color RandomColor(RandomSeed r = null) { if(r == null) { r = new RandomSeed(DateTime.Now.Millisecond); Debug.Log("ForestOverworldLevel.cs got a broken random seed request."); } //SET THE COLOR FOR MY ASCII TEXT THING UColor.HSL theMainColor = new UColor.HSL((float)r.getRandom(),0.7f,0.3f); //Choose a main color Color color = theMainColor.toColor(); return color; }