Giter VIP home page Giter VIP logo

afwbkbc / glsmac Goto Github PK

View Code? Open in Web Editor NEW
348.0 348.0 12.0 3.59 MB

Unofficial open-source OpenGL/SDL2 reimplementation of Sid Meier's Alpha Centauri ( + Alien Crossfire )

License: GNU Affero General Public License v3.0

CMake 0.89% C++ 97.44% JavaScript 1.68%
4x 4x-strategy-game c-plus-plus civ civilization cross-platform freebsd game game-development gamedev linux multiplayer opengl sid-meier-alpha-centauri sid-meier-civilization smac strategy strategy-game turn-based-strategy windows

glsmac's People

Contributors

afwbkbc avatar coderguy57 avatar e-rook avatar hartmark avatar l29ah avatar lanodan avatar tsunamistate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glsmac's Issues

[VS-Clang] Compilation error on Mesh.cpp

OS: Windows 11
IDE: Visual Studio 2022 17.4.5
Compiler: Clang 15.0.1
Version/commit: bisected to a0db10b

Steps to reproduce:

  1. Open Visual Studio and open glsmac folder with it. Wait until CMake configuration finishes
  2. Use Build ⇒ Build All in top menu or Ctrl+Shift+B shortcut to compile an executable

Actual result:

Compilation fails with the following error:

  [17/74] Building CXX object CMakeFiles/GLSMAC.dir/src/graphics/opengl/actor/Mesh.cpp.obj
  FAILED: CMakeFiles/GLSMAC.dir/src/graphics/opengl/actor/Mesh.cpp.obj 
  C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\Llvm\x64\bin\CLANG_~1.EXE -DGLEW_NO_GLU -DGLEW_STATIC -DVC_EXTRALEAN -DVISUAL_STUDIO -DWIN32_MEAN_AND_LEAN -D_CRT_SECURE_NO_WARNINGS -D_ITERATOR_DEBUG_LEVEL=0 -ID:/src/glsmac/src -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/glew-src/include -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/freetype-build/include -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/freetype-src/include -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/sdl2-build/include -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/sdl2-build/include-config-release -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/sdl_image-src -std=c++17  -s -O3 -march=native -Wno-pointer-arith -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -MD -MT CMakeFiles/GLSMAC.dir/src/graphics/opengl/actor/Mesh.cpp.obj -MF CMakeFiles\GLSMAC.dir\src\graphics\opengl\actor\Mesh.cpp.obj.d -o CMakeFiles/GLSMAC.dir/src/graphics/opengl/actor/Mesh.cpp.obj -c D:/src/glsmac/src/graphics/opengl/actor/Mesh.cpp
D:\src\glsmac\out\build\x64-release-win-clang\CLANG_~1 : warning : argument unused during compilation: '-s' [-Wunused-command-line-argument]
D:\src\glsmac\src\graphics\opengl\actor\Mesh.cpp(239,23): error G38A6BD1A: variable-sized object may not be initialized
                                                  Vec3 light_pos[ lights->size() ] = {};
                                                                  ^~~~~~~~~~~~~~
D:\src\glsmac\src\graphics\opengl\actor\Mesh.cpp(240,26): error G38A6BD1A: variable-sized object may not be initialized
                                                  Color light_color[ lights->size() ] = {};
                                                                     ^~~~~~~~~~~~~~
  2 errors generated.

Current progress

This sounds like a nice project and will closely watch this progress as SMAC is one of my favourite games.

Can you please add some kind of outline of where you are in the development.

What works, what doesn't with perhaps tasks which are needed to get fixed before the feature is done.

Something like this for an outline:
https://github.com/OpenRA/OpenRA/wiki/Development-Goals

And something like this for a given feature:
OpenRA/OpenRA#4988

I realize this is quite early in the development so having specific pages like OpenRA is perhaps a bit overkill. But in the long run I think it would be nice to split down into separate tasks where people have an easier way of grabbing something to write a PR for.

not create GLSMAC.exe VS22 Windows11

Hi
On steps "Once that is done you should clone the git, then open the folder. Press the top button Project->Configure, then the output should open. Wait for it to say "CMake generation finished.". Once that is done select the build target GLSMAC.exe and press the debug button."
After "CMake generation finished.",
image
I try build exe
image
but in process, i have a many errors (attached output)
output_build.txt

Then i have window
image
and open json
image

So, what i do wrong?

Thx

Crash on MacOS build

Hello,

