FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál

Is there any method to perform this action automatically or all at once? [closed]

I would like to know if there is a way to build a js, a script for the following: https://www.chunkbase.com/apps/seed-map#seed=999&platform=bedrock_1_21&dimension=overworld&x=1214&z=-353&zoom=0.82 so that with a single key combination, or just by pressing a button, all the generated coordinates can be selected and displayed on the screen, if possible, functional for Tampermonkey

  • ✇Recent Questions - Game Development Stack Exchange
  • Why is my perlin-noise generated texture a uniform grey?FNaF_Master109
    I'm following Brackeys' tutorial for perlin noise and i'm at the point where he's just done the offset thing but this whole time all that i'm seeing in my project is a plain gray square, no matter what settings i change. Here's my code: using UnityEngine; public class PerlinNoise : MonoBehaviour { public int width = 256; public int height = 256; public float scale = 20f; public float offsetX = 100f; public float offsetY = 100f; void Update () { Renderer re
     

Why is my perlin-noise generated texture a uniform grey?

I'm following Brackeys' tutorial for perlin noise and i'm at the point where he's just done the offset thing but this whole time all that i'm seeing in my project is a plain gray square, no matter what settings i change. Here's my code:

using UnityEngine;

public class PerlinNoise : MonoBehaviour
{
    public int width = 256;
    public int height = 256;

    public float scale = 20f;

    public float offsetX = 100f;
    public float offsetY = 100f;

    void Update ()
    {
        Renderer renderer = GetComponent<Renderer>();
        renderer.material.mainTexture = GenerateTexture();
    }

    Texture2D GenerateTexture ()
    {
        Texture2D texture = new Texture2D(width, height);

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                Color color = CalculateColor(x, y);
                texture.SetPixel(x, y, color);
            }
        }

        texture.Apply();
        return texture;
    }

    Color CalculateColor (int x, int y)
    {
        float xCoord = (float)x / width * scale + offsetX;
        float yCoord = (float)y / height * scale + offsetY;

        float sample = Mathf.PerlinNoise(x, y);
        return new Color(sample, sample, sample);
    }
}

Here's the result i get: A gray square with no visible noise.

and here's the settings in the editor: Unity editor script settings.

  • ✇Recent Questions - Game Development Stack Exchange
  • Connecting Isolated Paths in Randomly Generated MapsBishnu Chalise
    I am new to game development, I previously created games using tiledmap editor and pygame, but manually creating map was real pain, so i begun to look how can i procedurally generate map, after banging head for few week and googling i finally created a map. However, I'm facing an issue where some paths on the map end up isolated from each other. I'm looking for suggestions or algorithms to connect these isolated parts of the map, ensuring that there is always a continuous path from any point to
     

Connecting Isolated Paths in Randomly Generated Maps

I am new to game development, I previously created games using tiledmap editor and pygame, but manually creating map was real pain, so i begun to look how can i procedurally generate map, after banging head for few week and googling i finally created a map. However, I'm facing an issue where some paths on the map end up isolated from each other. I'm looking for suggestions or algorithms to connect these isolated parts of the map, ensuring that there is always a continuous path from any point to any other point on the map. The code works on looking at adjacent neighbour but in the end most of the time it cause isolation of part of map by closing path.

from random import random
from pprint import pprint, pformat

WALL = 1
EMPTY = 0
POSSIBLE_WALL_PERCENT = 0.4
ADJACENT_WALL_THRESHOLD = 5
range_X = 1
range_Y = 1

class Map:
    def __init__(self, width: int, height: int):
        self.width = width
        self.height = height
        self.grid = [[EMPTY for _ in range(width)] for _ in range(height)]

        self.random_wall_fill()
        self.place_walls()

    def random_wall_fill(self):
        for row in range(self.height):
            for col in range(self.width):
                if random() < POSSIBLE_WALL_PERCENT:
                    self.grid[row][col] = WALL

    def get_adjacent_wall(self, x: int, y: int, range_x: int, range_y: int):
        wall_count: int = 0
        start_x, end_x = x - range_x, x + range_x
        start_y, end_y = y - range_y, y + range_y  

        for i_y in range(start_y, end_y + 1):
            for i_x in range(start_x, end_x + 1):
                if (i_x != x or i_y != y) and self.is_wall(i_x, i_y):
                    wall_count += 1

        return wall_count

    def place_walls(self):
        for y in range(self.height):
            for x in range(self.width):
                if self.grid[y][x] == EMPTY:
                    if self.place_wall_logic(x, y):
                        self.grid[y][x] = WALL

    def place_wall_logic(self, x, y):
        num_walls = self.get_adjacent_wall(x, y, range_X, range_Y)
        if num_walls >= ADJACENT_WALL_THRESHOLD:
            return True
        else:
            return False

    def is_wall(self, x: int, y: int):
        if self.out_of_bound(x, y):
            return True
        elif self.grid[y][x] == WALL:
            return True
        return False

    def out_of_bound(self, x: int, y: int):
        if x < 0 or x >= len(self.grid[0]):
            return True
        elif y < 0 or y >= len(self.grid):
            return True
        return False

    def display_map(self):
        for row in self.grid:
            for cell in row:
                if cell == WALL:
                    print("0", end=" ")
                else:
                    print(".", end=" ")
            print() 

    def __repr__(self):
        return pformat(self.grid)

level_map = Map(30, 30)
level_map.display_map()

map screenshot

  • ✇Recent Questions - Game Development Stack Exchange
  • How do I connect city centers in a realistic wayYANNTASTIC5915
    I am making a FPS/RPG exploration game (first person shooter RPG, think first person Zelda with guns), and one of the main focuses is a large city. Due to the fact that I am an indie dev, and don't have the time to make an entire city, and also the fact that I have previous experience with procedural generation (not cities though), I've decided that I'd like to use it to save time. I was reading this post, and it said to make a city you need: City centers: Pick some points of the still empty m
     

How do I connect city centers in a realistic way

I am making a FPS/RPG exploration game (first person shooter RPG, think first person Zelda with guns), and one of the main focuses is a large city.

Due to the fact that I am an indie dev, and don't have the time to make an entire city, and also the fact that I have previous experience with procedural generation (not cities though), I've decided that I'd like to use it to save time.
I was reading this post, and it said to make a city you need:

  1. City centers: Pick some points of the still empty map as main traffic nodes. They should be evenly distributed around the map
  2. Highways: Connect the main traffic nodes to their neighbors and to the outside world using major roads.

(And the rest from the post.)

An example of what I’d like is this: city.png

My question is:
How do I calculate which city centers to connect to each other, to provide a realistic city?

By distance?
Add a weight or size to each one?
Only allow each centre to have 2 connections?

❌
❌