unity – How can I improve the current enemy spawning system for my strategy game

I’m currently making an RTS game for mobile where mini battles would take place on tiny battlegrounds.

The problem is that currently the player is spawning its units based on a currency system, whereas the enemy is spawning based on a timed system. The timed system would make sense in a tower defense game, but not here.

Here is a short clip of it in action: https://twitter.com/LewanayG/status/1378009426808950794

This is my current spawn script:

void Start()
    {
        //start spawning waves
        StartCoroutine(SpawnWaves());
    }

    IEnumerator SpawnWaves()
    {
        //before spawning the first enemies, wait a moment
        yield return new WaitForSeconds(startWait);
        while (true)
        {
            //if not all characters of this wave are spawned, spawn new enemy and that wait some time before spawning next enemy in this wave
            for (int i = 0; i < startEnemyCount; i++)
            {
                int random = Random.Range(0, enemies.Length);
                GameObject newEnemy = Instantiate(enemies(random), transform.position, transform.rotation) as GameObject;
                newEnemy.transform.parent = enemyParent.transform;
                
                yield return new WaitForSeconds(spawnWait);                         // to add some randomness between spawns
            }
            
            //make sure the next wave contains more enemies than this one
            startEnemyCount += extraEnemiesPerWave;
            //wait before starting the next wave
            yield return new WaitForSeconds(waveWait);
        }
    }

Under the current system, as long as the player has more units on the battleground than the current spawn rate of the enemy it will win, and its really difficult to balance this game based on the two spawn systems.

How do you suggest I handle this problem and the spawn system of enemy units?

Improve my code with Python using constructor

I would like to know, how could improve this coding using a constructor?
This code works for a conversion factors in physic.

This is my code:

# physic_convertions.py
import numpy as np

class Length:

       global factors
       global units
       
       factors = np.array(((1.0, 1.0e2, 1.0e-3, 39.37, 3.281, 6.214e-4),
                          (1.0e-2, 1.0, 1e-5, 0.3937, 3.281e-2, 6.214e-6),
                          (1.0e3, 1.0e5, 1.0, 3.937e4, 3.281e3, 0.6214),
                          (2.540e-2, 2.540, 2.540e-5, 1.0, 8.333e-2, 1.578e-5),
                          (0.3048, 30.48, 3.048e-4, 12.0, 1.0, 1.894e-4),
                          (1609.0, 1609.0e5, 1.609, 6.336e4, 5280.0, 1.0)))
       units = {'m':0, 'cm':1, 'km':2, 'in':3, 'ft':4, 'mi':5}
       unit = units

       def meters(length, unit):
              u = units(unit)
              return length * factors(0)(u)

       def centimeters(length, unit):
              u = units(unit)
              return length * factors(1)(u)

       def kilometers(length, unit):
              u = units(unit)
              return length * factors(2)(u)

       def inches(length, unit):
              u = units(unit)
              return length * factors(3)(u)

       def feet(length, unit):
              u = units(unit)
              return length * factors(4)(u)

       def miles(length, unit):
              u = units(unit)
              return length * factors(5)(u)

If you have any other suggestions it is welcome, thanks!

c++ – How can I improve my SDL2 input manager?

This is my first time actually trying to wrap the the SDL event handling functions in a class of my own. I’m trying to achieve a design similar to unity’s where you have this static Input class and you can call it’s functions whenever to check for various input events.

Here is the class:

class InputManager
{
private:
    InputManager() = default;
    InputManager(const InputManager& c) = delete;

private:
    static SDL_Event event;
    static bool isKeyPressed;
    static bool isKeyReleased;
    static bool isMousePressed;
    static bool isMouseReleased;

    static int keyIndex;
    static int buttonIndex;

public:
    static InputManager* GetInstance();
    void Update();

public:
    bool KeyDown(int iKeyIndex);
    bool KeyStillDown(int iKeyIndex);
    bool KeyUp(int iKeyIndex);
    bool KeyStillUp(int iKeyIndex);
    bool MouseDown(int iButton);
    bool MouseStillDown(int iButton);
    bool MouseUp(int iButton);
    bool MouseStillUp(int iButton);
};

and it’s implementations:

SDL_Event InputManager::event;
bool InputManager::isMousePressed = false;
bool InputManager::isMouseReleased = false;
bool InputManager::isKeyPressed = false;
bool InputManager::isKeyReleased = false;

