Re: Building a map, start of a project, help will be needed
Re: Building a map, start of a project, help will be needed
OK, Sounds Great!
I'm Curious as to how you are "Inputting " this "path-routine" into the game.
Have you found a way of adding this into a ( csv ) file?
I will follow this with Interest!
davinci
I'm Curious as to how you are "Inputting " this "path-routine" into the game.
Have you found a way of adding this into a ( csv ) file?
I will follow this with Interest!
davinci
The only true logic is that, there is no true logic!
Re: Building a map, start of a project, help will be needed
Hi Davinci.OK, Sounds Great!
I'm Curious as to how you are "Inputting " this "path-routine" into the game.
Have you found a way of adding this into a ( csv ) file?
I will follow this with Interest!
davinci
For the moment I'm "stuck" with custom images and INIs data sources.
I don't know if interfacing with the game CSV parsing routines is worth the effort, honestly.
Probably I'm going to use directly an open-source library for that (or maybe JSON)...
I'll decide in a couple of days at worst.

Sometimes I wonder how much we shall love this game, for doing such completely insane things. :silly:
Code: Select all
static const stbi_io_callbacks stbi__memfile_callbacks =
{
[](void *user, char *data, int size) -> int { // read
auto file = static_cast<sowwl_v103_types::CWMemFile *>(user);
return sowwl_v103_bind::CWMemFile::readBytes(file, data, size);
},
[](void *user, int n) -> void { // skip
auto file = static_cast<sowwl_v103_types::CWMemFile *>(user);
sowwl_v103_bind::CWMemFile::setPos(file, sowwl_v103_bind::CWMemFile::getPos(file) + n);
},
[](void *user) -> int { // eof
auto file = static_cast<sowwl_v103_types::CWMemFile *>(user);
return sowwl_v103_bind::CWMemFile::eof(file);
}
};
typedef std::unique_ptr<stbi_uc[], void(*)(void *)> ImageDataPtr;
auto m_walkabilityMapImgData = ImageDataPtr(nullptr, [](void *) {});
auto m_walkabilityMapImgSize = -1;
char walkabilityMapFileName[MAX_PATH];
strcpy_s(walkabilityMapFileName, sowwl_v103_bind::theRender.grayscaleFileName_4e0.c_str());
{ auto p = strchr(walkabilityMapFileName, '.'); if (p != nullptr) *p = '\0'; }
strcat_s(walkabilityMapFileName, "-WalkabilityMap.png");
sowwl_v103_types::CWMemFile file;
sowwl_v103_bind::CWMemFile::ctor(&file);
sowwl_v103_types::CGameWFileEnum fileEnum;
sowwl_v103_bind::CGameWFileEnum::ctor(&fileEnum, "Maps\\", walkabilityMapFileName, nullptr, UINT8_C(0));
if (fileEnum._unk_30_.size() != 0) {
while (sowwl_v103_bind::CGameWFileEnum::getNextMemFile(&fileEnum, &file, true, nullptr)) {
int width, height, numOfChannels;
m_walkabilityMapImgData = ImageDataPtr{
stbi_load_from_callbacks(&stbi__memfile_callbacks, &file, &width, &height, &numOfChannels, 1),
[](void *data) { stbi_image_free(data); }
};
if (m_walkabilityMapImgData) {
assert(width == height); // square image
m_walkabilityMapImgSize = width;
break;
}
}
}
sowwl_v103_bind::CGameWFileEnum::dtor(&fileEnum);
sowwl_v103_bind::CWMemFile::dtor(&file);
Code: Select all
using fn_CIniFileStorage_parseInt_t = std::add_pointer<int(__cdecl)(void *, const char *, const char *, int)>::type;
using fn_CIniFileStorage_parseFloat_t = std::add_pointer<float(__cdecl)(void *, const char *, const char *, float)>::type;
g_shrubberyHBillboardRenderer.setEnabled(std::min(reinterpret_cast<fn_CIniFileStorage_parseInt_t>(sowwl_v103_bind::CIniFileStorage::fn_parseInt_addr)(iniFileStorage, "ShrubberyRendererV2", "Enabled", 0), 2));
if (g_shrubberyHBillboardRenderer.getEnabled() != 0) {
g_shrubberyHBillboardRenderer.setAlphaCutoff(reinterpret_cast<fn_CIniFileStorage_parseFloat_t>(sowwl_v103_bind::CIniFileStorage::fn_parseFloat_addr)(iniFileStorage, "ShrubberyRendererV2", "AlphaCutoff", 0.5f));
}
Last edited by r59 on Tue Sep 10, 2019 8:00 pm, edited 1 time in total.
Re: Building a map, start of a project, help will be needed
Yeah RB, heard such weird stories about QB DLC pathing that, ehm... I never bought nor played it. :unsure:I'll gladly test the pond on the QB map with whatever you come up with. That pond was a pain to script around, it sucked troops in like a Black Hole.If I succeeded, might I count on any volunteer to mark at least regions pixels and chokepoints centers on a map for more extended testing?
Which is quite an utter embarrassment...
I watched DarkRob's AARs, though.
I'm going to remedy to this situation, anyway, sooner or later. Promised.

