Author Topic: Specialists not going obsolete  (Read 2089 times)

0 Members and 1 Guest are viewing this topic.

Offline Mart

Specialists not going obsolete
« on: December 09, 2017, 06:53:42 PM »

When working on a mod, I got the idea, that specialists may never go obsolete. Initially I wanted to decrease ICS strategy effectiveness, and it was supposed to be by tweaking specialists, so player would prefer to have more workers in a base, but with many modifications, I have them around the same total yield, though rearranged.




Recently I try these settings and all specialists can never go obsolete:




Code: [Select]


#CITIZENS
Technician,       Technicians,         None,    Disable, 3, 0, 1, 0000000
Doctor,           Doctors,             None,    Disable,-2, 4, 1, 0000000
Librarian,        Librarians,          InfNet,  Disable,-1, 0, 5, 0000000
Engineer,         Engineers,           Fusion,  Disable, 2, 0, 3, 0000000
Empath,           Empathi,             CentMed, Disable, 2, 3, 0, 0000000
Thinker,          Thinkers,            MindMac, Disable,-1, 3, 3, 0000000
Transcend,        Transcendi,          AlphCen, Disable, 1, 2, 4, 0000000




First 3 have larger yield by 1, not 3-2-3, but 4-3-4 with taking into account negatives.


Technician - best energy (ops in alphax.txt)
Doctor - best psych
Librarian - best research


Engineer has the same yield of 5, but switched from 3-0-2 to 2-0-3.
Engineer - best energy+research combination


Next 2 have also best combinations of energy+psych and psych+research, and yields of 5.
Empath - best energy+psych combination
Thinker - best psych+research combination


And the last one, in vanila it was ultimate specialist/citizen, but now, although the highest yield of 7 (in vanila 8 .) the particular areas are always worse than some previous specialist.
Transcend - combination: 1-2-4


The reason of negative energy is to nerf energy in mid-late game.
« Last Edit: December 09, 2017, 07:16:46 PM by Mart »

Offline Geo

Re: Specialists not going obsolete
« Reply #1 on: December 09, 2017, 10:12:46 PM »
Ah, negative energy is possible. Was pondering about that the other day.
Do you know if the same counts for negative psych and labs?

Have you ever experimented if those seven 'flags' (the zeros) after each specialist are active?

Also, can drones, talents, and workers increase labs, psych, and energy?

Offline Mart

Re: Specialists not going obsolete
« Reply #2 on: December 09, 2017, 11:12:32 PM »
Let me check negative psych and research, but I think it was working deducting points.
The only problem is that on the button in the game there is the plus sign, so the doctor shows +-2 for example.


[Edit]
Yes, negatives psych and research are deducted too. It works, though I saw -4 as -3 effect, not sure why.

Those zeros, I remember trying it, but there was no effect, that I would notice. There was more about them in the SMAC Academy on CGN?

Online Buster's Uncle

  • With community service, I
  • Ascend
  • *
  • Posts: 49430
  • €175
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: Specialists not going obsolete
« Reply #3 on: December 10, 2017, 12:41:50 AM »
I made up negative energy icons for scient about a million years ago, but he never got around to implementing whatever he was planning to do with it.  -Maybe he could be persuaded if many ask...

Offline scient

Re: Specialists not going obsolete
« Reply #4 on: December 10, 2017, 06:10:26 AM »
Do you still have the newicons.pcx with the negative icons? I thought I saved it, but I couldn't find it in my archives. Unlike a few years ago, I now have a much deeper understanding of how the internals all piece together. So let's see if we can do this!  :)

The exact location where the pcx and the resource icons are parsed in is as follows (using v2.0 of SMACX exe):
void __cdecl load_icons() : 0x454922 ; loops through 8 times calling 'Buffer::change_color' and 'Sprite::extract' for '1' to '8+'.

The sprites are then stored at this offset in an array: 0x007A72A0. This is a 4 x 8 array containing nutrients, minerals and energy. The good news is, the part of the array at the end is unused. The loop parses in a fourth resource that doesn't exist after minerals. So we have memory to store up to 8 sprites! I don't think tweaking the references should be too hard.


Offline scient

Re: Specialists not going obsolete
« Reply #5 on: December 10, 2017, 06:50:45 AM »
I tweaked the offsets to get the legacy resource icons loaded. Adding in the negatives will require some additional changes in the BaseWin drawing functions but I think should be doable.

Online Buster's Uncle

  • With community service, I
  • Ascend
  • *
  • Posts: 49430
  • €175
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: Specialists not going obsolete
« Reply #6 on: December 10, 2017, 03:57:31 PM »
I'll find or make a .pcx copy later when I'm awake.
« Last Edit: December 10, 2017, 09:05:02 PM by BUncle »

Offline scient

Re: Specialists not going obsolete
« Reply #7 on: December 10, 2017, 07:10:16 PM »
Sounds good. Are negative resources impactful all the way up to -8+? If we need 3x8 Sprites, then there won't be enough in the existing memory location. We have up to 8 additional icons for all 3 resources so really only 2 additional per resource. I'll see if I can find a memory location that would support an additional 3x8 sprites for just negatives.