InputManager* InputManager::GetInstance()
{
    static InputManager* instace = new InputManager();
    return instace;
}

void InputManager::Update()
{
    SDL_PollEvent(&event);
}

bool InputManager::KeyDown(int iKeyIndex)
{
    if(event.type == SDL_KEYDOWN && event.key.keysym.sym == iKeyIndex && isKeyPressed == false)
    {
        isKeyPressed = true;
        return true;
    }  
    else if(event.type == SDL_KEYUP)
    {
        isKeyPressed = false;
        return false;
    }
    else
        return false;
}

bool InputManager::KeyStillDown(int iKeyIndex)
{
    if(event.type == SDL_KEYDOWN && 
       event.key.keysym.sym == iKeyIndex)
        return true;
    else
        return false;
}

bool InputManager::KeyUp(int iKeyIndex)
{
    if(event.type == SDL_KEYUP && event.key.keysym.sym == iKeyIndex && isKeyReleased == false)
    {
        isKeyReleased = true;
        return true;
    }
    else
    {
        isKeyReleased = false;
        return false;
    }   
}

bool InputManager::KeyStillUp(int iKeyIndex)
{
    if(event.type == SDL_KEYUP &&
       event.key.keysym.sym == iKeyIndex && event.key.repeat == 0)
        return true;
    else 
        return false;
}

bool InputManager::MouseDown(int iButton)
{
    if(event.type == SDL_MOUSEBUTTONDOWN && event.button.button == iButton && isMousePressed == false)
    {
        isMousePressed = true;
        return true;
    }
    else if(event.type == SDL_MOUSEBUTTONUP)
    {
        isMousePressed = false;
        return false;
    }
    else
        return false;
}

bool InputManager::MouseStillDown(int iButton)
{
    if(event.type == SDL_MOUSEBUTTONDOWN && event.button.button == iButton)
        return true;
    else
        return false;
}

bool InputManager::MouseUp(int iButton)
{
    if(event.type == SDL_MOUSEBUTTONUP && event.button.button == iButton && isMouseReleased == false)
    {
        isMousePressed = true;
        return true;
    }
    else
    {
        isMousePressed = false;
        return false;
    }
}

bool InputManager::MouseStillUp(int iButton)
{
    if(event.type == SDL_MOUSEBUTTONUP && event.button.button == iButton)
        return true;
    else
        return false;
}

Now I know this class has it’s flaws and it certainly does, for instance the KeyUp(int iKeyIndex) and MouseUp(int iButton) functions seem to always be true unless I move the mouse or do anytype of event. I’m aware of issue and why it’s happening but I can’t seem to find a solution for it. I would like some feedback, how to improve on the overall class, what design patterns to keep in mind and how to fix the issue I mentioned above.

linux – how to uses these commands to improve online gaming (VDSL)?

Hello i want to uses these commands to improve online gaming