Last edited by r59 on Tue Sep 10, 2019 8:20 pm, edited 1 time in total.
Re: Building a map, start of a project, help will be needed
Understand Now, when I read a post I automatically think of the SOWGB game, it's the SOWWL game that allows for this.For the moment I'm "stuck" with custom images and INIs data sources.
I don't know if interfacing with the game CSV parsing routines is worth the effort, honestly.
Probably I'm going to use directly an open-source library for that (or maybe JSON)...
I'll decide in a couple of days at worst.![]()
I was wondering why I have never seen some of this data, since I have looked at all of the files from the previous game at one time or another.
Keep Up the Excellent Work!
davinci
The only true logic is that, there is no true logic!
Re: Building a map, start of a project, help will be needed
This is kind of an out of the box idea, but what if you could change the properties of the pond to be like a building? Troops, as far as Ive ever seen, never walk through buildings, but always around them(Im talking just regular buildings here, not ones that can be garrisoned)I'll gladly test the pond on the QB map with whatever you come up with. That pond was a pain to script around, it sucked troops in like a Black Hole.
If graphics are not tied to properties, maybe the pond could still look like a pond, but with the properties of a building? If the game saw the pond as a building then troops might avoid it the same way they path around buildings in a town, granted it would need to be a big building with a large footprint.
I know nothing about programming or modding, so this is probably a stupid idea, but Id rather risk looking stupid and actually hit on something than stay quiet, when maybe it could have worked.
Most of the stuff I came up with in playing the game was equally wacky and stupid, until it worked.
Re: Building a map, start of a project, help will be needed
At least I might tell we got started... :dry:
The unit was set to move to the blue tiles by one mouse click.

First waypoint's hidden by the stonebridge geometry.

Cropped area of the new grayscale map (colors auto-adjusted for better visualization).

Uncompressed lookup tables.
Many many things still left to do, anyway.
The unit was set to move to the blue tiles by one mouse click.

First waypoint's hidden by the stonebridge geometry.

Cropped area of the new grayscale map (colors auto-adjusted for better visualization).

