nusco / narjillos

Artificial creatures that mutate and evolve.

Home Page:http://nusco.github.io/narjillos/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reverse scrolling with mouse on Linux

mpapis opened this issue · comments

would be nice if you could detect linux and reverse the scrolling with mouse, btw. how do I zoom out?

zoom in/out with scroll, might be also reversed and might need improvement as even my fast scrolling logiteh mouse has problems, how about to speed up?

On a Mac, I scroll (pan) with the cursor keys and zoom in/out with the trackpad. On Linux - I don't know, it depends on Java's idea of how the mouse should behave. I'll definitely try it on Linux to get an idea of how the mouse works, and tweak the scroll speed. I should probably externalize that stuff in a config file anyway.

Oh, and thanks for opening issues! That's much appreciated. I wasn't expecting to make this thing public, so you'll have to be tolerant about its current state - especially things such as usability and the interface.

I was curious if it would work on my machine, the only bad thing for now is the TPS, max I have seen was 17, it might be caused by the graphics as FPS is also very low, max FPS seen is 25 at quite big zooms, but when I get full zoom out - FPS: 5-7, TPS: 6-10

FPSs are capped at 25 to avoid eating into TPS, but you're right that these numbers look low, and it might be because of the graphics. (My system is an old 2.4Ghz dual-core - not exactly a speed demon).

If you want to try it without graphics:

git pull
./gradlew build
experiment 12345

It will take two-three minutes to get the first log report. Look at the third column (ticks_per_second). On my system, it's around 60.

(BTW, if you want to run without graphics, then you'll probably want to check what the most typical creature looks like at some time. You can copy the DNA from the experiment log, and run petri with the DNA as an argument, like:

petri {168_069_105_153_210_252}{115_095_077_152_237_203}{178_018_078_062_117_150}{006_226_192_056_253_008}{052_005_081_189_164_059}{229_220_102_020_133_181}{000_204_079_198_198_174}

This will give you a Petri dish populated with clones of that creature.)

my system is newer, but my low power cpu might be part of the issue:

$ cat /proc/cpuinfo | grep -E 'processor|model name'
processor       : 0
model name      : Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
processor       : 1
model name      : Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
processor       : 2
model name      : Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
processor       : 3
model name      : Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz

and only one core is used, is there any way to run some code in parallel?

here are results from experiment:

time, ticks, ticks_per_second, narjillos, food_pieces, most_typical_dna
204, 10000, 39, 641, 11, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
497, 20000, 30, 835, 5, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
855, 30000, 26, 870, 8, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
1082, 40000, 52, 572, 6, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
1272, 50000, 53, 576, 6, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
1472, 60000, 46, 597, 4, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
1680, 70000, 37, 608, 6, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
1905, 80000, 48, 584, 4, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
2109, 90000, 51, 607, 1, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
2306, 100000, 50, 583, 3, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
2504, 110000, 50, 592, 4, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
2706, 120000, 53, 545, 6, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
2902, 130000, 52, 556, 4, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
3104, 140000, 50, 562, 6, {080_084_133_163_023_239}{014_235_237_087_119_173}{150_027_096_090_074_048}{091_050_244_127_242_177}
3314, 150000, 46, 618, 4, {080_084_133_163_023_239}{014_235_237_087_125_173}{150_027_096_090_074_048}{091_050_244_127_214_177}
3542, 160000, 42, 651, 4, {080_084_133_163_023_239}{014_235_237_087_125_173}{150_027_096_090_074_048}{091_050_244_127_214_177}
3776, 170000, 43, 666, 5, {080_084_133_163_023_239}{014_235_237_087_125_173}{150_027_096_090_074_048}{091_050_244_127_214_177}

Yup, it's just because of the GHzs. 40 TPS is not too shabby, however. I should probably parameterize the FPS cap, to give you more control over the trade-off when you use graphics.

I did try to make it parallel and take advantages of multiple cores. That was giving me a headache. I really don't like Java's multithreading---it's invasive, hard to predict and easy to get wrong. I ended up going single-thread. (Plus the graphics rendering, which takes another core if you turn on graphics).

I'll probably keep all the critters in one thread, and use the other cores for future features, like space partitioning and neural networks --- if I ever get there. I also have a vague plan to make the whole thing multi-process instead. Multiple Petri dishes, with creatures migrating from one to the other by networking themselves over.

I couldn't try it on Linux yet. Any comments on the interface? Is scrolling/zooming broken, and how?

(BTW, @mpapis, thank you so much for your help on this thing). 😃

It was great fun to play with narjillos but unfortunately it does not turn me on that much lately, time to switch to other tasks, you can close the ticket / split it in smaller tasks.

Hey, Michal... I wasn't even expecting you were still playing with it. :) If you kept after our first messages, I'd love to get your opinion on what was fun, what wasn't, and so on.

I'm still kinda obsessed by this idea. I made a few changes to the physics, and evolved some pretty wild things. The pointers you gave me are in the backlog.txt, so I'm not going to forget about them. Before looking at niceties like Linux performance, I want to finish the DNA ancestry analyzers first.

Thanks a lot for your comments, man!

it's great fun to watch for short time, but you can get bored quite fast by lack of progress, the few things I was thinking on:

  1. smaller dish - less narjillos - faster speedy mode
  2. add a way to print n most common narjillos DNA when running experiment. maybe press n to get 5 most common DNAs and they %

Yup, that's an issue with all these evolution simulators... Great fun in the beginning, but then they require real passion as one "species" takes over and evolution slows down to a crawl.

Suggestion 1: you're right, that should be easy to configure by editing a JSON file or something.

Suggestion 2: This is a bit harder to pull off, 'cause the first most common DNA tend to be almost identical - that's what makes them the most common. ;) I implemented this thing to decide which DNA is the most common. But I agree that I need to add a quicker way to make sense of what is happening on a DNA level.

Thanks again, and looking forward to meet again!