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

APOC reversing

Discussion in 'Coding' started by Skin36, Oct 1, 2015.

  1. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    41/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    I started to work on reversing the basic mechanics of the game. Here is my first restored code for gereratora names. Names are assigned to the already established structure soldiers. I apologize for the fact that my code has a lot of inaccuracies in syntax, but as logic, then all right.
     
    makus likes this.
  2. JonnyH

    JonnyH Well-Known Member Official Developer Administrator
    64/112

    Joined:
    Jul 17, 2014
    Messages:
    181
    Likes Received:
    31
    Best Answers:
    0
    Interesting, thanks for this - I assume we're going to extend the name list at least. Any idea that the ratio of male/female/android? And on top of that the chance of mutants? And are the (non-mixed) races split evenly?

    I seem to remember having good relations to the mutant/android organisations increased the number of them you had available, though that might be confirmation bias :)
     
  3. Solarius Scorch

    Solarius Scorch Call to Power modder Global Moderator
    41/56

    Joined:
    Jul 8, 2014
    Messages:
    197
    Likes Received:
    5
    Best Answers:
    0
    Just out of curiosity, do androids have gender in Apocalypse? I mean, they get either male or female names, but do they have gender in any other respect, programming-wise? I guess they do, because they scream...

    I'll be honest here, I want to know what I'll be able to do as a modder. If they have normal genres, it'll be easy to just swap the pics to get more sensible android faces (more human). If they don't, I'd like to keep their robotic faces and give them more suitable, non-human names.
     
  4. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    Androids do not have gender for them is generated randomly (male or female name). The game has two function to generate names, possible names for the mutants are generated in another function. What of gender - it also is generated in another function. This function assigns a name to an already established structure of the soldiers.
    UPD.Mutants gender is defined as in humans.
     
  5. Solarius Scorch

    Solarius Scorch Call to Power modder Global Moderator
    41/56

    Joined:
    Jul 8, 2014
    Messages:
    197
    Likes Received:
    5
    Best Answers:
    0
    Good. Would it be possible then to have a completely separate names list for androids?
     
  6. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    I think as the mutants and androids own icons, it is logical to have their own names.
     
  7. Solarius Scorch

    Solarius Scorch Call to Power modder Global Moderator
    41/56

    Joined:
    Jul 8, 2014
    Messages:
    197
    Likes Received:
    5
    Best Answers:
    0
    I think mutants generally come from human families, or at least their ancestors pretended to be humans and therefore had human names. And they've been around for a century, so they should've been assimilated anyway.

    Androids, on the other hands, are a recent introduction, they are made instead of born, are generally not treated as people and furthermore they distance themselves from the mainstream culture. That's why I think that them having human names is odd.
     
  8. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    I noticed that when you create soldiers androids are of type 0, 4- mutants, people random number from 1 to 3. What would it mean values for these people?

    http://f6.s.qip.ru/tfn6TJBY.png

    I figured it technicians.
     
  9. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    unloaded from the game the constant for generation unit (structure of 106 bytes), and a structure for the generated units (206 bytes)
     
  10. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    The time counter
    Some work with the counter of time figuring out the algorithm of its work. It applies only to the main counter, and does not cover other aspects of the game, such as the drawing maps.
    So, the speed of the game depends on the BIOS clock counter -1/18 seconds by tick (INT 1Ah).
    slow -1/18 *36=2 seconds for one game count
    normal-1/18 *1/2*36=1 seconds for one game count
    double-1/18 *1/4*36=0.5 seconds for one game count
    quadruple-1/18 *1/6*36=0.3 seconds for one game count
    ultra =1 minute per tick (5* (minute/ 5 + 1)-This means that the minute interval are 5,10,15,20 ... per tick is show on clock)
     
  11. JonnyH

    JonnyH Well-Known Member Official Developer Administrator
    64/112

    Joined:
    Jul 17, 2014
    Messages:
    181
    Likes Received:
    31
    Best Answers:
    0
    Interesting - I'm not sure if we should exactly copy this here, as 36 updates/second is quite 'low' by modern standards without some kind of interpolation (most games really aim at a 60-fps for being visibly smooth).

    Still, as an aside, all the units stored in the data (stuff like vehicle 'speed') seem intrinsically linked to this update, so having a 'known' divider for that is good news, otherwise we'll be trying to do stuff like measure dosbox videos to try to relate the stored data values to ingame events.
     
  12. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
  13. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    the structure of audio files
     
  14. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    Found the data to draw the projectiles(in exe).They consist of indexes and sprites.Sprites have a size of 3x3.Total 35 sprite.Image projectile has a length of 36 bytes and is limited to setting a "Tail_length". "Tail_length" - the number of sprites in the drawing of the projectile. Bytes "FF" not displayed.
    The values for the drawing projectiles in HEX in the attached file.

    Function to draw projectiles:
    http://f5.s.qip.ru/tfn6TLXD.png
     
  15. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    I did generator units (gender, race, name) in Python. The code is taken from the original function.
     
  16. JonnyH

    JonnyH Well-Known Member Official Developer Administrator
    64/112

    Joined:
    Jul 17, 2014
    Messages:
    181
    Likes Received:
    31
    Best Answers:
    0
    That looks great Skin - I'll probably try to implement this in openapoc tomorrow.

    I did some initial prototypes for agent generation the other day, but so far everyone is called Steve. Which is less than perfect.

    As an aside - do we know what the chances of Android/Mutant agents to be created? Also if you're hostile to SELF for androids, or the mutant alliance for Mutants, apparently you can no longer hire that species. Does that mean you tend to get fewer available recruits?

    Also, I believe that due to the way that the stats appear to be partitioned into 'Human' 'Mutant' 'Android' and 'Scientist' I believe that means you can never get a non-human scientist? I guess if they don't have different stats it'll just be a portrait-photo difference, but would be nice to confirm,
     
    makus likes this.
  17. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
  18. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    some thresholds for relationships with organizations
    75...100 allied
    74...25 friendly
    24...-24 neutral
    -25...-49 unfriendly
    -50...-100 hostile

    if relation with SELF >= 0 possible hiring androids
    if relation with Mutant Alliance >= 0 possible hiring mutants
     
    makus likes this.
  19. JonnyH

    JonnyH Well-Known Member Official Developer Administrator
    64/112

    Joined:
    Jul 17, 2014
    Messages:
    181
    Likes Received:
    31
    Best Answers:
    0
    Interesting, so you can be 'neutral' to self/mutant alliance but still not be able to hire? (-24...0) Interesting, I never knew that. I guess it's because for whatever reason they always seemed to like me whenever I played.

    Transtellar, however, always seem to be hostile. I don't know if this would be considered a 'bug', as they always seem to become friendly to the Aliens, but I'm sure this would be an 'early' mod because it gets very annoying...
     
  20. Skin36

    Skin36 Well-Known Member Official Developer Administrator
    31/56

    Joined:
    Apr 5, 2015
    Messages:
    59
    Likes Received:
    10
    Best Answers:
    0
    the formula for calculating the improvement of relations with organizations
    http://pastebin.ru/4Px3hiaP
    Here is another important function
    http://pastebin.ru/QahhEFaa

    So, the formula
    pay_monay = 1000 *dif_enum+ 1000+ 2000 * dif_enum+ 4000+ funds / 10 * (dif_enum + 1) * v45 / 100;

    where dif_enum - 0...4 (difficulty level)
    v45 - all step 5 to the next level of relations
     
    makus likes this.

Share This Page