Today I have managed to build glsmac on MacOS platform and during execution attempt I have received the following crash. I have rebuilt it with debug information and seems it is problem with creating menu from non-main thread. I am not familiar with SDL but will try to google around it a little - if you have any ideas I can do some more work around it.

Util::FS Creating directory: /Users/pgawron/.local/share/glsmac/debug/
Thread::(MAIN)#72 Starting thread
Thread::(GAME)#74 Starting thread
Thread::(NETWORK)#73 Starting thread
Thread::(NETWORK)#73 Thread started, entering main loop
Game::#18 Starting thread
Input::SDL2::#22 Initializing SDL2
Util::Random::#75 State set to 3922600251:3009507548:875514653:2432736781
Thread::(GAME)#74 Thread started, entering main loop
Graphics::OpenGL::#23 Initializing SDL2
2023-12-04 11:10:38.624 GLSMAC[23477:6862187] *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:772
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse warning: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff819582fa6 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff819078231 objc_exception_throw + 48
2 Foundation 0x00007ff81a56b106 -[NSCalendarDate initWithCoder:] + 0
3 AppKit 0x00007ff81caf8428 -[NSMenu _setMenuName:] + 978
4 AppKit 0x00007ff81cb0e6e7 -[NSApplication setMainMenu:] + 427
5 GLSMAC 0x0000000102e39c65 CreateApplicationMenus + 149
6 GLSMAC 0x0000000102e3988f Cocoa_RegisterApp + 319
7 GLSMAC 0x0000000102e4452e Cocoa_CreateDevice + 30
8 GLSMAC 0x0000000102d2e9aa SDL_VideoInit_REAL + 650
9 GLSMAC 0x0000000102c234a9 SDL_VideoInit + 25
10 GLSMAC 0x00000001027bcffb _ZN8graphics6opengl6OpenGL5StartEv + 91
11 GLSMAC 0x0000000102622e5e _ZN4base6Thread3RunEv + 446
12 GLSMAC 0x0000000102625239 ZNSt3__18__invokeB7v160006IMN4base6ThreadEFvvEPS2_JEvEEDTcldsdeclsr3stdE7declvalIT0_EEclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT1_EEEEOS7_OS6_DpOS8 + 105
13 GLSMAC 0x000000010262517e _ZNSt3__116__thread_executeB7v160006INS_10unique_ptrINS_15__thread_structENS_14default_deleteIS2_EEEEMN4base6ThreadEFvvEJPS7_EJLm2EEEEvRNS_5tupleIJT_T0_DpT1_EEENS_15__tuple_indicesIJXspT2_EEEE + 14 GLSMAC 0x0000000102624b12 ZNSt3__114__thread_proxyB7v160006INS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN4base6ThreadEFvvEPS8_EEEEEPvSD + 98
15 libsystem_pthread.dylib 0x00007ff819435202 _pthread_start + 99
16 libsystem_pthread.dylib 0x00007ff819430bab thread_start + 15
)

Cannot build on arch linux

I'm getting that the library ossp-uuid is not found.

Tried make a package for it:

% cat PKGBUILD 
# Maintainer: harre <[email protected]>

pkgname=ossp-uuid
_pkgname=ossp-uuid
pkgver=1.6.2
pkgrel=1
epoch=1
pkgdesc="OSSP platform - Universally Unique Identifier"
arch=('any')
options=('!strip' 'staticlibs')
url="http://www.ossp.org/pkg/lib/uuid/"
license=("custom")
provides=("${_pkgname}")
groups=("development")

source=("ftp://ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz")
sha256sums=('11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0')

build() {
   cd "${srcdir}/uuid-${pkgver}"
   ./configure --prefix=/usr
   make
}

check() {
   cd "${srcdir}/uuid-${pkgver}"
   make check
}

package() {
   cd "${srcdir}/uuid-${pkgver}"
   install -Dm 644 "${srcdir}/uuid-${pkgver}/README" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
   make DESTDIR=${pkgdir}/ install
}
$ makepkg -si
...
Packages (1) ossp-uuid-1:1.6.2-1

