Skip to content

Commit

Permalink
Improve AI for 0.4.1 (Revolutionary-Games#705)
Browse files Browse the repository at this point in the history
* made slight changes to aggression calculations., Ill definetly have to do more then this to make things properly challenging and sensible , especially once pilus are in.

* Cleane dup AI code to match teh rest of the code, and started working on improving the AI

* Cleaned up AI more, and they seem to be more aggressive now, i want to change it so they peg a prey item instead of always targeting nearest now, that should make it even better.

* Added a comment detailing my plan for the next change.

* prey now gets pegged properly (lots of null pointer errors though, will fix soon)

* am trying to fix null pointer error with no success, AI works really well at predating now.

* fixed null pointer error finally. Now to work on improving fleeing.

* AI now flees properly when they notice predators nearby, no matter what they may have been in the middle of doing. Its not balanced though, i need to work on it more.

* Simplified AI code even more., it now calls a method when doing checks instead of directly doing the same expression each time. Yay for modularization.

* cleaned up fleeing code immensely, also fine tuned fleeing behavior (they also flee when being engulfed, no matter what)

* Improved fleeing even more, also fleeing is less chaotic.

* Prey now flees when they spot a predator at double the distance of previously, made it easier for them to fail their check (so they run), and made things flee at the same speed they used to flee.

* Fixed bug that made creatures being engulfed, totally unable to move (it would continuously apply a movement factor that divide dit without resetting), improved fleeing behavior more.

* Predators now get bored again.

* ran code formatter again, and tweaked AI more.

* removed pointless greyscale filter i added to disabled buttons ages ago, which did absolutely nothing except break my tooltips (yes everything still looks disabled fine)

* removed now unused disabled button class so the formatter stops complaining.
  • Loading branch information
Untrustedlife authored and hhyyrylainen committed Jan 5, 2019
1 parent 399a37c commit f38917b
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 213 deletions.
6 changes: 6 additions & 0 deletions scripts/gui/thrive_gui.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@
</span>
<div id="ChloroplastIcon"></div>Chloroplast<br>40 MP</td>
<td id="addThermoplast" class="OrganelleListItem DisabledButton">
<span class="tooltiptext">
Chloroplast<hr><br> Cost: 40 mutation points<hr><br>
Performs Process: Photosynthesis<br>(1 glucose)/Second<hr><br>
A captured prokaryote used by eukaryotic cells to perform photosynthesis.<br>
The chloroplast is used primarily by plant cells on earth, but some ciliates and other organisms use it too.
</span>
<div id="ThermoplastIcon"></div>Thermoplast<br>40 MP</td>
</tr><tr>
<td id="addVacuole" class="OrganelleListItem">
Expand Down
9 changes: 1 addition & 8 deletions scripts/gui/thrive_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,6 @@ video {
flex-direction: column;
}

.DisabledButton {
filter: grayscale(100%);
}

.DisabledButton:hover {
filter: grayscale(100%);
}

.MenuButton.DisabledButton {
background-image: url("../../Textures/gui/bevel/MenuDisabled.png");
}
Expand Down Expand Up @@ -1090,6 +1082,7 @@ video {
visibility: visible;
}


#PlastidIcon {
position: relative;
left: calc(50% - 30px);
Expand Down
8 changes: 4 additions & 4 deletions scripts/microbe_stage/configs.as
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ const auto MIN_BACTERIAL_LINE_SIZE = 3;
const auto MAX_BACTERIAL_LINE_SIZE = 6;

// What is divided during fear and aggression calculations in the AI
const auto AGRESSION_DIVISOR = 100.0f;
const auto FEAR_DIVISOR = 100.0f;
const auto AGRESSION_DIVISOR = 25.0f;
const auto FEAR_DIVISOR = 25.0f;
const auto ACTIVITY_DIVISOR = 100.0f;
const auto FOCUS_DIVISOR = 100.0f;

Expand Down Expand Up @@ -140,10 +140,10 @@ const float RELATIVE_VELOCITY_TO_BUMP_SOUND = 6.0;
const float INITIAL_EMISSION_RADIUS = 0.5;

// The speed reduction when a cell is in rngulfing mode.
const uint ENGULFING_MOVEMENT_DIVISION = 3;
const double ENGULFING_MOVEMENT_DIVISION = 2.0f;

// The speed reduction when a cell is being engulfed.
const uint ENGULFED_MOVEMENT_DIVISION = 6;
const double ENGULFED_MOVEMENT_DIVISION = 1.7f;

// The amount of ATP per second spent on being on engulfing mode.
const float ENGULFING_ATP_COST_SECOND = 1.5;
Expand Down
7 changes: 6 additions & 1 deletion scripts/microbe_stage/microbe.as
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ class MicrobeSystem : ScriptSystem{
private void updateAliveCell(MicrobeSystemCached@ &in components, uint logicTime)
{
auto microbeEntity = components.entity;

MembraneComponent@ membraneComponent = components.fifth;
RenderNode@ sceneNodeComponent = components.third;
CompoundAbsorberComponent@ compoundAbsorberComponent = components.first;
CompoundBagComponent@ compoundBag = components.sixth;
MicrobeComponent@ microbeComponent = components.second;
microbeComponent.movementFactor = 1.0f;
//LOG_INFO(""+logicTime);

// Recalculating agent cooldown time.
Expand Down Expand Up @@ -439,7 +439,12 @@ class MicrobeSystem : ScriptSystem{
Float4(0.2,0.5,1.0,0.5));
}

if(microbeComponent.engulfMode){
microbeComponent.movementFactor = microbeComponent.movementFactor/ENGULFING_MOVEMENT_DIVISION;
}

if(microbeComponent.isBeingEngulfed){
microbeComponent.movementFactor = microbeComponent.movementFactor/ENGULFED_MOVEMENT_DIVISION;
//LOG_INFO("doing engulf damage");
MicrobeOperations::damage(world,microbeEntity,ENGULF_DAMAGE/logicTime,
"isBeingEngulfed - Microbe.update()s");
Expand Down
Loading

0 comments on commit f38917b

Please sign in to comment.