Online Buster's Uncle

  • With community service, I
  • Ascend
  • *
  • Posts: 49430
  • €175
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: Specialists not going obsolete
« Reply #8 on: December 10, 2017, 08:25:07 PM »
That what you asked for at the time, I think.   They're placed side by side, but I could certainly do up a copy with those moved up to replace the legacy resource icons above that you enabled.  You can, of course, only use as many as needed...

Offline scient

Re: Specialists not going obsolete
« Reply #9 on: December 10, 2017, 08:54:09 PM »
Let me do some more investigation into negative resources. I would say putting them above would work as well. You could just shift legacy drone, talent and citizen icons over or something.

Online Buster's Uncle

  • With community service, I
  • Ascend
  • *
  • Posts: 49430
  • €175
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: Specialists not going obsolete
« Reply #10 on: December 10, 2017, 09:04:21 PM »
Here's what you had me do back in March of 09.  Let me know if you need changes...

Offline scient

Re: Specialists not going obsolete
« Reply #11 on: December 11, 2017, 02:05:14 AM »
That should work. I think I found some space I could load the Sprites into. I'm digging a bit more into negative resource calculation. What happens when you click on a base:

BaseWin::on_redraw() =>
BaseWin::draw_farm(int) =>
resource_yield(int,int,int,int,int) => called for each tile with resources for base
crop_yield(int,int,int,int,int) ; mine_yield(int,int,int,int,int) ; energy_yield(int,int,int,int,int);

Each of the individual yield values get stored into an array inside BaseWin::draw_farm. Then there is a bounds check to see if it is < 0, set to 0 or > 7, set to 7. It then uses this zero offset value to pull up a Sprite for the particular resource ('1', '8+').  I'll have think about the best way to stitch them all together, whether 2 x 3 x 8 or 3 x 16 array.

Unlike before, I'm pretty certain I can figure out how to get this all working. So hopefully I can provide some patch data to roll into Yitzi or whoever's patch. :)

On another note, inside newicons.pcx I've highlighted the only areas the game parses.

Top left: It looks like while it loads a 16 Sprite array, it only references the yellow shield (0,1) inside BaseWin::draw_supported(BaseWin *this, int). Might be possible to steal some of this memory for negative resources.
 
Null resource icon: If yield for a particular tile equals zero. Used by BaseWin::draw_farm.

Peace symbols: Used by BaseWin::draw_supported, adds icon badge to units in bottom left panel if flag is met.

Resource icons: Used by BaseWin::draw_farm.

Citizen, Specialist "cursors": These are considered cursors rather than icons internally. Used in a couple different places. These are broken down into two groups of female/male citizens (talent, worker, drone 1, drone 2; 2x4x2=16 total) and specialists (2x7=14 total). Alien Sprites are in aliencit.pcx.

The rest is unused and never even touched by the game.



Offline scient

Re: Specialists not going obsolete
« Reply #12 on: December 11, 2017, 07:20:35 AM »
There is an issue with the modified PCX alpha layer compared to the original. I have no idea about the creation of PCX files, so I'll leave that for someone with more modding experience to work out. Otherwise, all the logic is there and working from what I can tell. I don't have a saved game with negative resources, so I just forced a few of the yield values to return negative for the screenshot.

I had to shift around some Texture, Sprite, and CaviarData global memory locations along with disabling the allocation of unused Sprites. The unused Sprites were allocated, but never actually loaded with Sprite data or referenced. There is one Sprite that is referenced, but it is all zeroed data so effectively does nothing. There are quite a few modified bytes to get this to work (289 bytes, in 51 different locations), but most are just shifting of addresses so I could expand the resource icon Sprite vector variable. This wasn't put through extensive testing, but everything should be working okay. The only code area that had more significant patching done to it is BaseWin::draw_farm. I redirected the offset calculation logic into some dead code space formally used by one of the unused Sprite allocations.

The attached exe is SMACX v2.0 binary without any other patches applied.  Yitzi is welcome to roll this into his binary (or anyone else for that matter with credit attributed). I haven't looked to see if my Sprite optimizations would interfere with the changes he has done.

I know this has been a requested mod for some time. While I haven't done much in the way of actual fixes or mods for the community in many years, I've made significant progress with my analysis of the SMACX binary. So this is an early holiday present for everyone with hopefully more things to come in the future!  :D
« Last Edit: December 15, 2017, 06:17:39 AM by scient »

Online Buster's Uncle

  • With community service, I
  • Ascend
  • *
  • Posts: 49430
  • €175
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: Specialists not going obsolete
« Reply #13 on: December 11, 2017, 01:13:44 PM »
This is the 'blue box around my bases' problem.  I know what I did wrong this time.  I'll have to dig up my copy of Photoshop CS, and I'll have a fixed copy up in a few hours.

Offline Mart

Re: Specialists not going obsolete
« Reply #14 on: December 11, 2017, 07:01:10 PM »
color palette problem?

 

* User

Welcome, Guest. Please login or register.

Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

Each individual pipe contains a hot slurry of minerals drawn from Planet's crust and makes a sound like rain falling on a tin roof. When they converge on the trunkline the sound is a terrifying thunder, a thunder of untold wealth, and power.
~Captain Ulrik Svensgaard 'Tending the Sea'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 38.

[Show Queries]