[Suggestion] energy system ideas
RE: energy system ideas Posted on: 01/31/2015 6:39pm
Quote Post
The Ignorant Masses Posted on: 01/26/2015 10:33am

Fortifying doesn't effect geo-eff, so it's not recaltulated here.
For evacing, average time is 1.1s
For capturing empty land, average time is 1.4s
For attacking another nation, average time is 2s
Running a few tests, a 5K nation attacking another 5K nation (5K as in the number of tiles), we're talking close to 3.6s

Do you calculate the tiles every time an attack/evac is done? I mean do you load every tile and look at its faces or just the 5 that you actually need. If you attack or evac its always just 1 tile that changes plus the 4 connecting ones. No matter how big a nation is this should take the same time.

If each nation has an entry for tiles and faces you only have to update that on changes. If i add land to my nation i get 1 tile and 4 faces max. Then you only have to retrieve the 5 entries for the 5 tiles affected. I have no idea how to do that with SQL but this is how you would calculate it.
 

// ON SUCCESSFUL ATTACK
$tiles++;
$new_faces = 4;
if ($x-1 == OWNED) $new_faces--;
if ($x+1 == OWNED) $new_faces--;
if ($y-1 == OWNED) $new_faces--;
if ($y+1 == OWNED) $new_faces--;

// ON EVAC OR IF BEING ATTACKED
$tiles--;
$new_faces = 0;
if ($x-1 == OWNED) $new_faces++;
if ($x+1 == OWNED) $new_faces++;
if ($y-1 == OWNED) $new_faces++;
if ($y+1 == OWNED) $new_faces++;

 

If you are already doing it this way forget what i just wrote. I just think this action should take the same time no matter whom is attacking here.




khwar.com
RE: energy system ideas Posted on: 01/31/2015 9:38pm
Quote Post
TIM the Enchanter
Level: 1
ADR Info

Right now, I'm doing entire re-calcs.  I pull everything and run with it.  There's a few more mechanics that I planned on running with later that will require some extra calcs.

Anyway, I always go with the most secure methodology.  For this, I ned to re-write to make it more efficient. :P





Everything's coming up KongHack!

"When you know nothing matters, the universe is yours" ~Rick Sanchez

RE: energy system ideas Posted on: 01/31/2015 11:24pm
Quote Post
TIM the Enchanter
Level: 1
ADR Info

FUCK.....

while this would work in normal circumstances, that is when 1 tile is being changed, the geographic relocation changes 2 at the same time.  Huh...





Everything's coming up KongHack!

"When you know nothing matters, the universe is yours" ~Rick Sanchez

RE: energy system ideas Posted on: 02/01/2015 2:42am
Quote Post

Well, if more than one tile changes you could always call the calculation for each changed tile. I think you'd have to do it twice on an successful attack anyways, once for the attacker and once for the defender.

Hm, then there is counter attack as well. So it might be a bit more complicated then i thought. sad




khwar.com
RE: energy system ideas Posted on: 02/01/2015 9:08am
Quote Post
TIM the Enchanter
Level: 1
ADR Info

Yup.  A successful counter attack on a person using geo relocation would throw things way off as well.  Would I run these before updating the map record, after, both?

Complete re-hashing is working for now.  I'm thinking of splitting things into quadrants and running with a delta system for hashing this shit out.





Everything's coming up KongHack!

"When you know nothing matters, the universe is yours" ~Rick Sanchez

RE: energy system ideas Posted on: 02/01/2015 10:55pm
Quote Post

Neat, there's a thread talking about this (I'd mentioned it on the side in a PM).  You don't want to do global recalcs, they're too expensive.  The system ZuckeR noted (and I noted in the PM) is the right way to do stuff like this.  Subroutines are 'nation gains tile' and 'nation loses tile', successful attack calls lose (if not open land) then gain.  Evac, or failed attack with successful counter calls lose.  Failed attack with successful counter-and-invade calls lose then gain.

Naturally, all the calcs that start with 'faces and size and air power and blah blah' need to be done each time, but those are all very cheap compared to global face calc.

RE: energy system ideas Posted on: 02/02/2015 10:07am
Quote Post

As far as i understood TIM he wants to do some more complicated calculations later on. If that involves the shape of the whole country or something like that he might still want to pull the a complete list of occupied tiles. The question would be what he wants to do and maybe if that could be a special routine that might take longer but does not run as often. Just as abandoning a huge nation will take huge amounts of time.

But i think you are right, you could call the subroutines more than onces as long as they take way less computation time in total.




khwar.com
RE: energy system ideas Posted on: 02/02/2015 1:44pm
Quote Post

Hmm, I'd started working up a complex-but-theoretically-more-real-results algorithm, but I came to the conclusion that that wasn't what TIM was looking for, and I *think* the way it's being done now is localized.  Perhaps we should wait for him to weigh in.

RE: energy system ideas Posted on: 02/27/2015 1:11pm
Quote Post

This game is quite fun and strategic. energy system sounds quite good in my opinion. it adds diversity to the game.

RE: energy system ideas Posted on: 02/27/2015 2:35pm
Quote Post
TIM the Enchanter
Level: 1
ADR Info
readz Posted on: 02/02/2015 1:44pm

Hmm, I'd started working up a complex-but-theoretically-more-real-results algorithm, but I came to the conclusion that that wasn't what TIM was looking for, and I *think* the way it's being done now is localized.  Perhaps we should wait for him to weigh in.


Everything is server sided. :D





Everything's coming up KongHack!

"When you know nothing matters, the universe is yours" ~Rick Sanchez