Flowfield prototype

For code related discussions and questions
Forgon
Code contributor
Code contributor
Posts: 298
Joined: 07 Dec 2016, 22:23

Re: Flowfield prototype

Post by Forgon »

Perl99 wrote: 02 Jan 2019, 00:44 So I have fixed more incompatibilities. Compiled with with cmake + gcc 7.3 and got no more errors. [...]
I compiled with gcc 8.2.1 and nonetheless received many errors. Shortened output of `make -j6`:

Code: Select all

flowfield.cpp: In function ‘void flowfield::calculateFlowFieldsAsync(MOVE_CONTROL*, unsigned int, int, int, int, int, PROPULSION_TYPE, DROID_TYPE, FPATH_MOVETYPE, int, bool, const StructureBounds&)’:
flowfield.cpp:75:20: error: ‘make_unique’ is not a member of ‘std’
   auto task = std::make_unique<detail::PathRequestTask>(source, goal, propulsionType);
                    ^~~~~~~~~~~
flowfield.cpp:75:20: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:25:1:
+#include <memory>
 
flowfield.cpp:75:20:
   auto task = std::make_unique<detail::PathRequestTask>(source, goal, propulsionType);
                    ^~~~~~~~~~~
flowfield.cpp:75:55: error: expected primary-expression before ‘>’ token
   auto task = std::make_unique<detail::PathRequestTask>(source, goal, propulsionType);
                                                       ^
flowfield.cpp:75:65: error: left operand of comma operator has no effect [-Werror=unused-value]
   auto task = std::make_unique<detail::PathRequestTask>(source, goal, propulsionType);
                                                                 ^~~~
flowfield.cpp:75:71: error: right operand of comma operator has no effect [-Werror=unused-value]
   auto task = std::make_unique<detail::PathRequestTask>(source, goal, propulsionType);
                                                                       ^~~~~~~~~~~~~~
