How do games like dead rails make infinite baseplates

games like dusty trip and dead rails like make an infinite sand baseplate, i could do it with a local script but then the server sided npcs wont have the same effect

2 Likes

same method you were thinking about on using with a localscript, make it for a server script.

you were thinking of aligning your baseplate with your player in a localscript. just do a server script which makes multiple baseplates for every player.

also, make sure to not have multiple baseplates when players are very near eachother.
i would probably suggest you make a function that gets all the player characters and returns
an array of positions of them. but if they find very close players, instead of having two different positions, one for each player, it adds the median position to the result array. hope you can understand what im saying, i could help you if you need me to

ye i can do server for each player but i dont understand the multiple thingy when together cuz they mostly together anyways

positions that are very close to eachother will merge, if there is no very close it just adds to the result array. (also i made this with chatgpt very fast, im not 100% sure it works but ill read and test after i sent this message lol)

function GetBaseplatePositions(base_positions) -- returns an array of the baseplates position
	local result = {} -- initialize the result array
	local visited = {} -- positions already visited

	local THRESHOLD = 250 -- if two positions are below THRESHOLD studs of distance, they will merge 

	for i = 1, #base_positions do
		if not visited[i] then
			local cluster = {base_positions[i]}
			visited[i] = true

			for j = i + 1, #base_positions do
				if not visited[j] then
					if (base_positions[i] - base_positions[j]).Magnitude <= THRESHOLD then
						table.insert(cluster, base_positions[j])
						visited[j] = true
					end
				end
			end

			-- Calculate median position
			local sum = Vector3.new(0, 0, 0)
			for _, pos in ipairs(cluster) do
				sum += pos
			end
			local median = sum / #cluster
			table.insert(result, median)
		end
	end
	
	return result -- return the positions
end
```
1 Like

ok

it does work (not the most efficent but its far from having any impact on your game) here is a test place i tried on
baseplates_thingy.rbxl (56.5 KB)

you just put some random parts on one folder and it will generate the right positions when you run the game on the other folder (you have to addapt the system to characters)

where do u call the function?

wdym? on your game?

in your game, you should grab every characters position, put it in a array and send it to the function. you should call the function on a loop (something like 5 second delay) and just re-position the baseplates you should have in a folder. (this method doesnt work 100% with textures, but if you round position to the texture tile size, you should be fine)

so a table with every characters pos in vector3?

yea, pretty much. the character is a model so it doesnt have the “Position” property but you could use this to get the vector3 positon:

Character:GetPivot().Position

im looking in ur script so is median the pos or a number

the median is the median position between two vector3 positions.

pretty much the exact half point between them

so median is a vector3? im dumb

yea lol, look at the example, the red cubes represent 3 vector3 positions, the function returned the median position between them:

image

(but if the red cube was very isolated between the rest, it would just return their position)

oh ok so where do. i keep the baseplates

you should have a template baseplate stored somewhere, a folder in the workspace for all the baseplates. and a loop which re-positions/creates new baseplates if a player becomes isolated/deletes a baseplate if the player position merges with another.

if you dont understand this. just send it to chatgpt and he will figure it out lol

if the player crosses a certain distance reposition the baseplate and occasionally spawn some structures to give the illusion of the world actually being infinite

ye but its multiplayer soo multiple baseplats?

Just do it on the client.

Ehejsnrkskfjrozk

server sided npcs