fogleman / physarum

Physarum polycephalum slime mold simulation
MIT License
858 stars 72 forks source link

Doesn't run #2

Open dvdrbls opened 3 years ago

dvdrbls commented 3 years ago

Hi thank you for this package, used to run but not anymore, I don't know if are broken dependencies or else

ollimacp commented 3 years ago

When I run the main.go file, i get this. go run cmd/physarum/main.go cmd/physarum/main.go:8:2: cannot find package "github.com/fogleman/physarum/pkg/physarum" in any of: /usr/lib/go-1.10/src/github.com/fogleman/physarum/pkg/physarum (from $GOROOT) /home/username/go/src/github.com/fogleman/physarum/pkg/physarum (from $GOPATH)

also tryd to change "github.com/fogleman/physarum/pkg/physarum into github.com/fogleman/physarum within the main.go file cause the github repo is on this adress. Doesn't work either.

Just a few hints in the readme file would have been nice Thx

H4sh3 commented 3 years ago

This did the trick for me: Init the module: go mod init github.com/fogleman/physarum Install the stat module : go get github.com/gonum/stat

afterwards go run cmd/physarum/main.go should work.

I tried to make a branch/pull request to add a section to the readme but i don't have the permissions for that.

ollimacp commented 3 years ago

Thx :) go said it didnt know the mod command so after a quick search i needed to update go cause i had 1.10 ---> https://stackoverflow.com/questions/60410729/unknown-subcommand-mod-error-while-running-go-mod-init

after then H4sh3's instructions worked!

YukiCF commented 3 years ago

How should I fix { "resource": "/c:/Users/HP/Documents/GitHub/physarum/cmd/physarum/main.go", "owner": "_generated_diagnostic_collectionname#0", "code": { "value": "BrokenImport", "target": { "$mid": 1, "external": "https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#BrokenImport", "path": "/golang.org/x/tools/internal/typesinternal", "scheme": "https", "authority": "pkg.go.dev", "fragment": "BrokenImport" } }, "severity": 8, "message": "could not import github.com/fogleman/physarum/pkg/physarum (cannot find package \"github.com/fogleman/physarum/pkg/physarum\" in any of \n\tC:\Program Files\Go\src\github.com\fogleman\physarum\pkg\physarum (from $GOROOT)\n\tC\src\github.com\fogleman\physarum\pkg\physarum (from $GOPATH)\n\t\Users\HP\go\src\github.com\fogleman\physarum\pkg\physarum (from $GOPATH))", "source": "compiler", "startLineNumber": 8, "startColumn": 2, "endLineNumber": 8, "endColumn": 46 }

rav-en commented 3 years ago

This did the trick for me: Init the module: go mod init github.com/fogleman/physarum Install the stat module : go get github.com/gonum/stat

afterwards go run cmd/physarum/main.go should work.

I tried to make a branch/pull request to add a section to the readme but i don't have the permissions for that.

Thanks that worked great for me!

YukiCF commented 3 years ago

This did the trick for me: Init the module: go mod init github.com/fogleman/physarum Install the stat module : go get github.com/gonum/stat afterwards go run cmd/physarum/main.go should work. I tried to make a branch/pull request to add a section to the readme but i don't have the permissions for that.

Thanks that worked great for me!

I'm a bit confused on what you mean init the module?

aimsopp commented 3 years ago

as @H4sh3 Said

This did the trick for me: Init the module: go mod init github.com/fogleman/physarum Install the stat module: go get github.com/gonum/stat

afterwards go run cmd/physarum/main.go should work.

I tried to make a branch/pull request to add a section to the readme but i don't have the permissions for that.

Steps -

  1. Extract the package file to a location of your liking. Example c:\physarum-main

  2. In cmd Navigate to the extracted folder Example Type "cd c:\physarum-main" in cmd window.

  3. Run: 'go mod init github.com/fogleman/physarum'

  4. Run: 'go get github.com/gonum/stat'

  5. Run: 'go run cmd/physarum/main.go'

This will start the script. It however only generates png Images saved to the root folder c:\physarum-main. If anyone knows how to launch a viewer so that you can watch the agents work please let me know!

AnderT commented 3 years ago

Thanks to @H4sh3 and @aimsopp I got Physarum running, cheers guys : )

I carried on and got the viewer running too : )

Steps -

  1. Installed mingw-w64 > https://sourceforge.net/projects/mingw-w64/files/latest/download
  2. Added 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0' to system PATH variable
  3. Opened CMD, navigated to 'c:\physarum-main'
  4. Ran: 'go get github.com/go-gl/gl/v2.1/gl'
  5. Ran: 'go get github.com/go-gl/glfw/v3.1/glfw'
  6. Ran: 'go run cmd/viewer/main.go'

Basked in the glory of watching the agents do their thing!

dvdrbls commented 3 years ago

Thanks to @H4sh3 and @aimsopp I got Physarum running, cheers guys : )

I carried on and got the viewer running too : )

Steps -

1. Installed mingw-w64 > https://sourceforge.net/projects/mingw-w64/files/latest/download

2. Added 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0' to system PATH variable

3. Opened CMD, navigated to 'c:\physarum-main'

4. Ran: 'go get github.com/go-gl/gl/v2.1/gl'

5. Ran: 'go get github.com/go-gl/glfw/v3.1/glfw'

6. Ran: 'go run cmd/viewer/main.go'

Basked in the glory of watching the agents do their thing!

Were you able to save sequenced .png files?

YukiCF commented 3 years ago

Thanks to @H4sh3 and @aimsopp I got Physarum running, cheers guys : ) I carried on and got the viewer running too : ) Steps -

1. Installed mingw-w64 > https://sourceforge.net/projects/mingw-w64/files/latest/download

2. Added 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0' to system PATH variable

