Closed BucksTrades closed 11 months ago
It looks like you did step 1 correctly.
Next you need to run place.exe from the command line.
On the command line, start by changing the current directory to the directory that contains place.exe:
cd <path to the directory containing place.exe>
Next run place.exe and give it the path to the 'root' directory that is inside 'web'. The root directory contains the code for the web pages. place.exe needs to know where those files are located so that it can serve them when you access the website through your browser. Run place.exe like this:
place -root web/root
Note that the path that we give to place.exe is a path that is relative to the current directory. This is why we used the 'cd' command earlier to change our current directory to the directory that contains place.exe and the 'web' folder.
This should run place.exe and by default the website will be available on port 8080. If you want to expose the server on a different port, use the port argument when you run it:
place -root web/root -port :8888
okay so i followed all those steps and looks like i finished step two now but im getting this screen when i try to run the go file in visual studio code after running it in the command promt.
for step two i was in the place.go directory and used "place -root web/root" .
now I see this message on the localhost. any tips?
Try giving place the absolute path to the root folder. It should look similar to this:
place -root "C:\Users\ryan\Documents\place\web\root"
This way, no matter where you run place from, place will always be able to find the web/root folder.
you are the goat thank you for the helpful and quick responses i got it working. that last command worked copy paste lmao we share the same name that made it quite funny i was like how did he know my user file name.
i would like to add a cooldown timer to this though, i have an idea i want to use it for. do you think this could be possible for me to add or would that not work with the way this is set up?
There is already a short cooldown built into the server.
In server.go
func rateLimiter() func() bool {
const rate = 8 // per second average
If a user places more than 8 pixels per second for a sustained period of time, the server will kick them. If you wanted to, you could lower the rate to increase the cooldown.
However, if someone really wanted to, they could just have multiple tabs open or make multiple connections at the same time to avoid the cooldown. This is why I set the rate so high (8 per second). If people are going to spam pixels, I'd rather they just do it using only one connection instead of wasting more of the server's resources by trying to avoid the cooldown.
If you want to add a real cooldown, like what r/place has, you would need a way to for users to create an account and prevent users from creating multiple accounts.
I am very new to this so stay with me please, but I am trying to follow your steps on "read me" and im stuck. I believe I am doing step 1 correctly but when it comes to step two i am lost, which place file do i need to run? place.go in visual studio code, and set the port to 8080? i keep only seeing this screen on everything i do please help![Screenshot 2023-03-30 152245](https://user-images.githubusercontent.com/129437408/228942280-3225623c-ae08-4af3-a1f2-ba9405d56181.jpg)