Total Installed Size:  0.16 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                                                                                                                                   [####################################################################################################] 100%
(1/1) checking package integrity                                                                                                                                 [####################################################################################################] 100%
(1/1) loading package files                                                                                                                                      [####################################################################################################] 100%
(1/1) checking for file conflicts                                                                                                                                [####################################################################################################] 100%
error: failed to commit transaction (conflicting files)
ossp-uuid: /usr/lib/libuuid.so exists in filesystem (owned by util-linux-libs)
ossp-uuid: /usr/lib/pkgconfig/uuid.pc exists in filesystem (owned by util-linux-libs)
ossp-uuid: /usr/share/man/man3/uuid.3.gz exists in filesystem (owned by util-linux-libs)
Errors occurred, no packages were upgraded.

I can fold everything under /usr/share/ossp-uuid by using this line instead under build():
./configure --prefix=/usr/share/${_pkgname}

image

How can I make the cmake find this library? This is a bit outside my skill :/

Crash when trying to start the game with Huge Random map

Environment:

  • OS: Windows 11, Ubuntu 22.04.2 via WSL
  • Compiler: MSVC 17.7.4, GCC 11.4.0 on WSL

Steps to reproduce:

  1. Start a GLSMAC game with proper path to SMAC resources
  2. In main menu, click "Start Game"
  3. Click "Make Random Map" ⇒ "Huge Planet"
  4. Choose any difficulty
  5. Click "Start with standard rules"
  6. Wait until map generation completes

Actual result:
The game crashes to desktop on both Windows and Linux.

unknown_2023.09.29-22.53.mp4

Linux release build shows the following logs:

terminate called after throwing an instance of 'std::runtime_error'
  what():  OpenGL error occured in render loop, aborting
Aborted

Debug build shows A breakpoint instruction (__debugbreak() statement or a similar call) was executed in GLSMAC.exe.
with call stack pointing to

glGenerateMipmap( GL_TEXTURE_2D );

Debug logs have the following error:

Exception thrown at 0x00007FFE91E84FFC in GLSMAC.exe: Microsoft C++ exception: std::runtime_error at memory location 0x00000069065FEC58.

Expected result:
Game successfully starts with newly generated map

Note: Game only crashes after generating "Huge Planet" map, "Large Planet" and lower don't crash

[VS-Clang] Tile lookup doesn't update ingame

OS: Windows 11
IDE: Visual Studio 2022 17.4.4
Compiler: Clang 15.0.1
System specs: AMD Ryzen 2600X / Radeon RX590 / 16 GB RAM

Steps to reproduce:

  1. Open Visual Studio and open glsmac folder with it. Wait until CMake configuration finishes
  2. Use Build -> Build All or Ctrl+Shift+B shortcut to compile an executable
  3. Open a shell (Powershell or CMD) and navigate to executable's path: <project root>\out\build\x64-debug-win-clang\bin
  4. Start a command to execute GLSMAC with game path GLSMAC.exe <smac_directory>
  5. Click Quick Start to generate a map
  6. Click on any tile

Actual result:
Debug console has messages like <Task::World::#40537> Looking up tile at 261x442 but game UI doesn't update with tile information

2023-02-12_14-54-31.mp4

Expected result:
Game UI shows tile information after clicking on it

Crashes on arch linux

It seems to be missing arialn.ttf, it is there however, but it's named ARIALN.TTF, so the same with uppercase. The folder is on btrfs partition so it has case sensitive mode of filenames.

% gdb --args ./bin/GLSMAC /data/lutris/sid-meiers-alpha-centauri/drive_c/GOG\ Games/Sid\ Meier\'s\ Alpha\ Centauri/
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bin/GLSMAC...
(gdb) r
Starting program: /home/markus/code/glsmac/bin/GLSMAC /data/lutris/sid-meiers-alpha-centauri/drive_c/GOG\ Games/Sid\ Meier\'s\ Alpha\ Centauri/

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.archlinux.org 
Enable debuginfod for this session? (y or [n]) 
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Detaching after fork from child process 88857]
[New Thread 0x7ffff69996c0 (LWP 88858)]
<Thread::(MAIN)#51> Starting thread
[New Thread 0x7ffff61986c0 (LWP 88859)]
<Input::SDL2::#6> Initializing SDL2
<Thread::(NETWORK)#52> Starting thread
<Thread::(NETWORK)#52> Thread started, entering main loop
<Graphics::OpenGL::#7> Initializing SDL2
<Graphics::OpenGL::#7> Creating window
[New Thread 0x7ffff49ff6c0 (LWP 88860)]
[New Thread 0x7fffdbfff6c0 (LWP 88861)]
[New Thread 0x7fffdb7fe6c0 (LWP 88862)]
[New Thread 0x7fffdaffd6c0 (LWP 88863)]
[New Thread 0x7fffda7fc6c0 (LWP 88864)]
[New Thread 0x7fffd9ffb6c0 (LWP 88865)]
[Thread 0x7fffd9ffb6c0 (LWP 88865) exited]
[Thread 0x7fffda7fc6c0 (LWP 88864) exited]
<Graphics::OpenGL::#7> Initializing OpenGL
[New Thread 0x7fffda7fc6c0 (LWP 88866)]
[New Thread 0x7fffd9ffb6c0 (LWP 88867)]
<ShaderProgram::Orthographic::#8> Adding shaders
<ShaderProgram::Simple2D::#10> Adding shaders
<ShaderProgram::Font::#12> Adding shaders
<Audio::SDL2::#14> Initializing SDL2
[New Thread 0x7fffe052a6c0 (LWP 88868)]
[New Thread 0x7fffd97fa6c0 (LWP 88869)]
<UI::Default::#17> Creating UI
<Graphics::OpenGL::#7> Adding scene [Scene::(UIShape)#53]
<Routine::Overlay::#11> Scene [Scene::(UIShape)#53] added
<Graphics::OpenGL::#7> Adding scene [Scene::(UIText)#55]
<Routine::Font::#13> Scene [Scene::(UIText)#55] added
<Graphics::OpenGL::#7> Adding scene [Scene::(UIDebug)#60]
<Routine::Overlay::#11> Scene [Scene::(UIDebug)#60] added
<Scheduler::Simple::#21> Starting task [Task::DebugOverlay::#23]
terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to load font "arialn.ttf"

Thread 2 "GLSMAC" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff69996c0 (LWP 88858)]
0x00007ffff75b964c in ?? () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff75b964c in ?? () from /usr/lib/libc.so.6
#1  0x00007ffff7569938 in raise () from /usr/lib/libc.so.6
#2  0x00007ffff755353d in abort () from /usr/lib/libc.so.6
#3  0x00007ffff789a833 in __gnu_cxx::__verbose_terminate_handler () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#4  0x00007ffff78a6ccc in __cxxabiv1::__terminate (handler=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007ffff78a6d39 in std::terminate () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6  0x00007ffff78a6f9d in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x555555846ae0 <typeinfo for std::runtime_error@GLIBCXX_3.4>, dest=0x7ffff78be440 <std::runtime_error::~runtime_error()>)
    at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_throw.cc:98
#7  0x00005555556d0086 in loader::font::FreeType::LoadFont (this=0x7fffffffc970, name="arialn.ttf", size=16 '\020') at /home/markus/code/glsmac/src/loader/font/FreeType.cpp:46
#8  0x00005555557bb39a in debug::DebugOverlay::Start (this=0x5555558672d0) at /home/markus/code/glsmac/src/debug/DebugOverlay.cpp:22
#9  0x00005555557149ec in scheduler::Simple::Start (this=0x7fffffffccb0) at /home/markus/code/glsmac/src/scheduler/Simple.cpp:23
#10 0x00005555556c364d in base::Thread::Run (this=0x555555887180) at /home/markus/code/glsmac/src/base/Thread.cpp:55
#11 0x00005555556c5b38 in std::__invoke_impl<void, void (base::Thread::*)(), base::Thread*> (__f=@0x555555887650: (void (base::Thread::*)(base::Thread * const)) 0x5555556c3492 <base::Thread::Run()>, 
    __t=@0x555555887648: 0x555555887180) at /usr/include/c++/12.2.1/bits/invoke.h:74
#12 0x00005555556c5a97 in std::__invoke<void (base::Thread::*)(), base::Thread*> (__fn=@0x555555887650: (void (base::Thread::*)(base::Thread * const)) 0x5555556c3492 <base::Thread::Run()>) at /usr/include/c++/12.2.1/bits/invoke.h:96
#13 0x00005555556c5a07 in std::thread::_Invoker<std::tuple<void (base::Thread::*)(), base::Thread*> >::_M_invoke<0ul, 1ul> (this=0x555555887648) at /usr/include/c++/12.2.1/bits/std_thread.h:258
#14 0x00005555556c59c0 in std::thread::_Invoker<std::tuple<void (base::Thread::*)(), base::Thread*> >::operator() (this=0x555555887648) at /usr/include/c++/12.2.1/bits/std_thread.h:265
#15 0x00005555556c59a4 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (base::Thread::*)(), base::Thread*> > >::_M_run (this=0x555555887640) at /usr/include/c++/12.2.1/bits/std_thread.h:210
#16 0x00007ffff78d7283 in std::execute_native_thread_routine (__p=0x555555887640) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82
#17 0x00007ffff75b78fd in ?? () from /usr/lib/libc.so.6
#18 0x00007ffff7639d20 in ?? () from /usr/lib/libc.so.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.