Author Topic: Auto RETURN  (Read 4874 times)

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Auto RETURN
« on: 11 March 2012, 20:26:13 »
It's annoying when a unit runs off and goes on a one-man-crusade, especially when his sight radius is higher(like an archer). Multiple times I've had units run around and give away strategic bases I was building. It would be nice to have this toggleable, and defaulting too on.

All you would have to do is tell the unit to return the position it was idle at last. Because it attacks and then stops, but if is attacked then returns to the last idle spot, it'll go back to your base instead of sitting out being vulnerable.
« Last Edit: 12 March 2012, 13:23:45 by -Archmage- »
Egypt Remastered!

Proof: Owner of glest@mail.com

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Auto RETURN
« Reply #1 on: 12 March 2012, 13:22:08 »
Only asking for Auto-RETURN.
Egypt Remastered!

Proof: Owner of glest@mail.com

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #2 on: 23 July 2013, 18:42:54 »
It's one of those cases, when developers don't bother to fix the bug or implement an essential functionality, calling it "feature" instead. Already happened to me with Telerik, where you couldn't filter only by date (had to include time too), they said that it's not a bug and it's how it meant to be.

Knowing this won't be implemented, I tried to mess with source code myself and after spending the whole day figuring how to compile (f**king stackdumper) I finally make this feature working. To prove I'm not telling porkies lying I there is included video below. Sorry for bad quality, but it was my first screen capture video ever. It still needs testing as bugs may appear. Maybe annoying part is that unit needs to walk to the point of seen enemy even when it's defeated.

I know you left, but this feature may be useful for other players, but especially me. Even though developers probably won't like I mess with their code.

Edit by Omega: I need to fix the bloody Youtube code soon. In the meantime, here's a link since embedding isn't working properly: https://www.youtube.com/watch?v=veGYA2LQt4g
« Last Edit: 23 July 2013, 21:34:17 by Omega »

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Auto RETURN
« Reply #3 on: 23 July 2013, 21:31:30 »
Even though developers probably won't like I mess with their code.
That's not necessarily true. Even if the developers might disagree with a patch, I'm sure the community at least welcomes the ability to apply this patch themselves (one of the best things about open source programs).

Anyway, could you please upload a diff of your changes? The developers could consider implementing your changes, and if not, individuals have the option to apply the patch themselves.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #4 on: 23 July 2013, 22:26:02 »
I'm not skilled with svn, at work we use tfs with visual studio, what would be an equivalent of "view pending changes" if you know to do it?

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Auto RETURN
« Reply #5 on: 23 July 2013, 22:58:20 »
Code: [Select]
svn diff > filename.patchGenerally, in case your goal should be to get code merged, it's best not to blame developers for the decisions they may have made, but to try a positive approach.
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 · · ·

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #6 on: 26 July 2013, 13:51:39 »
Would that filename.patch file be enough?

However I would probably need to optimize, I don't do well in c++, maybe there are things that shouldn't be done, although when playing I didn't encounter issues except for rare crashings (mostly in debug mode though). Now I did also that unit returns if it ventures too far from guarding point, however the distance constant should be stored somewhere and not directly in the code (I would need to talk with developers).

Tomreyn, are you a developer too?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Auto RETURN
« Reply #7 on: 26 July 2013, 14:04:08 »
Would that filename.patch file be enough?
Yes.

However I would probably need to optimize, I don't do well in c++, maybe there are things that shouldn't be done, although when playing I didn't encounter issues except for rare crashings (mostly in debug mode though).
That's a good idea. Stability is pretty important. It should be determined if the crashes were due to your changes or because of something else (in which case, we need to find out what that is).

Now I did also that unit returns if it ventures too far from guarding point, however the distance constant should be stored somewhere and not directly in the code (I would need to talk with developers).
It's a bit slow for the summer, but the easiest way to get in touch with the devs real time is IRC channel (particularly #megaglest).
« Last Edit: 18 June 2016, 14:22:39 by filux »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #8 on: 26 July 2013, 16:18:15 »
Here is the patch file. Needs some reviewing though

http://pastebin.com/1hBNw6it

+

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Auto RETURN
« Reply #9 on: 26 July 2013, 23:19:49 »
Please rework / minimize the patch, you have both lots of removals followed by lots of inserts which look very much the same (possibly due to tab/space conversion or line endings?), as well as changes for files which I don't think you wanted to submit (*.vcproj) there.

I'm not a MegaGlest programmer, I just help with hosting, communication, strategy, and a bit of PHP and shell code.
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 · · ·

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Auto RETURN
« Reply #10 on: 27 July 2013, 07:35:25 »
Alternatively, if SVN diff is giving you issues and you know which files you modified, you can manually download the original files and compare your modified files with the originals.

On Linux (or Windows if you install MinGW), you could simply run diff file1.cpp file2.cpp > patch.diff, which will compare the files file1.cpp and file2.cpp and redirect the output to a file named patch.diff. If there are still excess lines in the diff (ie, lines stating changes where none occurred), you could try experimenting with flags like -E (ignores tab expansion), -b (ignores space changes), or --strip-trailing-cr, which strip carriage returns (on the Windows line feed).

