klei1984 / max

M.A.X. Port
https://klei1984.github.io/max/
MIT License
51 stars 4 forks source link

[Bug] #21

Closed segatrade closed 1 year ago

segatrade commented 1 year ago

Operating System

Linux

M.A.X. Port Version

latest

Source of bug?

What is the issue you encountered?

builded maxrun like here https://klei1984.github.io/max/build/ today, but it doesn't run not from terminal, not direct. also got errors in build

[ 86%] Building CXX object CMakeFiles/maxrun.dir/src/paths.cpp.o /home/usr0/max/src/screendump.cpp: In function ‘int screendump_pcx(int, int, unsigned char, unsigned char)’: /home/usr0/max/src/screendump.cpp:61:30: warning: ‘MAX’ directive writing 3 bytes into a region of size between 1 and 4096 [-Wformat-overflow=] 61 | sprintf(filename, "%sMAX%4.4i.PCX", ResourceManager_FilePathGameInstall, file_index); | ^~~ /home/usr0/max/src/screendump.cpp:61:16: note: ‘sprintf’ output between 12 and 4114 bytes into a destination of size 4096 61 | sprintf(filename, "%sMAX%4.4i.PCX", ResourceManager_FilePathGameInstall, file_index); | ~^~~~~~~~~~~~~~~~~~~ [ 87%] Building CXX object CMakeFiles/maxrun.dir/src/threatmap.cpp.o [ 88%] Building CXX object CMakeFiles/maxrun.dir/src/main.cpp.o [ 89%] Building CXX object CMakeFiles/maxrun.dir/src/aiattack.cpp.o [ 89%] Building CXX object CMakeFiles/maxrun.dir/src/adjustrequest.cpp.o [ 89%] Building CXX object CMakeFiles/maxrun.dir/src/terrainmap.cpp.o /home/usr0/max/src/inifile.cpp: In member function ‘void IniSettings::Init()’: /home/usr0/max/src/inifile.cpp:245:25: warning: format not a string literal and no format arguments [-Wformat-security] 245 | fprintf(fp, format_string); | ^~~~~ /home/usr0/max/src/gamesetupmenu.cpp: In member function ‘void GameSetupMenu::LoadMissionDescription()’: /home/usr0/max/src/gamesetupmenu.cpp:343:25: warning: ‘%s’ directive writing up to 4095 bytes into a region of size 100 [-Wformat-overflow=] 343 | sprintf(file_name, "%sdescr%i.%s", ResourceManager_FilePathText, game_file_number, | ^~ ~~~~~~~~ /home/usr0/max/src/gamesetupmenu.cpp:343:12: note: ‘sprintf’ output 8 or more bytes (assuming 4103) into a destination of size 100 343 | sprintf(file_name, "%sdescr%i.%s", ResourceManager_FilePathText, game_file_number, | ~^~~~~~~~~~~~~~~~~ 344 | SaveLoadMenu_SaveFileTypes[game_file_type]); | ~~~~~~~~~~~ /home/usr0/max/src/textfile.cpp: In member function ‘void TextItem::FatalError(const char)’: /home/usr0/max/src/textfile.cpp:44:12: warning: format not a string literal and no format arguments [-Wformat-security] 44 | SDL_Log(string.GetCStr()); | ~^~~~ /home/usr0/max/src/textfile.cpp: In member function ‘void SmartTextfileReader::FatalError(const char, ...)’: /home/usr0/max/src/textfile.cpp:593:12: warning: format not a string literal and no format arguments [-Wformat-security] 593 | SDL_Log(message.GetCStr()); | ~^~~~~ /home/usr0/max/src/game_manager.cpp: In function ‘void GameManager_MenuClickChatGoalButton()’: /home/usr0/max/src/game_manager.cpp:3831:31: warning: ‘descr’ directive writing 5 bytes into a region of size between 1 and 4096 [-Wformat-overflow=] 3831 | sprintf(file_path, "%sdescr%i.%s", ResourceManager_FilePathText, GameManager_GameFileNumber, | ^~~~~ /home/usr0/max/src/game_manager.cpp:3831:16: note: ‘sprintf’ output 8 or more bytes (assuming 4103) into a destination of size 4096 3831 | sprintf(file_path, "%sdescr%i.%s", ResourceManager_FilePathText, GameManager_GameFileNumber, | ~^~~~~~~~~~~~~~~~~~~ 3832 | SaveLoadMenu_SaveFileTypes[game_file_type]); | ~~~~~~~~~~~ [ 90%] Linking CXX executable maxrun [100%] Built target maxrun

Anything to add?

Ubuntu 22.04.01 Maybe it's good to publish latest build release

klei1984 commented 1 year ago

Hello, these are not build errors. The build succeeds at 100% without errors. The gcc compiler has different set of diagnostics enabled by default on linux, windows and macos. The observed compiler warnings are false positives, wrong assumptions made by the compiler.

GitHub Actions builds are available here that you can try out without building the source code yourself. There are asset files in the assets folder of the source tree that you may have skipped to copy to your M.A.X. installation folder when you followed the build instructions. The last sentence in the guide does not explicitly say what to copy where, sorry for that.

The linux deb installer from the Actions page installs the assets so you do not need to copy anything manually if you use it. It does not install any dependencies though.

If the language file is missing, the game executable terminates at startup. Probably this is what you observe.

The localization module executes at the static global object initialization step of the C++ run-time initialization. At that time the SDL library is not yet initialized and SDL's logging services to the standard output are not available. I agree that user feedback on why the executable terminates prematurely would be useful. I will try to find a solution to that.

I will also check whether I could add an install command to the cmake configuration file which would be able to copy the appropriate assets together with the executable, and dependent dynamic link libraries on select platforms, to the user provided installation folder where M.A.X. v1.04 resides.

On why there are no releases on the front page, please read the latest blog entry or this discussion thread, thanks.

If the provided feedback resolves your issue, please close the bug report.

segatrade commented 1 year ago

Thank you https://github.com/klei1984/max/actions/runs/4039015122 runs, but after choosing players on custom map - it's crashes. Also if click on settings - crash Also saves from dos version - not visible In DOSbox I got this problem always after turn 15, when gray enemy moves: image

DOS/32A used, but not fixed Improved graphics turned off memsize=64 windowresolution=2400x1800 output=openglnb hwscale=3

klei1984 commented 1 year ago

Could you attach your save file?

klei1984 commented 1 year ago

The reported linux specific segmentation faults and file system problems are resolved on latest master. If the game cannot load the configured language file and the game terminates a user message is printed to the standard error output. The GNU Make makefile that is generated by CMAKE supports an install target that copies all assets and the built game executable to a dedicated folder.

I cannot analyze the DOSBox issue further without the requested saved game file. Based on the screenshot the DOS/32A DPMI server reports an unhandled division by zero exception. State of the art static analysis tools ran on the current M.A.X. Port source code did not report division by zero related findings.

I will close the bug report in a couple days.

segatrade commented 1 year ago

Thank you. Sorry for delay. DOSBox seems error gone. Maybe because small movements in end of turn or this connected that DOS/32A and unchecking improved graphics was used not from the beggining, but after error appeared.

160 https://github.com/klei1984/max/actions/runs/4058197103 runs game. Now I see my saves OK. Open included save. Seems everything OK, but end of turn and crash

max_save.zip

segatrade commented 1 year ago

Not sure that for issues, but can move after to better place some feedback about M.A.X.: 1) Game is very interesting and unusual. Don't know similar, but Shadow Empire logistic and supply, Wargame Red Dragon, spring1944. Beyond All Reason (BAR), Supreme Commander (SC), zero-k (ZK) grabbing debris and range circles. Strange that planes doesn't leave debris, and units died in sea. 2) Interesting to try make AI, automation scripts (Screeps) for such game. 3) Also strange that trees cannot be deleted, mountains also. No height level. Fuel seems no possible to extract here anyway: image 4) I don't like random rolls. I captured alien plane from 1st attempt with rookie, but other cheaper units with longer bar sometimes takes many turns attempts. Also how alien units getting experience - my tank already got 2 times, assault gun and plane 0, but they killed more. 5) Experience for mechanized units also possible in theory. Also it can be united for all units or units of one type. 6) Upgrades strange. Seems components base like in Warzone RTS will be better. Here strange that AA car, AA ship, AA towers have different range component, but I think they use almost same gun + rockets component. 7) Doesn't check yet, but seems if unit have movement bigger than range of tower - it can move threw without being attacked. It need to have a stop in range of tower to be attacked? 8) Also does material for connector under new building return? There is no reclaiming seems like in BAR (SC etc). Only self-destroy and grab with buildozer. 9) Tower cannot be ugraded with supply truck or engineer near. Need storage connected. 10) Units can fire threw buildings (here seems no indirect/direct fire etc), Radars works threw obstacles (BAR, ZK fixed it), didn't build port yet, but seems no sonar level. 11) There is most optimal zoom level in game, that doesn't obvious from start and when I find it - doesn't change anymore image - discrete level upper will hide empty survey and often misclick. Discrete level lower - not much map fit in screen. I hope some updates with render will appear to use tiles from lower zoom level on this zoom size with modern resolution. 12) Didn't understand how to preview movement path. Units start moving. Preview only possible when there is no speed. 13) Interesting idea about balance between cheaper or faster build. 14) Would be nice auto saves in end and beginning of very turn for 3 turns (6 saves), because do it manually for case of crashes. 15) DOSbox version takes only 91.4 MB memory and 3.6% CPU. Convenient for short pauses while working, don't need to close and load

klei1984 commented 1 year ago

... but end of turn and crash

The reported crash is resolved on latest master.