3. Opened CMD, navigated to 'c:\physarum-main'

4. Ran: 'go get github.com/go-gl/gl/v2.1/gl'

5. Ran: 'go get github.com/go-gl/glfw/v3.1/glfw'

6. Ran: 'go run cmd/viewer/main.go'

Basked in the glory of watching the agents do their thing!

Were you able to save sequenced .png files?

My apologies I'm a pretty big noob, could you go into more detail on how to do this I'm a bit confused.

AnderT commented 3 years ago

Thanks to @H4sh3 and @aimsopp I got Physarum running, cheers guys : ) I carried on and got the viewer running too : ) Steps -

1. Installed mingw-w64 > https://sourceforge.net/projects/mingw-w64/files/latest/download

2. Added 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0' to system PATH variable

3. Opened CMD, navigated to 'c:\physarum-main'

4. Ran: 'go get github.com/go-gl/gl/v2.1/gl'

5. Ran: 'go get github.com/go-gl/glfw/v3.1/glfw'

6. Ran: 'go run cmd/viewer/main.go'

Basked in the glory of watching the agents do their thing!

Were you able to save sequenced .png files?

No, I just got the viewer going.

I am new to Go, so I don't understand how it is supposed to work. But, I had a quick look and if you modify the file named 'Run.go' in the 'C:\physarum-main\pkg\physarum' directory, you can accomplish that.

The Run function starts like this:

func Run() { if false {

Just change it to:

func Run() { if true {

And it will do what you want.

AnderT commented 3 years ago

@YukiCF How far have you got? Is it just getting it to run in viewer mode?

dvdrbls commented 3 years ago

@YukiCF How far have you got? Is it just getting it to run in viewer mode?

I can see it run with the command Fogelman shared in twitter, or I can run it having individual pngs all different, but I want to save it sequenced to make a gif or a video of the physarum running

AnderT commented 3 years ago

Yes, if you edit the Run.go file as I have suggested that is what will happen.

aimsopp commented 3 years ago

Thanks to @H4sh3 and @aimsopp I got Physarum running, cheers guys : )

I carried on and got the viewer running too : )

Steps -

  1. Installed mingw-w64 > https://sourceforge.net/projects/mingw-w64/files/latest/download
  2. Added 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0' to system PATH variable
  3. Opened CMD, navigated to 'c:\physarum-main'
  4. Ran: 'go get github.com/go-gl/gl/v2.1/gl'
  5. Ran: 'go get github.com/go-gl/glfw/v3.1/glfw'
  6. Ran: 'go run cmd/viewer/main.go'

Basked in the glory of watching the agents do their thing!

I was able to get this running with your instructions! Thanks @AnderT

Do you happen to know how to change the resolution so it doesn't have to be set to a power of 2? Also I don't think this is using my GPU. Will continue to dig

AnderT commented 3 years ago

@aimsopp Hi Mate, have a look in 'C:\physarum-main\cmd\viewer\main.go' you can edit it in notepad. The 'const' section has a bunch of parameters you can play with, including the size of the canvas.

const ( width = 512 < Change Here height = 512 < And Here particles = 1 << 20 blurRadius = 1 blurPasses = 1 zoomFactor = 1 scale = 1 gamma = 1 / 2.2 title = "physarum" )

Also have a look in 'C:\physarum-main\pkg\physarum\config.go', there are things to play with here also : )

const ( sensorAngleMin = 15 sensorAngleMax = 15 sensorDistanceMin = 5 sensorDistanceMax = 10 rotationAngleMin = 0 rotationAngleMax = 100 stepDistanceMin = 2 stepDistanceMax = 5 depositionAmountMin = 1 depositionAmountMax = 5 decayFactorMin = 0.1 decayFactorMax = 0.2 attractionFactorMean = 1 attractionFactorStd = 0.25 repulsionFactorMean = -1 repulsionFactorStd = -0.25 )

aimsopp commented 3 years ago

@AnderT Currently using Visual Code. I have already gone through updating a bunch of settings. However I think my main goal would be to change the resolution to 1920 X 1080 and also save each frame off in a sequence to a specific folder to be able to compile those images into a video or a gif. I want to try and apply this as a skin to a 3d model. I'm already able to do this with go run cmd/physarum/main.go

AnderT commented 3 years ago

@aimsopp Starting to get a bit beyond my Go skills, this is the first time I have played with it.

I got here from > https://www.youtube.com/watch?v=X-iSQQgOd1A

He is going to release his code in April and I am thinking I may want to do something in DotNet and have it running on the GPU.

18Markus1984 commented 3 years ago

I can run the

Thanks to @H4sh3 and @aimsopp I got Physarum running, cheers guys : ) I carried on and got the viewer running too : ) Steps -

  1. Installed mingw-w64 > https://sourceforge.net/projects/mingw-w64/files/latest/download
  2. Added 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0' to system PATH variable
  3. Opened CMD, navigated to 'c:\physarum-main'
  4. Ran: 'go get github.com/go-gl/gl/v2.1/gl'
  5. Ran: 'go get github.com/go-gl/glfw/v3.1/glfw'
  6. Ran: 'go run cmd/viewer/main.go'

Basked in the glory of watching the agents do their thing!

I was able to get this running with your instructions! Thanks @AnderT

Do you happen to know how to change the resolution so it doesn't have to be set to a power of 2? Also I don't think this is using my GPU. Will continue to dig

I got the image produccer running, but the viewer doesn't want to work. the problem is that the respositories for the glfw and gl doesn't exsist any more i tried to use the master repository but that doesn't help. grafik

bartman081523 commented 2 years ago

I also had to install these packages on ubuntu:

sudo apt install libgl1-mesa-dev libxcursor-dev libxinerama-dev libxxf86vm-dev