If you're doing your development on Windows, which you appear to be from your video, you could use WinMerge, which I've found quite useful in the past. Not only should it be easy to see your changes in the GUI environment, but you can easily generate a diff (patch) from the tools menu.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #11 on: 27 July 2013, 10:38:39 »
Yes, I use visual c++ 2010 express. Not all files should included, I had to change main.cpp to disable stackdumper (I have no idea what is it) to make it compile even before doing changes. Files with actual changes are unit_updater.cpp, unit.h, unit.cpp, commander.cpp

EDIT: here are the patch files for changes

http://s000.tinyupload.com/index.php?file_id=96862498839128761174
« Last Edit: 30 July 2013, 21:20:54 by D.U.P.A. »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Auto RETURN
« Reply #12 on: 30 July 2013, 23:21:54 »
I did not try it yet, but this in general a good idea ( just different from what we have now ). I think this will also effect the AI behaviour in fights.

Thats the reason i don't want to aplly this patch now as we are already in a beta state for a release and I don't want to have a bigger change like this at the current point. I hope thats ok for you :-/ , but this has to wait a bit at the current point.
( @softcoder: please don't apply this now )
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #13 on: 31 July 2013, 19:31:32 »
But it will be avalaible after the current beta release (those versions which you need to get via svn instead of the installer)? Meanwhile I will maybe try to add some other features that could come handy and if I will be able to do them.

MirceaKitsune

  • Technician
  • ****
  • Posts: 147
    • View Profile
Re: Auto RETURN
« Reply #14 on: 12 August 2013, 13:47:31 »
I hear you... this is one of the things I dislike most as well. Sometimes I leave my units guarding an entrance when suddenly a few enemies come by. My units chase them but never come back after killing them. Slowly they find themselves near enemy towns where they get themselves killed. Would love to see this fixed.

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #15 on: 22 August 2013, 21:31:54 »
So this modification alters AI behaviour?

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: Auto RETURN
« Reply #16 on: 22 August 2013, 23:35:17 »
Unit's should not follow enemy units unless specifically told to.

the current unit follow behavior is very annoying.
WiP Game developer.
I do danish translations.
"i break stuff"

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Auto RETURN
« Reply #17 on: 22 August 2013, 23:47:29 »
So this modification alters AI behaviour?

Yes because if units Auto-return the Ai will not continue to advance toward enemy base, or even enemy long range units.
It would be best to somehow have auto return apply to human players, while Ai continues the old behavior.
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: Auto RETURN
« Reply #18 on: 23 August 2013, 00:44:45 »
Ishmaru, Then it doesn’t alter AI logic, Merely performance.

You mean to say this is how the current AI knows when to attack?, then you could just hide forever untill you have some suck superweapon(im aware there is no such thing.)

Obviusly this does not alter AI behavior.

Honestly, Units should not follow other units unless specifically told to.
WiP Game developer.
I do danish translations.
"i break stuff"

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Auto RETURN
« Reply #19 on: 23 August 2013, 01:48:05 »
Unit's should not follow enemy units unless specifically told to.
I disagree with you here. If I want to create a guard for my heavily turtled base, I simply have to move units to the entrance of my base. When the enemy attacks, my units will attack enemy units. This is possible only because the units follow the enemy. With hold position active, the unit will still attack, but will not follow. This is the opposite of your opinion: instead of explicitly telling units to follow, we explicitly tell units not to follow. If melee units do not follow, they can be easily decimated by ranged enemy units, so I maintain that following should be the default.

However, in my opinion, there should be a maximum follow distance, specified by mods. This would be the distance from the unit's original position which it will follow a foe with the intent to attack before it gives up. This would prevent a unit from being lured to an enemy base (provided the maximum follow distance is short enough). The distance must also be sufficiently large, though, or the unit will not be able to attack foes on, say, the other side of the player's base.

However, none of this applies to auto-return! Auto return is (presumably) used for the sole purpose of moving back to your original position after attacking a unit. It does not apply to instances where an enemy flees to its base. For example, suppose an enemy scout wanders into my base. My units, standing on guard, will run out to attack that scout. And when the scout dies, they stay there. The purpose of auto-return is to move back to their original positions (standing guard) instead of staying scattered at whatever position they were in when the scout was killed.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #20 on: 3 September 2014, 19:37:14 »
Still no feedback :C

kagu

  • Administrator
  • Horseman
  • ********
  • Posts: 203
    • View Profile
Re: Auto RETURN
« Reply #21 on: 4 September 2014, 09:41:57 »
Hey , I like this very much (at least for single player games) , how could I get to test it ?
Megaglest Chat
Please support:
1. CEGUI 2. In-process games 3. Registered Players
Playtime:
Every Sunday 21:00 - 01:00 CET

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #22 on: 5 September 2014, 12:27:39 »
The thing is that is for old version (I wasn't able to compile the new version on visual express 2012)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Auto RETURN
« Reply #23 on: 9 September 2014, 14:51:58 »
Ups ... I need to look at this again.
I looked at the diff a bit but this has far too many changes you made on your local copy. Needed are just the relevant parts.

I will try to find what I need if its not too difficult. If this does not work it should be reimplemented. ( Thats maybe something for omega ? )
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

D.U.P.A.

  • Guest
Re: Auto RETURN
« Reply #24 on: 10 September 2014, 17:30:10 »
However note it was done for 3.8 version, so they may be some outdated code

 

anything