Uncompressed lookup tables.
Code: Select all
static const Region s_pathRegionLookupDB[5][5] = {
{ Region::NONE, Region::B, Region::B, Region::B, Region::B },
{ Region::A, Region::NONE, Region::C, Region::C, Region::C },
{ Region::B, Region::B, Region::NONE, Region::D, Region::D },
{ Region::C, Region::C, Region::C, Region::NONE, Region::E },
{ Region::D, Region::D, Region::D, Region::D, Region::NONE }
};
static const Chokepoint s_pathChokepointLookupDB[5][5] = {
{ Chokepoint::NONE, Chokepoint::A, Chokepoint::A, Chokepoint::A, Chokepoint::A },
{ Chokepoint::A, Chokepoint::NONE, Chokepoint::B, Chokepoint::B, Chokepoint::B },
{ Chokepoint::B, Chokepoint::B, Chokepoint::NONE, Chokepoint::C, Chokepoint::C },
{ Chokepoint::C, Chokepoint::C, Chokepoint::C, Chokepoint::NONE, Chokepoint::D },
{ Chokepoint::D, Chokepoint::D, Chokepoint::D, Chokepoint::D, Chokepoint::NONE }
};
constexpr static const sowwl_v103_types::CVec s_pathChokepointCenterDB[4] = {
sowwl_v103_types::CVec{ sowwl_v103_types::CFixedPointU64_28{ INT64_C(120417) << 28 }, sowwl_v103_types::CFixedPointU64_28{ INT64_C(170818) << 28 } },
sowwl_v103_types::CVec{ sowwl_v103_types::CFixedPointU64_28{ INT64_C(121911) << 28 }, sowwl_v103_types::CFixedPointU64_28{ INT64_C(168261) << 28 } },
sowwl_v103_types::CVec{ sowwl_v103_types::CFixedPointU64_28{ INT64_C(122823) << 28 }, sowwl_v103_types::CFixedPointU64_28{ INT64_C(165977) << 28 } },
sowwl_v103_types::CVec{ sowwl_v103_types::CFixedPointU64_28{ INT64_C(122797) << 28 }, sowwl_v103_types::CFixedPointU64_28{ INT64_C(163110) << 28 } }
};
Last edited by r59 on Wed Sep 11, 2019 6:26 pm, edited 1 time in total.
Re: Building a map, start of a project, help will be needed
Using 3d objects to block off water - DarkRob's suggestion is a sensible and logical one, but has some challenges when put into practice. B)
I've tried a few combinations over the years but haven't found a satisfactory solution, other than falling back on the type 25 grey scale option so that the AI skirts around water, unless routed (Btw - the type 25 barrier doesn't appear to be applied correctly to the pond in the stock Quatre Bras map which perhaps explains why Reb had such problems when scripting).
Using 3D objects - SoWWL already has a square 3D waterplane object that can be placed when creating a map within Norbsoft's version of PowerRender. Their size can be adjusted but can be difficult to place satisfactorily when the ground level varies. Also, as ponds are usually rounded, square waterplane objects need to be sunk into the ground to look right.
Depending on a 3D object's properties, units will ignore them (collision switched off), move on top of them (bridges) or move around their edges (houses).
The pond in Quatre Bras uses one of these waterplane 3D objects.
I have tried replacing this with a version whose properties force the AI to walk around the edges. This appeared to stop units from walking across it, but made the units edge around the exact outline of the object, which looked odd and ruined immersion. Adjusting the collision radius made no difference. It also meant some troops scurried around like headless chickens for some minutes as the AI sought to find a way around. You sometimes see this when buildings in a town are close together and the AI seeks to squeeze through.
You could put a further type 25 greyscale barrier outside of this, so that the troops avoid the sharp edges. But if you're doing that, then you might as well use the greyscale 25 option in the first place.
One option would be to make a 3D waterplane object with rounded edges so that the interaction with troops isn't as stark, but suspect this would still look odd as AI controlled troops skirt around it.
Others may be more successful, but I've yet to find a satisfactory way to use 3D objects to block off water.
I've tried a few combinations over the years but haven't found a satisfactory solution, other than falling back on the type 25 grey scale option so that the AI skirts around water, unless routed (Btw - the type 25 barrier doesn't appear to be applied correctly to the pond in the stock Quatre Bras map which perhaps explains why Reb had such problems when scripting).
Using 3D objects - SoWWL already has a square 3D waterplane object that can be placed when creating a map within Norbsoft's version of PowerRender. Their size can be adjusted but can be difficult to place satisfactorily when the ground level varies. Also, as ponds are usually rounded, square waterplane objects need to be sunk into the ground to look right.
Depending on a 3D object's properties, units will ignore them (collision switched off), move on top of them (bridges) or move around their edges (houses).
The pond in Quatre Bras uses one of these waterplane 3D objects.
I have tried replacing this with a version whose properties force the AI to walk around the edges. This appeared to stop units from walking across it, but made the units edge around the exact outline of the object, which looked odd and ruined immersion. Adjusting the collision radius made no difference. It also meant some troops scurried around like headless chickens for some minutes as the AI sought to find a way around. You sometimes see this when buildings in a town are close together and the AI seeks to squeeze through.
You could put a further type 25 greyscale barrier outside of this, so that the troops avoid the sharp edges. But if you're doing that, then you might as well use the greyscale 25 option in the first place.
One option would be to make a 3D waterplane object with rounded edges so that the interaction with troops isn't as stark, but suspect this would still look odd as AI controlled troops skirt around it.
Others may be more successful, but I've yet to find a satisfactory way to use 3D objects to block off water.
- Attachments
-
- SoWWLPond2.jpg (234 KiB) Viewed 3644 times
-
- SoWWLPond.jpg (297.01 KiB) Viewed 3644 times
Re: Building a map, start of a project, help will be needed
Hats off for your disseration, Crikey.
Re: Building a map, start of a project, help will be needed
Some bits of informations I come across about the triggering conditions for the grayscale 25 repathing.
A ) The unit must be in marching state (MARCH or RUN);
B ) The unit must have no waypoints set;
C ) And of course, the actual terrain tile must be flagged as grayscale_25.
I might try including the routing (or any other) state to point A.
But I have no idea what's going to happen...
A ) The unit must be in marching state (MARCH or RUN);
B ) The unit must have no waypoints set;
C ) And of course, the actual terrain tile must be flagged as grayscale_25.
I might try including the routing (or any other) state to point A.
But I have no idea what's going to happen...
Last edited by r59 on Fri Sep 13, 2019 4:32 pm, edited 1 time in total.
Re: Building a map, start of a project, help will be needed

As of now, it looks like broken units won't follow the waypoints queued by the grayscale_25 repathing algorithm, even if I force the triggering...
They are not going to follow any waypoint at all in that case, in truth.
Good to know.
Last edited by r59 on Fri Sep 13, 2019 8:04 pm, edited 1 time in total.