usage: wan vdsl2 set olr_timing (timing)(sos_x)(sos_y)(sos_z)
usage: wan vdsl2 set ginp_sra (on/off/go)
usage: wan vdsl2 set ginp_sos (go/off)
usage: wan vdsl2 set gsd (value)
usage: wan vdsl2 set gso (value)
usage: wan vdsl2 set gvt_mode (value)
usage: wan vdsl2 set hrt_delay (tx sym) (tx dtu) (rx sym) (rx dtu)
usage: wan vdsl2 set sync_sym (val)
usage: wan vdsl2 set ginp_test (on|off)
usage: wan vdsl2 set tr115 (on|off)
usage: wan vdsl2 set cd_us_band_adj (on|off|auto)
usage: wan vdsl2 set ds_est_new (on|off)
usage: wan vdsl2 set ds_est_new min (x) ,X = (0.1 * x) dB 
usage: wan vdsl2 set ds_est_new adsl (y), Y = (1/1000 * y) 
usage: wan vdsl2 set ds_est_new echo (z), Z = z dB(>=0) 
usage: wan vdsl2 set cd_us_comp_value (value)
usage: wan vdsl2 set usbp_check (on|off)
usage: wan vdsl2 set kikp (0~13)(0~11)
usage: wan vdsl2 set rtslog_from (rtslog_state_from)
usage: wan vdsl2 set v_noise (on|off)
usage: wan vdsl2 set tx_cp_len (val)
usage: wan vdsl2 set tx_comp on/off 
usage: wan vdsl2 tx_comp offsetrelay_tone_psd_comp_offset_non_upbo relay_tone_psd_comp_offset_upbo
usage: wan vdsl2 set txgain_deploy (0|1|2)
usage: wan vdsl2 set txpsd_drop_check (on|off)
usage: wan vdsl2 set txpsd_drop_limit (val)
usage: wan vdsl2 set txpwr_diff (val)
usage: wan vdsl2 set txpwr_limit (on/off) (value/none) 
usage: wan vdsl2 set mode_select (on|off)
usage: wan vdsl2 set rxpcb (on|off)(rxpcb_mask)
usage: wan vdsl2 set detect_tone_offset (detect_tone_offset) 
usage: wan vdsl2 set ds_tone (ds_lowest_tone) (ds_highest_tone) 
usage: wan vdsl2 set us_tone (us_lowest_tone) (us_highest_tone) 
usage: wan vdsl2 set tx_pcb (on|off) (pcb_mask)
usage: wan vdsl2 set rfi_cancel (on|off)
usage: wan vdsl2 set rx_win (on/off)
usage: wan vdsl2 set tx_win (on/off)(win_len)
usage: wan vdsl2 set rxfltr_gain (val)
usage: wan vdsl2 set rxfltr_ref (val)
usage: wan vdsl2 set ta_offset (val)
usage: wan vdsl2 set byte_med(R_MED 1|2)(O_MED 1|2)
usage: wan vdsl2 set kl0 (val:0~1280)
usage: wan vdsl2 set kl0_offset (val)
usage: wan vdsl2 set kl0_method (0|1)
usage: wan vdsl2 set upbo (on|off)
usage: wan vdsl2 set rx_blackout 0 : ds blackout off
       wan vdsl2 set rx_blackout (blackout_num)(start_t1)(stop_t1)...
