Jump to content

luziferius

Community Members
  • Posts

    64
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by luziferius

  1. Quote

    Unfortunately, I was not able to set up a networked game, as it would just timeout when trying to connect whether through direct connect or the lobby probably something wrong with the network there.

    The reason multiplayer didn’t work is likely that wireless client isolation (for an example, see https://documentation.meraki.com/MR/Firewall_and_Traffic_Shaping/Wireless_Client_Isolation) was enabled in the network settings.

    This option exist so that devices can’t bother each other and prevent hackers from abusing bad configurations on other machines. It should be enabled on all kind of public networks, except for explicit LAN-party settings. It prevents client-to-client communication by dropping all client packets not targetting the default gateway, thus rendering any kind of local multiplayer impossible.

    So the best bet is to bring your own networking hardware with you, for example any kind of non-OEM consumer router that can operate on it’s own without remote configuration. Then connect the PCs via LAN. If needed (because of lacking wired interfaces), you could open your own, secured wifi network, named for example “0ad Multiplayer”. When doing Wifi access points, it is polite to ask the event’s network admin for permission, because it can cause congestion issues and throw off their channel mapping across the area.

  2. you may also use windowed full screen

    then the window manager just removes the borders, sets the window’s resolution to that of the monitor and puts it on top.

    for KWin (KDE 4) I know a way to always run 0ad in this mode(I use it and i’ts quite nice):

    http://www.wildfireg...98

    (I retranslate the options back to english, setting LC_ALL=C doesn’t help this case)

    1. create a local.cfg with windowed=true -> http://trac.wildfire...Manual_Settings
    2. right click on the window title, select 'Advanced' -> 'Special settings for this programm'
    3. accept the infobox dialog with ok
    4. go to tab 'Size&Position'
    5. activate 'Fullscreen' -> in the dropdown to the right select 'Force' or maybe better 'Apply on Initialization'(second entry) -> set radio button to 'yes'
    6. maybe restart the game

    then the game uses KWin’s fullscreen mode(windowed fullscreen); you have fullscreen with an ungrabbed keyboard(and mouse!) .

    so hitting screen edges might toggle compositing effects, if you enabled such actions(I think there is one enabled by default for the upper left corner…)

    so you might need to enable other options too, (eg. block compositing)

    you can move the window between monitors by <ALT>+mouse drag’n’drop

  3. ^^

    no problem. I’ll try to contribute where I can, and such things don’t need code knowledge.

    2 monitors and enough cpu cores to feed 6 parallel running atlas instances really helps speeding such tasks up ;)

    as a general rule: every map using the pathplacer js code needs at least 2 players, otherwise the code will fail with an exception.

    I only know of Canyon. maybe Dark Forest.

    If I don’t forget it, it’ll be done tomorrow.

  4. Now that we have player number restriction per map size, I’ve looked into the available map scripts.(opened 3 atlas instances and generated every map in tiny+4players, small+6players and medium+8players)

    those maps are working well with the default [4, 6, 8, 8, 8, 8, 8]:


    Ardennes Forest
    Atlas Mountains
    Cantabrian Highlands
    Continent
    Corinthian Isthmus
    Cycladic Archipelago
    English Channel
    Fortress
    Gear
    Gulf of Bothnia (There are no islands in the gulf, but the map description says so)
    Hyrcanian Shores
    Kerala
    Lake
    Latium
    Lorraine Plain
    Neareastern Badlands
    New RMS Test (well…)
    Northern Lights
    Oasis
    Persian Highlands
    Pyrenean Sierra
    Rhine Marshlands
    Rivers
    Saharan Oases
    Sahel Watering Holes
    Syria
    The Nile
    Volcanic Lands

    those maps need tweaking:

    they had different flaws with the default, like beeing largely unfair or otherwise broken layout (esp Migration, where all islands are connected with default restrictions)


    Archipelago (with 4 players on a tiny map, thats not an archipelago at all…)
    [3, 6, 8, 8, 8, 8, 8]
    Belgian Uplands (largely unfair with 6 players on a small map)
    [4, 4, 8, 8, 8, 8, 8]
    Canyon
    [3, 6, 8, 8, 8, 8, 8]
    Corsica vs Sardinia (very crowded)
    [2, 4, 6, 8, 8, 8, 8]
    Deep Forest (not a real forest with 4 players on a tiny map)
    [3, 6, 8, 8, 8, 8, 8]
    Guadalquivir River (northern players very disadvantaged)
    [2, 4, 6, 6, 8, 8, 8]
    Islands (generaly generates very slowly)
    [2, 4, 6, 8, 8, 8, 8]
    Migration (restrictive, otherwise islands may be connected; even on giant with 8 players and seed 9560)
    [2, 3, 5, 5, 6, 7, 8]
    Snowflake Searocks
    [3, 4, 8, 8, 8, 8, 8]

    The Unknown scripts should get those, since some of the included variations may not work well with the default


    Unknown
    [2, 4, 6, 8, 8, 8, 8]
    Unknown Land
    [2, 4, 6, 8, 8, 8, 8]
    Unknown Nomad
    [2, 4, 6, 8, 8, 8, 8]

  5. while you are at it…

    Would it be ok to either reduce the default player count to 3 or default map size to Normal for random maps?

    I think it’s odd that the game defaults to 4 players on “Medium (3 players)”…

    Either 3 players on “Medium (3 players)” (better performance wise)

    or 4 players on “Normal (4 players)”.

    BTW the link in your last post is broken…

  6. I would say change the constant MAX_PLAYERS_BY_MAP_SIZE_RMS to:

    const MAX_PLAYERS_BY_MAP_SIZE_RMS = [2, 2, 3, 4, 6, 8, 8];

    this way it exactly matches the number of players in the size description.

    with current settings, you can’t play with 8 players on a “Very Large (8 players)” map…

    or

    const MAX_PLAYERS_BY_MAP_SIZE_RMS = [2, 3, 4, 5, 7, 8, 8];

    this way it matches number of players in the size description +1

    or:

    const MAX_PLAYERS_BY_MAP_SIZE_RMS = [4, 6, 8, 8, 8, 8, 8];

    that one would be very permissive and might not work with many maps

    about minimal player count: some RMS might not work with 1 or 2 players…

    Canyon throws an exeption with only one player…

    or the layout may be broken (for whatever reason)

    but I think one of those is a reasonable default:

    const MIN_PLAYERS_BY_MAP_SIZE_RMS = [1, 1, 1, 1, 1, 1, 1];

    const MIN_PLAYERS_BY_MAP_SIZE_RMS = [2, 2, 2, 2, 2, 2, 2];

    it should only be set otherwise by a RMS that needs this

  7. I really don’t know the code, where should that js file be placed?

    EDIT: found it. ~/.cache/0ad/mods/public/gui/gamesetup/gamesetup.js

    I’ll try what I can…

    EDIT2: looks like a logic bug. the player number is not updated. it just updates the UI and removes the player from the UI. It does not set the actual player number variable:

    select 3 players, change to tiny. UI says 2 players. click start. 3 players are placed.

    you should call selectNumPlayers() when you have to remove a player due to map limitations. that function seems to be able to do everything needed.

    so:(something like this pseudo-code)


    if (current_player_count > max_supported_count_by_current_size)
    selectNumPlayers(max_supported_count_by_current_size);

    I just haven’t found the line where to place this.

  8. just a suggestion, I can’t code js, but a quick google query told me it’s possible

    change function mapSizeToSizeIndex(size) to:


    function mapSizeToSizeIndex(size)
    {
    var sizeIndex = undefined;
    switch (size)
    {
    case 128:
    sizeIndex = 0;
    break;
    case 192:
    sizeIndex = 1;
    break;
    case 256:
    sizeIndex = 2;
    break;
    case 320:
    sizeIndex = 3;
    break;
    case 384:
    sizeIndex = 4;
    break;
    case 448:
    sizeIndex = 5;
    break;
    case 512:
    sizeIndex = 6;
    break;
    default:
    //some error handling here, since invalid size passed
    }
    return sizeIndex;
    }

    or:

    (shorter version without a variable)


    function mapSizeToSizeIndex(size)
    {
    switch (size)
    {
    case 128:
    return 0;
    case 192:
    return 1;
    case 256:
    return 2;
    case 320:
    return 3;
    case 384:
    return 4;
    case 448:
    return 5;
    case 512:
    return 6;
    default:
    //some error handling here, since invalid size passed
    return undefined;
    }
    }

    or:

    the shortest version that uses the specific values 'size' can have

    this one is fragile, you may use a variable for the calculation and error-check before returning the value


    function mapSizeToSizeIndex(size)
    {
    return (size/64-2);
    }

  9. ok, I tested it on my machine using my limiter script:

    I can provide tests with the following values:

    CPU-number: 1 to 6

    clock speeds(both maximum and minimum; in kHz): one of 2800000 2200000 1500000 800000

    I just tested:

    build: latest git master as of now

    map: combat Demo(Huge)

    singlecore 1,5GHz: no stalls at all(!), you can clearly hear the sim update: music plays smooth, every 3-4 seconds you hear a bunch of battle sounds from a sim update

    dualcore 800MHz: no stalls, similar to singlecore 1.5GHz

    this is below the mimimal system requirements:

    singlecore 800MHz: some stalls(only directly after sim update;the stalls are infrequent and short), sim updates very infrequently(+10seconds/sim update in mid-battle)

  10. Thanks, this sounds useful for testing the threaded stuff. Do you know roughly how dangerous would it be to feed bad values into the script?

    I’ve written it for exactly this purpose :wink2:

    I’ve tested it:(that happens with my AMD CPU, with vendors it should be the same)

    • you cannot disable cpu 0; trying to do so gives a file-not-found error
    • you cannot use too low values as clock speed; "bad argument"
    • you can use too high values as clock speed; nothing happens, it does not overclock, but simply uses your maximum cpu clock speed
      at least my system monitor told me that, be careful with this one
    • using minimum_frequency>maximum_frequency gives a "bad argument" error

    so it should be safe to use, but i recommend using proper values (the script prints them out when calling it without arguments)

    other than that:

    if you really cut your cpu down, your system will get really slow!

    I can reduce my cpu power from 6*2,8GHz to 1*800Mhz. You can feel the effect immediately :wink2:

    with 1*800MHz, the rendering in 0ad(latest dev ppa build) completely freezes (but hey, music continues nicely!)

  11. Hi there,

    I’ve written a script that limits the available CPU cores and frequencies to user defined values.

    Purpose is simulating a slow CPU for testing multithreading performance/mutex locking behaviour on those systems.

    This script temporarily turns your high-performance 12core i7 CPU into a slow single-core or dual-core cpu (or whatever you specify)

    by disabling cpu cores and limiting the minimum and maximum frequencies of the remaining cores

    Disabling 5/6 cores of a 6-core CPU doesn’t exactly give the performance of a single-core CPU with same clock speed(since the multi-core CPU isn’t designed to run that way) but at least it should give some usable approximation.

    The script is designed to run in another terminal window. After changing your system, it waits for the user to say "exit" by pressing [Return], and restores everything to the original values(re-enables disabled CPU cores and restores original min/max clock speeds).

    It (temporarily) modifies your system, so it has to be run as root user(so check the script first before running it!)

    I’ve written 2 variations:

    cpu_limiter.sh is interactive and asks the user for input values. It tells you which values are available on your system and checks if the entered values are valid. (it’s not completely failsafe though)

    cpu_limiter_plain.sh requires those values as parameters, calling it without any gives a short usage information and prints the available values on your system. This one does not check anything, but assumes you are calling it with correct/working values!

    I tested both versions on my system, they are fully working(otherwise i would not have released it)

    (my system: Kubuntu 12.10, AMD Phenom II X6 CPU(6 cores))

    But I did NOT test what happens, if you feed the plain version with bad arguments(text strings, negative/very high numbers etc.)… just don’t do that! :wink2:

    Download:

    cpu_limiter.zip

    Plaintext version(in the Spoiler):

    cpu_limiter.sh:


    #!/bin/bash

    # cpu_limiter.sh is a bash script to limit the cpu power to specified values
    # Copyright (C) 2013 Thomas Hess
    # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as
    # published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
    # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    # You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.



    # checks if value is element in the array
    function contains()
    {
    local n=$#
    local value=${!n}
    for ((i=1;i < $#;i++))
    {
    if [ "${!i}" == "${value}" ]; then
    return 0
    fi
    }
    return 1
    }

    #gather information needed to restore things
    num_cpu_in_system=$(grep processor /proc/cpuinfo | wc -l)
    num_requested_cpus=1
    for((x=0; x<$num_cpu_in_system;x++))
    {
    cpu_freq_max[x]=$(cat /sys/devices/system/cpu/cpu$x/cpufreq/cpuinfo_max_freq)
    cpu_freq_min[x]=$(cat /sys/devices/system/cpu/cpu$x/cpufreq/cpuinfo_min_freq)
    cpu_freq_avail[x]=$(cat /sys/devices/system/cpu/cpu$x/cpufreq/scaling_available_frequencies)
    }
    cpu_frequencies=(${cpu_freq_avail[0]})


    echo "Number of CPUs in your System: $num_cpu_in_system"
    echo "Maximal CPU frequency(First CPU, in kHz): ${cpu_freq_max[0]}"
    echo "Minimal CPU frequency(First CPU, in kHz): ${cpu_freq_min[0]}"
    echo "Available CPU frequencies (First CPU, in kHz): ${cpu_freq_avail[0]}"


    echo "Enter the number of supposed to be running CPUS: (values between 1 and $num_cpu_in_system allowed"
    echo "e.g. want a singlecore? enter 1 [Return]; want a dualcore? enter 2 [Return]"
    read num_requested_cpus

    while [ "${num_requested_cpus:-0}" -gt "$num_cpu_in_system" ] || [ "${num_requested_cpus:-0}" -le "0" ]; do
    echo "Cannot create virtual CPUs or use 0/negative number of CPUS"
    echo "Enter a value between 1 and $num_cpu_in_system (both including)"
    read num_requested_cpus
    done


    echo "Your CPU supports the following CPU frequencies(in kHz): ${cpu_frequencies[@]}"
    echo "Enter the minimal CPU speed to use:"
    read use_minimal_cpu_freq
    while ! contains "${cpu_frequencies[@]}" "${use_minimal_cpu_freq:-0}" ; do
    echo "Enter a valid value:"
    read use_minimal_cpu_freq
    done

    echo "Enter the maximal CPU speed to use:"
    read use_maximal_cpu_freq
    while ! contains "${cpu_frequencies[@]}" "${use_maximal_cpu_freq:-0}" || [ "${use_maximal_cpu_freq:-0}" -lt "$use_minimal_cpu_freq" ] ; do
    echo "Enter a valid value: (greater than or equal to the minimal frequency)"
    read use_maximal_cpu_freq
    done

    echo "Information collection done!"
    echo "Number of requested CPUs: $num_requested_cpus"
    echo "new minimal CPU frequency: $use_minimal_cpu_freq "
    echo "new maximal CPU frequency: $use_maximal_cpu_freq"

    for((x=$num_requested_cpus; x < num_cpu_in_system; x++))
    {
    echo ${cpu_freq_min[x]} > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_max_freq
    echo 0 > /sys/devices/system/cpu/cpu$x/online
    }
    for((x=0; x<$num_requested_cpus; x++))
    {
    echo $use_minimal_cpu_freq > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_min_freq
    echo $use_maximal_cpu_freq > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_max_freq
    }

    echo "Press [Return] to restore your CPU configuration and exit"
    read

    for((x=$num_requested_cpus; x < num_cpu_in_system; x++))
    {
    echo 1 > /sys/devices/system/cpu/cpu$x/online
    }

    for((x=0; x < num_cpu_in_system; x++))
    {
    echo ${cpu_freq_min[x]} > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_min_freq
    echo ${cpu_freq_max[x]} > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_max_freq
    }

    echo "Done"

    cpu_limiter_plain.sh


    #!/bin/bash

    # cpu_limiter_plain.sh is a bash script to limit the cpu power to specified values
    # Copyright (C) 2013 Thomas Hess
    # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as
    # published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
    # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    # You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.


    # 3 Parameters:
    # 1: number of to-be running CPUs
    # 2: minimal CPU frequency
    # 3: maximal CPU frequency


    # checks if value is element in the array
    function contains()
    {
    local n=$#
    local value=${!n}
    for ((i=1;i < $#;i++))
    {
    if [ "${!i}" == "${value}" ]; then
    return 0
    fi
    }
    return 1
    }

    #gather information needed to restore things
    num_cpu_in_system=$(grep processor /proc/cpuinfo | wc -l)
    for((x=0; x<$num_cpu_in_system;x++))
    {
    cpu_freq_max[x]=$(cat /sys/devices/system/cpu/cpu$x/cpufreq/cpuinfo_max_freq)
    cpu_freq_min[x]=$(cat /sys/devices/system/cpu/cpu$x/cpufreq/cpuinfo_min_freq)
    cpu_freq_avail[x]=$(cat /sys/devices/system/cpu/cpu$x/cpufreq/scaling_available_frequencies)
    }
    cpu_frequencies=(${cpu_freq_avail[0]})

    if [ $# -eq "3" ]; then
    echo "Number of CPUs in your System: $num_cpu_in_system, will be set to $1"
    echo "Available CPU frequencies (First CPU, in kHz): ${cpu_freq_avail[0]}"
    echo "Maximal CPU frequency(First CPU, in kHz): ${cpu_freq_max[0]}, will be set to $3"
    echo "Minimal CPU frequency(First CPU, in kHz): ${cpu_freq_min[0]}, will be set to $2"

    num_requested_cpus="$1"
    use_minimal_cpu_freq="$2"
    use_maximal_cpu_freq=" $3"

    for((x=$num_requested_cpus; x < num_cpu_in_system; x++))
    {
    echo ${cpu_freq_min[x]} > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_max_freq
    echo 0 > /sys/devices/system/cpu/cpu$x/online
    }
    for((x=0; x<$num_requested_cpus; x++))
    {
    echo $use_minimal_cpu_freq > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_min_freq
    echo $use_maximal_cpu_freq > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_max_freq
    }

    echo "Press [Return] to restore your CPU configuration and exit"
    read

    for((x=$num_requested_cpus; x < num_cpu_in_system; x++))
    {
    echo 1 > /sys/devices/system/cpu/cpu$x/online
    }

    for((x=0; x < num_cpu_in_system; x++))
    {
    echo ${cpu_freq_min[x]} > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_min_freq
    echo ${cpu_freq_max[x]} > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_max_freq
    }
    echo "Done"
    else
    echo "invoke this script with 3 Parameters"
    echo "1: number of to-be running CPUs"
    echo "2: minimal CPU frequency(in kHz)"
    echo "3: maximal CPU frequency(in kHz)"
    echo "Allowed values on your system:"
    echo "CPU-number: 1 to $num_cpu_in_system"
    echo "frequencies(both maximum and minimum): one of ${cpu_frequencies[@]}"
    echo "Example: $0 1 ${cpu_frequencies[0]} ${cpu_frequencies[0]}"
    fi

    I hope that it will be useful for someone

  12. idk, if it works good, but it might be worth a try

    you could use Virtualbox to create a low resource machine:

    install Virtualbox and a VM with an SVN build of 0ad (+Guest Additions for OpenGL-passthrough; idk whether 0ad runs with that, haven’t tested it)

    in the VM-Settings under System->Processor you can set the number of cpus the vm can use + a cpu limiter

    the limiter is important. you can reduce the cpu-power the VM gets to eg. 20% of your physical cpu-power.

    (eg you have a 3.6GHz cpu. you can test the game on a 1GHz cpu by setting the limiter to 28%)

  13. what do you try to achieve?

    'trigger' should be a conversion function??

    where’s the definition for 'trigger(…)' ?


    CTrigger trigger(eventName);
    m_Triggers.push_back(trigger);

    you basically do: define a function prototype and than push_back() a zero-pointer to that non-existing function

    you can define function without implementing it when you don‘t call it, but you try to push it into the list

    ____

    so implement

    CTrigger trigger(eventName);

    in the h/cpp file and then use

    m_Triggers.push_back(trigger(eventName));

  14. since that check isn’t copied 1:1 into the codebase i see my complain as [iNVALID], so only one last thing from my side

    ok, I don’t know javascript. If there’s a semantic difference between var !== false and var == true for a boolean variable, your point is valid. isn’t there a warning when calling a function with too few parameters?

    so there’s a difference between these 3 pseudo-js-functions?


    function f1(bool_var)
    {
    if(bool_var !== false)
    do_smth();
    }
    function f2(bool_var)
    {
    if(bool_var == true)
    do_smth();
    }
    function f3(bool_var)
    {
    if(bool_var)
    do_smth();
    }

    when calling those like this?


    f1();
    f2();
    f3();

    You know that the variable could be undefined or null right?

    since it’s boolean algebra, you can’t have a semantic 'undefined' or 'null'; undefined is a random true or false and null normally is false and everything else is true

  15. a minor note from my side: don’t use double negations in boolean expressions when you can avoid them.

    instead of

     if (playsound !== false && owner == playerID || owner == 0 || g_DevSettings.controlAll)
    _playSound(added[0]);

    use

     if (playsound == true && owner == playerID || owner == 0 || g_DevSettings.controlAll)
    _playSound(added[0]);

    or even

     if (playsound && owner == playerID || owner == 0 || g_DevSettings.controlAll)
    _playSound(added[0]);

    that saves you 2 byte of disk space ( :wink2:) and is easier to understand

    consider this example pseudo-c snippet(ask yourself which 'if' implements the desired behaviour; play the sound when sound is enabled)


    if(disable_sound != false)
    playsound(whatever);
    if(enable_sound == true)
    playsound(whatever);

    in theory you could remove every occurance of "!== false" in the codebase…

    EDIT: i just looked into the linked changeset, everything is ok, never said anything :ph34r:

  16. I like the new design, its really nice.

    a big usability plus(compared to other sites): those drop-down menu headers("News", "Game Info", etc) are not clickable( thats a good thing!).

    That makes the site usable on touch screen devices, since there you don’t have the (otherwise required) hover-, but only the click-(and-drag) action available

    well done!

  17. for me it sounds like you 2 have misunderstood him…

    I think he wanted the answer for this question: "Is it normal that the game consumes every cpu cycle it can grab, even if nothing happens like in the match setup screen?"

    Am I right?

    look at the screenshot(in the spoiler): even in the menu the game uses 100% of 2 cores(i’ve disabled dividing cpu load through number of cores to show it better)

    that behavior causes my notebook to overheat even when i let the game idle in the menu

    it looks like the game does some busy waiting or polling, which is quite bad

    0ad_idle_cpu_load.jpg

  18. I tried to open the file luziferius but it said that "The zip file is missing or corrupted" Do you have any idea about that?

    I'll get to making a graph or the animals but I'm not sure I can fill too much of it in.

    which packing programm do you use?

    I’ve created that with 7zip on linux

    maybe your programm doesn’t like the deflate64 packing method…

    however, I’ve done a repack and re-upload(and removed the possibly corrupted file 2 posts above):

    chickens.zip

×
×
  • Create New...