depbase=`echo group.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -DHAVE_CONFIG_H -I. -I..  -DYY_NO_INPUT -I/usr/include/SDL2 -D_REENTRANT   -I/usr/include/libpng16    -I/usr/include/AL  -I/usr/include/fribidi  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -I/usr/include/fribidi  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/uuid  -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DDEBUG -DWZ_DATADIR="\"/usr/local/share/warzone2100\"" -DLOCALEDIR="\"/usr/local/share/locale\"" -I.. -I../3rdparty -I../3rdparty/glm -I../3rdparty/miniupnp -I/usr/include/libdrm    -O0 -ggdb -Werror -Wno-enum-compare -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wcast-align -Wwrite-strings -Wpointer-arith -Wno-format-security -Wno-expansion-to-defined -Wno-stringop-truncation -Wno-format-truncation -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -I/usr/include/qt/QtCore -I/usr/include/qt -I/usr/include/qt/QtGui -DQT_WIDGETS_LIB -I/usr/include/qt/QtWidgets -DQT_GUI_LIB -DQT_SCRIPT_LIB -I/usr/include/qt/QtScript -DQT_CORE_LIB   -O2 -gstabs -g -g3 -pipe -std=c++11 -fstack-protector -fPIC -MT group.o -MD -MP -MF $depbase.Tpo -c -o group.o group.cpp &&\
mv -f $depbase.Tpo $depbase.Po
flowfield.cpp: At global scope:
flowfield.cpp:169:9: error: ‘make_unique’ is not a member of ‘std’
    std::make_unique<portalPathCacheT>(PORTAL_PATH_CACHE_MAX),
         ^~~~~~~~~~~
flowfield.cpp:169:9: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:169:37: error: expected primary-expression before ‘>’ token
    std::make_unique<portalPathCacheT>(PORTAL_PATH_CACHE_MAX),
                                     ^
flowfield.cpp:170:9: error: ‘make_unique’ is not a member of ‘std’
    std::make_unique<portalPathCacheT>(PORTAL_PATH_CACHE_MAX),
         ^~~~~~~~~~~
flowfield.cpp:170:9: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:170:37: error: expected primary-expression before ‘>’ token
    std::make_unique<portalPathCacheT>(PORTAL_PATH_CACHE_MAX),
                                     ^
flowfield.cpp:171:9: error: ‘make_unique’ is not a member of ‘std’
    std::make_unique<portalPathCacheT>(PORTAL_PATH_CACHE_MAX),
         ^~~~~~~~~~~
flowfield.cpp:171:9: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:171:37: error: expected primary-expression before ‘>’ token
    std::make_unique<portalPathCacheT>(PORTAL_PATH_CACHE_MAX),
                                     ^
flowfield.cpp:172:9: error: ‘make_unique’ is not a member of ‘std’
    std::make_unique<portalPathCacheT>(PORTAL_PATH_CACHE_MAX)
         ^~~~~~~~~~~
flowfield.cpp:172:9: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:172:37: error: expected primary-expression before ‘>’ token
    std::make_unique<portalPathCacheT>(PORTAL_PATH_CACHE_MAX)
                                     ^
flowfield.cpp:176:9: error: ‘make_unique’ is not a member of ‘std’
    std::make_unique<flowfieldCacheT>(FLOWFIELD_CACHE_MAX),
         ^~~~~~~~~~~
flowfield.cpp:176:9: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:176:36: error: expected primary-expression before ‘>’ token
    std::make_unique<flowfieldCacheT>(FLOWFIELD_CACHE_MAX),
                                    ^
flowfield.cpp:177:9: error: ‘make_unique’ is not a member of ‘std’
    std::make_unique<flowfieldCacheT>(FLOWFIELD_CACHE_MAX),
         ^~~~~~~~~~~
flowfield.cpp:177:9: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:177:36: error: expected primary-expression before ‘>’ token
    std::make_unique<flowfieldCacheT>(FLOWFIELD_CACHE_MAX),
                                    ^
flowfield.cpp:178:9: error: ‘make_unique’ is not a member of ‘std’
    std::make_unique<flowfieldCacheT>(FLOWFIELD_CACHE_MAX),
         ^~~~~~~~~~~
flowfield.cpp:178:9: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:178:36: error: expected primary-expression before ‘>’ token
    std::make_unique<flowfieldCacheT>(FLOWFIELD_CACHE_MAX),
                                    ^
flowfield.cpp:179:9: error: ‘make_unique’ is not a member of ‘std’
    std::make_unique<flowfieldCacheT>(FLOWFIELD_CACHE_MAX)
         ^~~~~~~~~~~
flowfield.cpp:179:9: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:179:36: error: expected primary-expression before ‘>’ token
    std::make_unique<flowfieldCacheT>(FLOWFIELD_CACHE_MAX)
                                    ^
flowfield.cpp: In member function ‘const std::deque<unsigned int> flowfield::detail::PathRequestTask::portalWalker(unsigned int, unsigned int)’:
flowfield.cpp:582:121: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
     std::deque<unsigned int> path = portalWalker.findPath(sourcePortalId, static_cast<const unsigned int>(portals.size()));
                                                                                                                         ^
flowfield.cpp:585:26: error: ‘make_unique’ is not a member of ‘std’
     auto pathCopy = std::make_unique<std::deque<unsigned int>>(path);
                          ^~~~~~~~~~~
flowfield.cpp:585:26: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:585:61: error: expected primary-expression before ‘>’ token
     auto pathCopy = std::make_unique<std::deque<unsigned int>>(path);
                                                             ^~
flowfield.cpp: In member function ‘std::vector<std::future<bool> > flowfield::detail::PathRequestTask::scheduleFlowFields(std::deque<unsigned int>&)’:
flowfield.cpp:610:23: error: ‘make_unique’ is not a member of ‘std’
      auto task = std::make_unique<FlowfieldCalcTask>(goals, portals, sectors, propulsion);
                       ^~~~~~~~~~~
flowfield.cpp:610:23: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:610:52: error: expected primary-expression before ‘>’ token
      auto task = std::make_unique<FlowfieldCalcTask>(goals, portals, sectors, propulsion);
                                                    ^
flowfield.cpp:610:61: error: left operand of comma operator has no effect [-Werror=unused-value]
      auto task = std::make_unique<FlowfieldCalcTask>(goals, portals, sectors, propulsion);
                                                             ^~~~~~~
flowfield.cpp:610:61: error: right operand of comma operator has no effect [-Werror=unused-value]
flowfield.cpp:610:70: error: right operand of comma operator has no effect [-Werror=unused-value]
      auto task = std::make_unique<FlowfieldCalcTask>(goals, portals, sectors, propulsion);
                                                                      ^~~~~~~
flowfield.cpp:625:22: error: ‘make_unique’ is not a member of ‘std’
     auto task = std::make_unique<FlowfieldCalcTask>(finalGoals, portals, sectors, propulsion);
                      ^~~~~~~~~~~
flowfield.cpp:625:22: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:625:51: error: expected primary-expression before ‘>’ token
     auto task = std::make_unique<FlowfieldCalcTask>(finalGoals, portals, sectors, propulsion);
                                                   ^
flowfield.cpp:625:65: error: left operand of comma operator has no effect [-Werror=unused-value]
     auto task = std::make_unique<FlowfieldCalcTask>(finalGoals, portals, sectors, propulsion);
                                                                 ^~~~~~~
flowfield.cpp:625:65: error: right operand of comma operator has no effect [-Werror=unused-value]
flowfield.cpp:625:74: error: right operand of comma operator has no effect [-Werror=unused-value]
     auto task = std::make_unique<FlowfieldCalcTask>(finalGoals, portals, sectors, propulsion);
                                                                          ^~~~~~~
flowfield.cpp: In member function ‘virtual void flowfield::detail::FlowfieldCalcTask::runPromised()’:
flowfield.cpp:668:32: error: ‘make_unique’ is not a member of ‘std’
     auto flowfieldMoved = std::make_unique<FlowFieldSector>(std::move(flowField));
                                ^~~~~~~~~~~
flowfield.cpp:668:32: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:668:59: error: expected primary-expression before ‘>’ token
     auto flowfieldMoved = std::make_unique<FlowFieldSector>(std::move(flowField));
                                                           ^
flowfield.cpp: In function ‘void flowfield::detail::initCostFields()’:
flowfield.cpp:790:29: error: ‘make_unique’ is not a member of ‘std’
      sectors.push_back(std::make_unique<Sector>());
                             ^~~~~~~~~~~
flowfield.cpp:790:29: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:790:47: error: expected primary-expression before ‘>’ token
      sectors.push_back(std::make_unique<Sector>());
                                               ^
flowfield.cpp:790:49: error: expected primary-expression before ‘)’ token
      sectors.push_back(std::make_unique<Sector>());
                                                 ^
flowfield.cpp: In function ‘void flowfield::detail::costFieldReplaceWithEmpty(flowfield::detail::sectorListT&)’:
flowfield.cpp:823:20: error: ‘make_unique’ is not a member of ‘std’
      sector = std::make_unique<EmptySector>();
                    ^~~~~~~~~~~
flowfield.cpp:823:20: note: ‘std::make_unique’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
flowfield.cpp:823:43: error: expected primary-expression before ‘>’ token
      sector = std::make_unique<EmptySector>();
                                           ^
flowfield.cpp:823:45: error: expected primary-expression before ‘)’ token
      sector = std::make_unique<EmptySector>();
                                             ^
cc1plus: all warnings being treated as errors
make[3]: *** [Makefile:1059: flowfield.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/home/x/flowfield/warzone2100/src'
make[2]: *** [Makefile:853: all] Error 2
make[2]: Leaving directory '/home/x/flowfield/warzone2100/src'
make[1]: *** [Makefile:583: all-recursive] Error 1
make[1]: Leaving directory '/home/x/flowfield/warzone2100'
make: *** [Makefile:503: all] Error 2
A patch to fix these problems is attached.

To assess your prototype, I tested whether hover tanks can pass through a barrier of tracked tanks, back to their HQ.
These tasks were performed by pressing Ctrl-H followed by Shift-H, using a prepared savegame and a shell script.

When using the old A*-algorithm, the units succeeded:
hover tanks return to their HQ with A* algorithm in flowfield prototype test
hover tanks return to their HQ with A* algorithm in flowfield prototype test
astar.png (511.61 KiB) Viewed 10786 times
Unfortunately, the same tanks disobeyed with your prototype and moved in the wrong direction:
hover tanks fail to return to their HQ with Flow Field algorithm in flowfield prototype test
hover tanks fail to return to their HQ with Flow Field algorithm in flowfield prototype test
flowfield.png (555.15 KiB) Viewed 10786 times
Attachments
flowfield_debug.log
debug output for Flow Field algorithm in flowfield prototype test
(363.25 KiB) Downloaded 354 times
astar_debug.log
debug output for A* algorithm in prototype test
(294.05 KiB) Downloaded 356 times
flowfield_test.wz
ZIP file containing shell script for flowfield prototype test (created because the forum software rejects its filename)
(550 Bytes) Downloaded 360 times
flowfield_savegame.wz
savegame for flowfield prototype test
(77.29 KiB) Downloaded 328 times
flowfield_prototype_gcc_errors.patch
patch to fix gcc compiler errors
(1.44 KiB) Downloaded 366 times
flowfield_prototype_autotools.log
output of `make -j6` after executing `./autogen.sh && ./configure CFLAGS='-O2 -gstabs -g -g3 -pipe' CXXFLAGS='-O2 -gstabs -g -g3 -pipe'`
(204.06 KiB) Downloaded 353 times
Post Reply