usage: wan vdsl2 set teq_fir_coeff (a2) (a3) (a4)
usage: wan vdsl2 set rx_fltr_type (fltr_for_cd_phase) (fltr_for_training_phase) 
usage: wan vdsl2 set tx_fltr_type (fltr_for_cd_phase) (fltr_for_training_phase) 
usage: wan vdsl2 set tx_fltr_gain (tx_fltr_gain) (tx_fltr_dout_scale) (tx_upshift_bit)
usage: wan vdsl2 set tx_gain_offset (value)
usage: wan vdsl2 set st_period (period(sec))
usage: wan vdsl2 set st_task (on/off)
usage: wan vdsl2 set st_dbg (on/off/olr)
usage: wan vdsl2 set tpstc_type (0(ptm only)/1(ptm+atm))
usage: wan vdsl2 set gvector (1|2)
usage: wan vdsl2 set amd (0|1|2|3)
usage: wan vdsl2 set sync_check (on/off)
usage: wan vdsl2 set one_bit (on|off)
usage: wan vdsl2 set st_target_snrm (snrm)
usage: wan vdsl2 set target_snrm (snrm_dB)
usage: wan vdsl2 set manual_pms (on|off)
usage: wan vdsl2 set inp_snrm_roc (inp_min(symbol)) (snrm_offset(dB))
usage: wan vdsl2 set roc (on/off)
usage: wan vdsl2 set dual_lp (on|off)
usage: wan vdsl2 set fake_pms (on|off)
usage: wan vdsl2 set search_time_pms (time (# symbols))
usage: wan vdsl2 set rscg_pms (on|off)
usage: wan vdsl2 set largedelay_pms (on|off)
usage: wan vdsl2 set inpdelay_pms (inp_min0) (inp_min1) (delay_max0) (delay_max1)
usage: wan vdsl2 set ndr_pms (msg_min) (ndr_min0) (ndr_min1) (ndr_max0) (ndr_max1)
usage: wan vdsl2 set ins_inp (on/off)
usage: wan vdsl2 set sos (on/off/go)
usage: wan vdsl2 set sra_trans_method (0(non-seg)/1(seg))
usage: wan vdsl2 set sra_l_target off/(bits)
usage: wan vdsl2 set sra_step (on|off)
usage: wan vdsl2 set sra (on|off)
usage: wan vdsl2 set bs_param (snrm) (trigger) (scan_tone_num) (wait_cnt) (scan_start_idx) (scan_end_idx)
usage: wan vdsl2 set bs_1bit_change (on|off)
usage: wan vdsl2 set autobs (on|off)
usage: wan vdsl2 set bs_tx (on|off)
usage: wan vdsl2 set bs (on|off)
usage: wan vdsl2 set mgcnt_ovhd_test (on|off)
usage: wan vdsl2 set agc_vref (val1) (val2) (val3) (val4)
usage: wan vdsl2 set tcm (on|off)
isso@DEll-OptiPlex-780:~$ strings tc3162_dmt_mt7510.ko  | fgrep  wan  | fgrep vdsl | fgrep set | fgrep pms
usage: wan vdsl2 set manual_pms (on|off)
usage: wan vdsl2 set fake_pms (on|off)
usage: wan vdsl2 set search_time_pms (time (# symbols))
usage: wan vdsl2 set rscg_pms (on|off)
usage: wan vdsl2 set largedelay_pms (on|off)
usage: wan vdsl2 set inpdelay_pms (inp_min0) (inp_min1) (delay_max0) (delay_max1)
usage: wan vdsl2 set ndr_pms (msg_min) (ndr_min0) (ndr_min1) (ndr_max0) (ndr_max1)
isso@DEll-OptiPlex-780:~$ strings tc3162_dmt_mt7510.ko  | fgrep  wan  | fgrep vdsl 
usage: wan vdsl2 show online_snrm
usage: wan vdsl2 set olr_timing (timing)(sos_x)(sos_y)(sos_z)
usage: wan vdsl2 show st_avg_snrm (tx/rx)
usage: wan vdsl2 show errpwr (init|st)
usage: wan vdsl2 set ginp_sra (on/off/go)
usage: wan vdsl2 set ginp_sos (go/off)
usage: wan vdsl2 test ovhd (diag|inv|pm|mgcnt|clreoc|nsf|pmd)
usage: wan vdsl2 show vector
usage: wan vdsl2 show st_soc_info
usage: wan vdsl2 show pms_pmd (tx|rx)
usage: wan vdsl2 show pmdtestparam (hlog/qln/snr/attndr)
usage: wan vdsl2 show snrm (st)
usage: wan vdsl2 show snr (init|st)
usage: wan vdsl2 show new_bgtbl rx
usage: wan vdsl2 show bgtbl (tx|rx)
usage: wan vdsl2 set gsd (value)
usage: wan vdsl2 set gso (value)
usage: wan vdsl2 set gvt_mode (value)
usage: wan vdsl2 set hrt_delay (tx sym) (tx dtu) (rx sym) (rx dtu)
usage: wan vdsl2 set sync_sym (val)
usage: wan vdsl2 set ginp_test (on|off)
usage: wan vdsl2 set tr115 (on|off)
usage: wan vdsl2 set cd_us_band_adj (on|off|auto)
usage: wan vdsl2 set ds_est_new (on|off)
usage: wan vdsl2 set ds_est_new min (x) ,X = (0.1 * x) dB 
usage: wan vdsl2 set ds_est_new adsl (y), Y = (1/1000 * y) 
usage: wan vdsl2 set ds_est_new echo (z), Z = z dB(>=0) 
usage: wan vdsl2 set cd_us_comp_value (value)
usage: wan vdsl2 set usbp_check (on|off)
usage: wan vdsl2 set kikp (0~13)(0~11)
usage: wan vdsl2 set rtslog_from (rtslog_state_from)
usage: wan vdsl2 set v_noise (on|off)
usage: wan vdsl2 set tx_cp_len (val)
usage: wan vdsl2 set tx_comp on/off 
usage: wan vdsl2 tx_comp tone start_tone relay_tone stop_tone
usage: wan vdsl2 tx_comp value start_tone_psd_comp relay_tone_psd_comp stop_tone_psd_comp
usage: wan vdsl2 tx_comp offsetrelay_tone_psd_comp_offset_non_upbo relay_tone_psd_comp_offset_upbo
usage: wan vdsl2 set txgain_deploy (0|1|2)
usage: wan vdsl2 set txpsd_drop_check (on|off)
usage: wan vdsl2 set txpsd_drop_limit (val)
usage: wan vdsl2 set txpwr_diff (val)
usage: wan vdsl2 set txpwr_limit (on/off) (value/none) 
usage: wan vdsl2 set mode_select (on|off)
usage: wan vdsl2 set rxpcb (on|off)(rxpcb_mask)
usage: wan vdsl2 set detect_tone_offset (detect_tone_offset) 
usage: wan vdsl2 set ds_tone (ds_lowest_tone) (ds_highest_tone) 
usage: wan vdsl2 set us_tone (us_lowest_tone) (us_highest_tone) 
usage: wan vdsl2 set tx_pcb (on|off) (pcb_mask)
usage: wan vdsl2 set rfi_cancel (on|off)
usage: wan vdsl2 set rx_win (on/off)
usage: wan vdsl2 set tx_win (on/off)(win_len)
usage: wan vdsl2 set rxfltr_gain (val)
usage: wan vdsl2 set rxfltr_ref (val)
usage: wan vdsl2 set ta_offset (val)
usage: wan vdsl2 set byte_med(R_MED 1|2)(O_MED 1|2)
usage: wan vdsl2 set kl0 (val:0~1280)
usage: wan vdsl2 set kl0_offset (val)
usage: wan vdsl2 set kl0_method (0|1)
usage: wan vdsl2 set upbo (on|off)
usage: wan vdsl2 set rx_blackout 0 : ds blackout off
       wan vdsl2 set rx_blackout (blackout_num)(start_t1)(stop_t1)...
usage: wan vdsl2 set teq_fir_coeff (a2) (a3) (a4)
usage: wan vdsl2 set rx_fltr_type (fltr_for_cd_phase) (fltr_for_training_phase) 
usage: wan vdsl2 set tx_fltr_type (fltr_for_cd_phase) (fltr_for_training_phase) 
usage: wan vdsl2 set tx_fltr_gain (tx_fltr_gain) (tx_fltr_dout_scale) (tx_upshift_bit)
usage: wan vdsl2 set tx_gain_offset (value)
usage: wan vdsl2 set st_period (period(sec))
usage: wan vdsl2 set st_task (on/off)
usage: wan vdsl2 set st_dbg (on/off/olr)
usage: wan vdsl2 set tpstc_type (0(ptm only)/1(ptm+atm))
usage: wan vdsl2 set gvector (1|2)
usage: wan vdsl2 set amd (0|1|2|3)
usage: wan vdsl2 set sync_check (on/off)
usage: wan vdsl2 set one_bit (on|off)
usage: wan vdsl2 set st_target_snrm (snrm)
usage: wan vdsl2 set target_snrm (snrm_dB)
usage: wan vdsl2 set manual_pms (on|off)
usage: wan vdsl2 set inp_snrm_roc (inp_min(symbol)) (snrm_offset(dB))
usage: wan vdsl2 set roc (on/off)
usage: wan vdsl2 set dual_lp (on|off)
usage: wan vdsl2 set fake_pms (on|off)
usage: wan vdsl2 set search_time_pms (time (# symbols))
usage: wan vdsl2 set rscg_pms (on|off)
usage: wan vdsl2 set largedelay_pms (on|off)
usage: wan vdsl2 set inpdelay_pms (inp_min0) (inp_min1) (delay_max0) (delay_max1)
usage: wan vdsl2 set ndr_pms (msg_min) (ndr_min0) (ndr_min1) (ndr_max0) (ndr_max1)
usage: wan vdsl2 set ins_inp (on/off)
usage: wan vdsl2 set sos (on/off/go)
usage: wan vdsl2 set sra_trans_method (0(non-seg)/1(seg))
usage: wan vdsl2 set sra_l_target off/(bits)
usage: wan vdsl2 set sra_step (on|off)
usage: wan vdsl2 set sra (on|off)
usage: wan vdsl2 set bs_param (snrm) (trigger) (scan_tone_num) (wait_cnt) (scan_start_idx) (scan_end_idx)
usage: wan vdsl2 set bs_1bit_change (on|off)
usage: wan vdsl2 set autobs (on|off)
usage: wan vdsl2 set bs_tx (on|off)
usage: wan vdsl2 set bs (on|off)
usage: wan vdsl2 set mgcnt_ovhd_test (on|off)
usage: wan vdsl2 set agc_vref (val1) (val2) (val3) (val4)
usage: wan vdsl2 set tcm (on|off)
wan vdsl2 show o_signature
wan vdsl2 show o_update
wan vdsl2 show o_prm
wan vdsl2 show o_taupdate
wan vdsl2 show o_msg1
wan vdsl2 show o_tps
wan vdsl2 show o_pms
wan vdsl2 show o_pmd
wan vdsl2 show r_msg1
wan vdsl2 show r_update
wan vdsl2 show r_prm
wan vdsl2 show r_taupdate
wan vdsl2 show r_msg2
wan vdsl2 show r_pms
wan vdsl2 show r_pmd
wan vdsl2 show dmt
wan vdsl2 show pilot_inf
wan vdsl2 show tssi
wan vdsl2 show pms_pmd tx
wan vdsl2 show pms_pmd rx
wan vdsl2 show st_soc_info
wan vdsl2 show bgtbl tx
wan vdsl2 show bgtbl rx
wan vdsl2 show errpwr init
wan vdsl2 show snrm st
wan vdsl2 show snr init
wan vdsl2 show snr st
wan vdsl2 show st_avg_snrm tx
wan vdsl2 show st_avg_snrm rx
wan vdsl2 show mgcnt

i noticed that connection improved when i used these commmands:

wan vdsl2 set tx_gain_offset 24.2
wan vdsl2 set rx_win on

wan vdsl2 set txpsd_drop_limit 255
wan vdsl2 set txpwr_diff -45
wan vdsl2 set txpwr_limit on -435
wan vdsl2 set rxfltr_gain 45
wan vdsl2 set tx_cp_len 37

wan vdsl2 set rx_fltr_type 0x000001f4 0x000001f4
wan vdsl2 set rxfltr_gain 0x000001f4
wan vdsl2 set tx_fltr_gain 0x000010cf 0x00000001 16
wan vdsl2 set cd_us_comp_value 40

usability – Improve flow for user action (increase conversion)

I’m not sure if this question fits here but I have a flow on my website that I’m trying to improve, my website is https://simonkomlos.com

I have 2 specific questions, but I’m open to all feedback:

  1. The main metric that matters to me is a] % of visitors who send me a doodle, and b] % of visitors that sign up for future project updates.

    Currently a] is at 6% and b] is ~75%

    I’m thinking about making the email field optional, as an attempt to increase the 6%.. the reason being it might seem less “sales-y” and more as just a fun project but I would love to hear your perspective on how you would increase that 6%.

  2. Secondly, I receive many lovely doodles.. here are a few: https://imgur.com/a/YORIKpB I would love to showcase them, how would you incorporate these doodles in the current website?

I’m curious for your feedback :-]

Can Google ads improve the traffic on the webiste?

Hello there,
we are working on our custom website for a few years now, we share the best and informative content for our customer and visitors. However, due to all our efforts, we are not able to get enough traffic for our website. So my question is would the traffic on our content and website will increase is we run Google ads? We didn't use Google ads before. So does it really work?

spells – How can you improve your Counteract check(s)?

Specifically for spells such as Dispel Magic, Restore Senses, Remove Disease, or Remove Curse, when you roll your Counteract check using your

relevant skill modifier or other appropriate modifier to your check against the target’s DC. (…) the counteract check modifier is your spellcasting ability modifier plus your spellcasting proficiency bonus, plus any bonuses and penalties that specifically apply to counteract checks.

the results are based both on your success with the dice and the level of the ability/spell used when performing the Counteract

Critical Success Counteract the target if its counteract level is no more than 3 levels higher than your effect’s counteract level.
Success Counteract the target if its counteract level is no more than 1 level higher than your effect’s counteract level.
Failure Counteract the target if its counteract level is lower than your effect’s counteract level.
Critical Failure You fail to counteract the target.

This means that, against level-appropriate effects, you are spending one of your higher spell slots (or similarly powerful resources) for the attempt to overcome a negative effect, requiring you to roll in the range of 8-12 to get a Success. That means, without modification, you can expect to fail at least 1/3 to 1/2 the time. Against some effects that this would represent a quality of life increase, this is fine… but when attempting to overcome permanent Blindness or Mummy Rot (for instance) you may not have the luxury of accepting failure.

When out of combat, what methods are available to boost your Counteract checks, particularly for spells?