Author Topic: Suddenly accelerates the rate of people walking!  (Read 1082 times)

james876

  • Guest
Suddenly accelerates the rate of people walking!
« on: 25 June 2011, 04:00:32 »
Today, I tested the svn-2376, found a bug: When I lead my team to attack the enemy, they attacked the enemy in time, walking speed and attack rate suddenly accelerates, worker go to a distant place built building, speed suddenly accelerated.
 BTW (1):
 I carried out a single game.
 BTW (2): My operating system is; win7 32bit.

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Suddenly accelerates the rate of people walking!
« Reply #1 on: 25 June 2011, 21:37:54 »
Titi + I have also seen this. I think it's under examination.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Suddenly accelerates the rate of people walking!
« Reply #2 on: 25 June 2011, 22:28:26 »
Try the latest svn rev2386 and let me know if you still have this problem.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Suddenly accelerates the rate of people walking!
« Reply #3 on: 26 June 2011, 23:39:16 »
Yes its still there. I verified that it was introduced with svn checkin 2376.
I think the current attempt to calculate random amounts of path steps is wrong . I tried it with another attempt locally without side effects so far ( too dirty to checkin ):

what I did:
I removed the current random way and used pathFindExtendRefreshNodeCountMax nodes in all places.
Then in PathFinder::findPath() I did this:  It should drop the last nodes in a random way and force a new calculation. By this we get differents start moments for the next calculation
Code: [Select]
TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStuck, int frameIndex) {
if(map == NULL) {
throw runtime_error("map == NULL");
}
if(frameIndex >= 0) {
clearUnitPrecache(unit);
}

if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
char szBuf[4096]="";
sprintf(szBuf,"[findPath] unit->getPos() [%s] finalPos [%s]",
unit->getPos().getString().c_str(),finalPos.getString().c_str());
unit->logSynchData(__FILE__,__LINE__,szBuf);
}

//route cache
if(finalPos == unit->getPos()) {
if(frameIndex < 0) {
//if arrived
unit->setCurrSkill(scStop);
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugPathFinder).enabled == true) {
string commandDesc = "none";
Command *command= unit->getCurrCommand();
if(command != NULL && command->getCommandType() != NULL) {
commandDesc = command->getCommandType()->toString();
}
char szBuf[1024]="";
sprintf(szBuf,"State: arrived#1 at pos: %s, command [%s]",finalPos.getString().c_str(),commandDesc.c_str());
unit->setCurrentUnitTitle(szBuf);
}

return tsArrived;
}

!!!!!!!!!!!!!!!!!!! new part here
UnitPathInterface *path= unit->getPath();
if(path->getQueueCount() > pathFindExtendRefreshNodeCountMin){
if(factions[unit->getFactionIndex()].random.randRange(pathFindExtendRefreshNodeCountMin,
        pathFindExtendRefreshNodeCountMax) == pathFindExtendRefreshNodeCountMin){
// empty path and recalculate
if(dynamic_cast<UnitPathBasic *> (path) != NULL){
UnitPathBasic *basicPath= dynamic_cast<UnitPathBasic *> (path);
while(!path->isEmpty()){
basicPath->pop(true);
}
}
else if(dynamic_cast<UnitPath *> (path) != NULL){
UnitPath *advPath= dynamic_cast<UnitPath *> (path);
while(!path->isEmpty()){
advPath->pop();
}
}
}
}
!!!!!!!!!!!!!!!!!!!!! new part end
if(path->isEmpty() == false) {
if(dynamic_cast<UnitPathBasic *>(path) != NULL) {
//route cache
UnitPathBasic *basicPath = dynamic_cast<UnitPathBasic *>(path);
Vec2i pos= basicPath->pop(frameIndex < 0);

if(map->canMove(unit, unit->getPos(), pos)) {
if(frameIndex < 0) {
unit->setTargetPos(pos);
}
return tsMoving;
}
}
else if(dynamic_cast<UnitPath *>(path) != NULL) {
UnitPath *advPath = dynamic_cast<UnitPath *>(path);
//route cache
Vec2i pos= advPath->peek();
if(map->canMove(unit, unit->getPos(), pos)) {
if(frameIndex < 0) {
advPath->pop();
unit->setTargetPos(pos);
}
return tsMoving;
}
}
else {
throw runtime_error("unsupported or missing path finder detected!");
}
}

if(path->isStuck() == true && unit->getLastStuckPos() == finalPos &&
unit->isLastStuckFrameWithinCurrentFrameTolerance() == true) {

//printf("$$$$ Unit STILL BLOCKED for [%d - %s]\n",unit->getId(),unit->getFullName().c_str());
return tsBlocked;
}

Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Suddenly accelerates the rate of people walking!
« Reply #4 on: 27 June 2011, 09:12:08 »
temporarily fixed in svn, but now there is no more random for path calculations.

 james876: By the way, what about a language file for your language?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios