1. Forum moved (you can use login and pass from old forum)
  2. Many discussions moved to the bugtracker

Some suggestions for future builds (if any). Code inside

Discussion in 'Coding' started by letwolf, Apr 23, 2020.

  1. letwolf

    letwolf Registered

    Joined:
    Apr 10, 2020
    Messages:
    5
    Likes Received:
    5
    Best Answers:
    0
    1. Disruptor shields are fully recharged at battlescape starts:
    add this code in void Battle::initialUnitSpawn(GameState &state)
    after units are initialized
    // 100% for all disruptor shields at the begin of battle
    for (auto &p : units)
    {
    auto u = p.second;
    for (auto &item : u->agent->equipment)
    {
    if (item->type->type == AEquipmentType::Type::DisruptorShield &&
    item->ammo < item->getPayloadType()->max_ammo)
    {
    LogWarning("## Restored Shield ##"); // dummi
    item->ammo = item->getPayloadType()->max_ammo;
    }
    }
    }

    2. More funny Entropy Enzyme effects on people (detonates payload and weapons also, not only grenades)
    update in function void BattleUnit::applyEnzymeEffect(GameState &state) as the following:
    // Item destroyed
    if (item->armor <= 0)
    {
    if (item->type->type == AEquipmentType::Type::Grenade ||
    item->type->type == AEquipmentType::Type::Ammo ||
    item->type->type == AEquipmentType::Type::Weapon)
    {
    item->explode(state);
    }
    else
    {
    agent->removeEquipment(state, item);
    }
    }

    and in function void AEquipment::explode(GameState &state) comment these lines:
    /*
    auto bItem = ownerItem.lock();
    if (!bItem)
    {
    LogError("WTF? Exploding ammo/weapon in agent inventory???");
    break;
    }
    */

    3. I have tested at two pc, (Core i5-7600k), (Core i7-2600k) all projectiles in realtime seems two times slower as they look like in vanilla. That results in a lot of misses. I suggest setting global define PROJECTILE_VELOCITY_MULTIPLIER to 8 permanently and it seems like okay then.

     
    makus likes this.
  2. JonnyH

    JonnyH Well-Known Member Official Developer Administrator

    Joined:
    Jul 17, 2014
    Messages:
    183
    Likes Received:
    45
    Best Answers:
    0
    So the 'standard' way of proposing changes is to go to github.com/OpenApoc/OpenApoc, 'fork' the project, create a new branch on your fork (normally with a name that makes sense, e.g. "start_battlescape_with_shields_charged" or something), then you can open a "pull request (PR)" of that change against OpenApoc. It's normally a good idea to do a different branch and PR for each logical change, e.g. one for the shield fix and another for the entropy fix.

    This allows all our CI testing (builds, formatting etc.) to run against your proposed code, and comment/feedback while referencing the code easier - and then maybe modify things based on feedback. Then if we merge it, it'll have your name stamped on the code in git, so you get proper credit for helping :)
     
    makus likes this.
  3. letwolf

    letwolf Registered

    Joined:
    Apr 10, 2020
    Messages:
    5
    Likes Received:
    5
    Best Answers:
    0
    Ok. Sure that's the right way. Will try
    some more fixes will come:
    - auto restore shields and rechargeables at the start of battlescape (done)
    - fixing stuck vehicles in mid-air in some circumstances (I'm working on this now)
     
    makus likes this.
  4. makus

    makus Designer, forum admin Administrator Designer/Artist

    Joined:
    Sep 24, 2014
    Messages:
    307
    Likes Received:
    58
    Best Answers:
    2
    hey @letwolf sounds great
    so you want to make some mod? or want to try to code OA core or fix some bugs?
    you have some programming skills?
     
    letwolf likes this.
  5. JonnyH

    JonnyH Well-Known Member Official Developer Administrator

    Joined:
    Jul 17, 2014
    Messages:
    183
    Likes Received:
    45
    Best Answers:
    0
    I think all the issues Letwolf said they're looking at will require c++ code changes, so I assume they have some knowledge of the language, or at least a willingness and time to learn. Another good thing for PRs is they allow feedback on code styles/patterns etc. - so don't worry if you're not "Experienced" or write "good" code, we can beat it into shape together and hopefully learn something from it,

    Hell, they reason why I started working on openapoc was to learn the newer c++ revisions through doing, and in some (many?) places you can *tell* it's 'still learning'-level code :)
     
    makus likes this.
  6. letwolf

    letwolf Registered

    Joined:
    Apr 10, 2020
    Messages:
    5
    Likes Received:
    5
    Best Answers:
    0
    Hi! I like the game and wanted to help fixing some bugs.
    I have some c/c++ experience. Actually I found OA code very nice and easy-to-read.

    Some fixes that I ready to upload:
    1. Fixed the "stuck in mid-air" vehicles problem (shortly, 2 * Pi should equals to 0 in vehicle orientation test) (really nasty bug)
    2. Fixed bug(feature?) when civilian units of hostile organization shown as red dots, messing user interface
    3. Fixed bug when all transferring between base becomes unavailable when at least one storage is exceeded (bio, crew or cargo)
    (really nasty, I added some improved checks there)
    4. Items with rechargeable status fully restores at the battlescape start (shields, devastator cannons, etc). Was nasty.

    Sadly I haven't worked with GIT before. I have used TFS from Microsoft and TortioseHg instead.
    So I made branch named "Letwolf" in VS 2019 and Im trying to push it and leave some comments about the changes.
    I press "Push" in visual studio branch icon but it finishes with errors:

    >Pushing letwolf
    >Logon failed, use ctrl+c to cancel basic credential prompt.
    >Error encountered while pushing branch to the remote repository: Git failed with a fatal error.
    >unable to access 'https://github.com/OpenApoc/OpenApoc.git/': The requested URL returned error: 403
    >Pushing to https://github.com/OpenApoc/OpenApoc.git
    >Failed to push the branch to the remote repository. See the Output window for more details.

    I have no "enter login" form or "enter comments for branch" forms in the process. Very strange.
    What im doing wrong?
     
    makus likes this.
  7. FilmBoy84

    FilmBoy84 Well-Known Member Official Developer Administrator Tester Researcher Designer/Artist

    Joined:
    Oct 9, 2017
    Messages:
    114
    Likes Received:
    181
    Best Answers:
    9
    Welcome Letwolf! Really glad to hear you want to help with the project, and looking forward to seeing your work

    Have you created an account with github? Once you have you will need to ask myself, JonnyH or one of the other admin permission to be added to the project.

    You should then be able to give your GitHub credentials to the VS2019 settings or use GitHub Desktop to submit PRs to the main repo at https://github.com/OpenApoc/OpenApoc

    Warm regards
    Jacob / FB84
     
    makus likes this.
  8. makus

    makus Designer, forum admin Administrator Designer/Artist

    Joined:
    Sep 24, 2014
    Messages:
    307
    Likes Received:
    58
    Best Answers:
    2
    thats really great @letwolf then you can choose programmer user group here)
    http://openapoc.org/account/join-user-groups
     

Share This Page