Ghost images

Discussion of all aspects of the game engine, including development of new and existing features.

Moderators: Forum Moderators, Developers

Post Reply
JaMiT
Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Ghost images

Post by JaMiT » February 26th, 2012, 10:09 pm

Let me start with some background. (Those not interested in the background can skip to the third paragraph.) There have been times playing Wesnoth when the game seemed a bit dull -- not "dull" as in unexciting, but "dull" as in "unintelligent". I am referring to fogged scenarios, and "discovering" units. There have been times when I was moving a unit, only to have the movement interrupted because an enemy was sighted. Fine, that's good, but the enemy is over that way, and I was headed this way, so I just continued my move and let the enemy fade back into the fog. Ah, but my units are working in teams, so the next move is to have my unit's partner catch up. But the partner unit's move gets interrupted because -- surprise! -- an enemy unit was spotted, in the same place as before, in fact the same unit as before. Who would've thunk'd it? :roll:

While I was poking around Wesnoth's source code, I noticed that tools existed that could make unit spotting more intelligent, but they were in the wrong spots for such a goal. So I moved some stuff around, added a few missing pieces, maybe embellished a bit, and came up with Wesnoth remembering what had been seen earlier in the current turn. Then I did a forum search and found [interface] Ghost image in the Ideas forum, and figured it should not be too hard to add images to what I had already done....

So that leads to this post. I have a patch that will cause units that get recovered by fog to still be rendered until the start of the side's next turn. They will disappear should the hex be uncovered again, and they will not change if the unit they represent should move or otherwise change (such as by WML event). They can be moused over to see their stats, but they cannot be clicked upon, nor do they impact pathfinding. They are shown, but not really there, mere ephemeral images painted upon a misty canvas, figments to be lost upon the coming of dawn (particularly if the current turn is "second watch").
ghost-units.diff
Patch for adding images of re-fogged units.
(35.03 KiB) Downloaded 196 times
The problem I have is that this is a rather far-reaching patch, affecting a dozen files. This exceeds my ability to foresee problems, so I wonder if there is anyone out there that would like to give these changes a torture test? Or even just try it out and see if it is useful or adds to the fun factor. (One thing that possibly should be added: currently the ghost images are not preserved through a save-reload.) If it does work out, there is also the question of whether or not this is something to be considered for official Wesnoth, but for now I would like to know if it works the way I think it does.

One technical note about the patch: if there are any version conflicts with this patch (my copy of the source files is several weeks old), I suggest, for testing purposes, to ignore changes to the trunk for most of these files, but ignore this patch's changes to play_controller.cpp. Of course, that is only for testing purposes, and I can make an updated .diff if it comes to that.

Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Re: Ghost images

Post by Boucman » February 27th, 2012, 10:00 pm

hey, nice change, way deeper in code that what we are used to...

please submit this patch at patches.wesnoth.org, it's the best way to not get it burried in the forums

if you think your patch is too huge, you might want to separate in multiple logical patches (reorganisation, infrastructure changes, new feature itself is quite common)

you added yourself to about.cfg (which is good) but didn't add an entry to the changelog

last but not least, this is an interface change, these tend to be slower to get in, so don't expect us to merge it fast. but we'll try to review it soon..
Fight key loggers: write some perl using vim

Anonymissimus
Inactive Developer
Posts: 2460
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Ghost images

Post by Anonymissimus » February 27th, 2012, 10:42 pm

I wouldn't be too enthusiastic though.
This is something related to "sighting", and it is (should be) well known that everything related in the engine is thoroughly buggy. (And thus we have this ON_SIGHTING macro in core etc etc.)
Just search for bugs assigned to Crab.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign

JaMiT
Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Ghost images

Post by JaMiT » February 28th, 2012, 1:52 am

Boucman wrote:please submit this patch at patches.wesnoth.org, it's the best way to not get it burried in the forums
I will (eventually). I still want to run some more tests, and thought making it available via the forum would let others test it if they wanted to. (That is also pretty much the reason I did not get to the changelog yet.)

For the logical patches, would they be better as multiple submissions at patches.wesnoth.org, or just multiple files attached to a single submission?
Anonymissimus wrote:This is something related to "sighting", and it is (should be) well known that everything related in the engine is thoroughly buggy.
Yes, there are some systematic bugs related to sighting, but they do not look insurmountable to me. *shrug* I'm doing this to see what I am capable of doing. Maybe tackling the sighting bugs might be fun.

Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Re: Ghost images

Post by Boucman » February 29th, 2012, 8:44 pm

multiple files in a single submission, thx
Fight key loggers: write some perl using vim

JaMiT
Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Ghost images

Post by JaMiT » March 1st, 2012, 8:17 pm

Submitted a slightly updated (and split) version as patch [patch]3176[/patch].
(I'm still open to discussions of this feature here.)

Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Re: Ghost images

Post by Boucman » March 3rd, 2012, 7:04 am

ok, i'll look into it, but since it's a big feature it will most likely take time to review....
Fight key loggers: write some perl using vim

JaMiT
Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Ghost images

Post by JaMiT » March 3rd, 2012, 7:09 pm

Boucman wrote:it will most likely take time to review....
No rush on my end. I just wanted to get back to some real C++ coding and chose BfW to look at. I'm happy just making things work, but it seems logical to also submit what I've done so others might benefit from it. It's up to you guys to decide when -- or even if -- anything goes into an official release.

Post Reply