Coder Social home page Coder Social logo

daid / seriousproton Goto Github PK

View Code? Open in Web Editor NEW
65.0 16.0 53.0 4.43 MB

C++ game engine coded on top of SDL from scratch. There will be dragons and undocumented stuff in here.

License: MIT License

C 78.91% C++ 18.79% PHP 0.02% CMake 0.38% Makefile 0.50% Perl 0.18% Assembly 0.31% Python 0.90% Shell 0.01%

seriousproton's Introduction

SeriousProton

C++ game engine coded on top of SDL2 from scratch. There will be dragons and undocumented stuff in here.

Master server

The /masterserver directory contains a basic PHP server for registering game servers and distributing a list of servers to clients.

seriousproton's People

Contributors

amir-arad avatar autumnull avatar czenker avatar daid avatar dodomorandi avatar edave64 avatar erikdebruijn avatar faramoscz avatar flowdalic avatar fouindor avatar gcask avatar gguillotte avatar ghostkeeper avatar jonathanilevi avatar jordanlongstaff avatar nallath avatar ninjaspectre avatar olivier-vm avatar oznogon avatar parracodea avatar piglit avatar pryankster avatar rdbahm avatar starrywisdom avatar tdelc avatar techfreek avatar tsht avatar vslotman 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

Watchers

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

seriousproton's Issues

Master server list not displayed (while not empty)

Not sure whether the correct place is here or in EmptyEpsilon, but as it seems to be a connection error, I hope this is the right place.

Registering a server at the master server works fine and I can see it when looking up the list.php in a browser.
However, on client side it does not show up.

Output:

INFO: Switching to master server scanning
INFO: Reading servers from master server http://daid.eu/ee/list.php
WARN: Failed to query master server http://daid.eu/ee/list.php (status 400)
WARN: Failed to query master server http://daid.eu/ee/list.php (status -1)
WARN: Failed to query master server http://daid.eu/ee/list.php (status -1)
WARN: Failed to query master server http://daid.eu/ee/list.php (status 400)
WARN: Failed to query master server http://daid.eu/ee/list.php (status -1)
WARN: Failed to query master server http://daid.eu/ee/list.php (status -1)
.
.

and so on, repeating status 400,-1,-1 over and over again

BASIS v1.15 causes `class-memaccess` warnings

ubuntu-latest CI flags a warning for basisu/BASIS Universal:

/home/runner/work/SeriousProton/build/_deps/basis-src/encoder/../transcoder/basisu_containers.h:323:19: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class basisu::vec<4, float>’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
  323 |             memcpy(m_p, other.m_p, other.m_size * sizeof(T));
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This doesn't impede other builds.

Our usage appears to be based on v1.15-update2. BASIS v1.16.3 changes this behavior (BinomialLLC/basis_universal@7a2094b), but I don't know if that resolves this warning.

v1.16.3 causes several breaking changes: mosra/magnum-plugins#119

SeriousProton does not compile under gcc 6.1.1

After upgrading GCC (on Arch Linux, where the update has been released on 2016-05-07), SeriousProton no longer compiles, because of the following error:

.../SeriousProton/src/networkRecorder.cpp: In member function 'virtual bool NetworkAudioRecorder::onProcessSamples(const Int16*, std::size_t)':
.../SeriousProton/src/networkRecorder.cpp:52:53: error: 'sqrt' was not declared in this scope
     double rms = sqrt(rms_squared / sample_count) / std::numeric_limits<sf::Int16>::max();
                                                 ^

Adding #include <math.h> at the top of the file solves the problem, but I'm not sure why has this compiled before and whether this is the best solution, so I'm reporting the issue instead of making a pull request.

I have verified that upgrading only GCC (as opposed to the whole system) introduces the problem, at least on Arch Linux.

Allow triggering audio playback on clients.

Most non-UI sounds in EE play back only on the server, not on clients.

SP/EE were designed for in-person LAN play where the server typically functioned as the main screen and was within earshot of all players on a ship. With online play, the server is often viewed only by the GM, if at all.

  • SP should provide a method of triggering sound playback on clients as well as the server.
  • SP should provide a method of triggering sound playback on specific clients via scripting.

See also #241 about asset synchronization with clients, which would be required for custom audio assets stored only on the server to be triggered or played back on clients.

Build problems on Linux

Since commit e93db8f SeriousProton does not compile anymore on Linux.
Before I had no problems building and running EmptyEpsilon.
I'm using GCC 4.8.3 and SFML 2.3.1

These are the errors I'm getting:
SeriousProton/src/resources.cpp|48|error: ‘FileInputStream’ in namespace ‘sf’ does not name a type|
SeriousProton/src/resources.cpp||In constructor ‘FileResourceStream::FileResourceStream(string)’:|
SeriousProton/src/resources.cpp|53|error: ‘stream’ was not declared in this scope|
SeriousProton/src/resources.cpp||In member function ‘virtual sf::Int64 FileResourceStream::read(void*, sf::Int64)’:|
SeriousProton/src/resources.cpp|66|error: ‘stream’ was not declared in this scope|
SeriousProton/src/resources.cpp||In member function ‘virtual sf::Int64 FileResourceStream::seek(sf::Int64)’:|
SeriousProton/src/resources.cpp|70|error: ‘stream’ was not declared in this scope|
SeriousProton/src/resources.cpp||In member function ‘virtual sf::Int64 FileResourceStream::tell()’:|
SeriousProton/src/resources.cpp|74|error: ‘stream’ was not declared in this scope|
SeriousProton/src/resources.cpp||In member function ‘virtual sf::Int64 FileResourceStream::getSize()’:|
SeriousProton/src/resources.cpp|78|error: ‘stream’ was not declared in this scope|

Ubuntu CI fails on `maybe-uninitialized` error

On all ubuntu-latest CI builds:

/home/runner/work/SeriousProton/SeriousProton/src/networkAudioStream.cpp: In member function ‘void NetworkAudioStream::receivedPacketFromNetwork(const unsigned char*, int)’:
/home/runner/work/SeriousProton/SeriousProton/src/networkAudioStream.cpp:40:125: error: ‘samples_buffer’ may be used uninitialized [-Werror=maybe-uninitialized]
   40 |     int sample_count = opus_decode(decoder, packet, packet_size, samples_buffer.data(), static_cast<int>(samples_buffer.size()), 0);
      |                                                                                                          ~~~~~~~~~~~~~~~~~~~^~
In file included from /usr/include/c++/11/tuple:39,
                 from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /home/runner/work/SeriousProton/SeriousProton/src/audio/source.h:7,
                 from /home/runner/work/SeriousProton/SeriousProton/src/networkAudioStream.h:4,
                 from /home/runner/work/SeriousProton/SeriousProton/src/networkAudioStream.cpp:1:
/usr/include/c++/11/array:176:7: note: by argument 1 of type ‘const std::array<short int, 2880>*’ to ‘constexpr std::array<_Tp, _Nm>::size_type std::array<_Tp, _Nm>::size() const [with _Tp = short int; long unsigned int _Nm = 2880]’ declared here
  176 |       size() const noexcept { return _Nm; }
      |       ^~~~
/home/runner/work/SeriousProton/SeriousProton/src/networkAudioStream.cpp:39:31: note: ‘samples_buffer’ declared here
   39 |     std::array<int16_t, 2880> samples_buffer;
      |                               ^~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Send User-Agent HTTP header on requests

Some websites, such as GitHub's API, refuse requests from clients that don't provide a User-Agent header, so SP should pass one.

Not sure how to get a version number or specific app name here, but for example just this satisfies basic requirements:

index 789070a..4450f30 100644
--- a/src/io/http/request.cpp
+++ b/src/io/http/request.cpp
@@ -12,6 +12,7 @@ Request::Request(const string& host, int port, Scheme scheme)
 : port(port), scheme(scheme)
 {
     headers["Host"] = host;
+    headers["User-Agent"] = "SeriousProton/0.0.0";
 }
 
 void Request::setHeader(const string& key, const string& value)

error: non-void function does not return a value

/wrkdirs/usr/ports/games/emptyepsilon/work/SeriousProton-EE-2021.06.23/src/clipboard.cpp:58:1: error: non-void function does not return a value [-Werror,-Wreturn-type]
}
^
1 error generated.

Version: 2021.06.23
clang-11
FreeBSD 13

Server Crash Randomly

Server Crash Durring the Game (no significant reason)

Error report :
`Error occured on Friday, February 1, 2019 at 20:44:36.

EmptyEpsilon.exe caused an Access Violation at location 00657C08 in module EmptyEpsilon.exe Reading from location 0000005C.

Loading symbols... done.

Registers:
eax=00000058 ebx=10880a70 ecx=00000000 edx=00000000 esi=0236f7a8 edi=ffffffff
eip=00657c08 esp=0236f6e0 ebp=0236f7b8 iopl=0 nv up ei pl nz na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202

AddrPC Params
00657C08 00000000 007FD120 007FC8CC EmptyEpsilon.exe!getObjectById [/usr/lib/gcc/i686-w64-mingw32/6.3-win32/include/c++/bits/unordered_map.h @ 851]
006CD45F 00000001 10823A28 0000000D EmptyEpsilon.exe!runMainLoop [/home/daid/ee/SeriousProton/src/engine.cpp @ 132]
007AF200 02CEDE38 00000032 00000001 EmptyEpsilon.exe!main [/home/daid/ee/EmptyEpsilon/src/main.cpp @ 274]
004013E3 002F9000 76DF8460 8AD7EE5E EmptyEpsilon.exe!__tmainCRTStartup [./mingw-w64-crt/crt/crtexe.c @ 334]
76DF8484 002F9000 C4B5725E 00000000 KERNEL32.DLL!BaseThreadInitThunk
77503AB8 FFFFFFFF 7751F30F 00000000 ntdll.dll!RtlAreBitsSet
77503A88 004014E0 002F9000 00000000 ntdll.dll!RtlAreBitsSet

EmptyEpsilon.exe
ntdll.dll 6.2.17134.471
KERNEL32.DLL 6.2.17134.1
KERNELBASE.dll 6.2.17134.441
ADVAPI32.dll 6.2.17134.471
msvcrt.dll 7.0.17134.1
sechost.dll 6.2.17134.319
RPCRT4.dll 6.2.17134.471
SspiCli.dll 6.2.17134.376
CRYPTBASE.dll 6.2.17134.1
bcryptPrimitives.dll 6.2.17134.471
USER32.dll 6.2.17134.376
win32u.dll 6.2.17134.1
GDI32.dll 6.2.17134.285
gdi32full.dll 6.2.17134.471
msvcp_win.dll 6.2.17134.1
ucrtbase.dll 6.2.17134.319
exchndl.dll 0.7.7.0
PSAPI.DLL 6.2.17134.1
SHELL32.DLL 6.2.17134.441
cfgmgr32.dll 6.2.17134.1
shcore.dll 6.2.17134.112
combase.dll 6.2.17134.523
windows.storage.dll 6.2.17134.471
shlwapi.dll 6.2.17134.1
kernel.appcore.dll 6.2.17134.112
profapi.dll 6.2.17134.1
powrprof.dll 6.2.17134.1
FLTLIB.DLL 6.2.17134.1
sfml-audio-2.dll
sfml-graphics-2.dll
sfml-network-2.dll
WS2_32.dll 6.2.17134.1
sfml-system-2.dll
sfml-window-2.dll
IPHLPAPI.DLL 6.2.17134.1
OPENGL32.DLL 6.2.17134.1
WSOCK32.DLL 6.2.17134.1
libgcc_s_sjlj-1.dll
libstdc++-6.dll
mgwhelp.dll 0.7.7.0
VERSION.dll 6.2.17134.1
libFLAC-8.dll
libogg-0.dll
libvorbis-0.dll
libvorbisenc-2.dll
libvorbisfile-3.dll
libjpeg-62.dll
WINMM.DLL 6.2.17134.1
GLU32.dll 6.2.17134.1
dbghelp.dll 6.3.9600.17029
WINMMBASE.dll 6.2.17134.1
OpenAL32.dll
ole32.dll 6.2.17134.407
IMM32.DLL 6.2.17134.1
uxtheme.dll 6.2.17134.1
clbcatq.dll 2001.12.10941.16384
PROPSYS.dll 7.0.17134.112
OLEAUT32.dll 6.2.17134.48
MMDevApi.dll 6.2.17134.1
DEVOBJ.dll 6.2.17134.1
AUDIOSES.DLL 6.2.17134.471
AVRT.dll 6.2.17134.1
wintypes.dll 6.2.17134.523
MSCTF.dll 6.2.17134.376
ig9icd32.dll 22.20.16.4749
WTSAPI32.dll 6.2.17134.1
dxgi.dll 6.2.17134.112
dwmapi.dll 6.2.17134.1
igc32.dll 22.20.16.4749
mswsock.dll 6.2.17134.1
DINPUT.DLL 6.2.17134.254
HID.DLL 6.2.17134.1
SETUPAPI.DLL 6.2.17134.1
inputhost.dll
CoreUIComponents.dll 6.2.17134.376
CoreMessaging.dll 6.2.17134.471
ntmarta.dll 6.2.17134.1
WINTRUST.dll 6.2.17134.81
MSASN1.dll 6.2.17134.1
CRYPT32.dll 6.2.17134.1
TextInputFramework.dll 6.2.17134.376
NSI.dll 6.2.17134.1
dhcpcsvc6.DLL 6.2.17134.1
dhcpcsvc.DLL 6.2.17134.1
WININET.dll 11.0.17134.523
iertutil.dll 11.0.17134.523
ondemandconnroutehelper.dll 6.2.17134.1
winhttp.dll 6.2.17134.441
WINNSI.DLL 6.2.17134.1
urlmon.dll 11.0.17134.523
DNSAPI.dll 6.2.17134.441
rasadhlp.dll 6.2.17134.1
fwpuclnt.dll 6.2.17134.1
bcrypt.dll 6.2.17134.112

Windows 6.2.9200
DrMingw 0.7.7


Error occured on Friday, February 1, 2019 at 22:04:30.


Error occured on Friday, February 1, 2019 at 23:55:36.
`

Android crash

the game crashes when i tap join server on android, can make a server fine, and join it from my pc

on sony experia e1

Bundled "JSON 11" code should be updated to fix CMake deprecation warning

https://github.com/daid/EmptyEpsilon/runs/2924248598?check_suite_focus=true#step:5:46

CMake Deprecation Warning at SeriousProton/src/json11/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

It can be easily fixed downstream - in SeriousProton - since the SP project itself requires CMake >= 3.8.
However it should be fixed by the upstream of the JSON bundled code.

And since the bundled JSON code haven't been updated since 2018, the upstream might have already fixed it.


I can't find where was the bundled code taken from in this commit: 15a9cf6
@rdbahm , do you remember?

Can the information about the upstream fo the bundled code be added somewhere?

Segfault in 2022.03.16

When compiling and starting the recent version of EmptyEpsilon, the following segfault happens, when pressing start server or start client in the main menu.

Thread 1 "EmptyEpsilon" received signal SIGSEGV, Segmentation fault.                                    
0x00000000007f9b30 in sp::io::network::Address::getLocalAddress() ()

(gdb) bt
#0  0x00000000007f9b30 in sp::io::network::Address::getLocalAddress() ()
#1  0x00000000004fb2f2 in ServerSetupScreen::ServerSetupScreen() ()
#2  0x00000000004e9ade in MainMenu::MainMenu()::{lambda()#2}::operator()() const ()
#3  0x00000000004f3978 in void std::__invoke_impl<void, MainMenu::MainMenu()::{lambda()#2}&>(std::__invoke_other, MainMenu::MainMenu()::{lambda()#2}&) ()
#4  0x00000000004f2f91 in std::enable_if<is_invocable_r_v<void, MainMenu::MainMenu()::{lambda()#2}&>, void>::type std::__invoke_r<void, MainMenu::MainMenu()::{lambda()#2}&>(MainMenu::MainMenu()::{lambda()#2}&)
    ()
#5  0x00000000004f27b3 in std::_Function_handler<void (), MainMenu::MainMenu()::{lambda()#2}>::_M_invoke(std::_Any_data const&) ()
#6  0x0000000000418954 in std::function<void ()>::operator()() const ()
#7  0x00000000006573a7 in GuiButton::onMouseUp(glm::vec<2, float, (glm::qualifier)0>, long) ()
#8  0x000000000064c85d in GuiCanvas::onPointerUp(glm::vec<2, float, (glm::qualifier)0>, long) ()
#9  0x00000000007b2e66 in RenderLayer::onPointerUp(glm::vec<2, float, (glm::qualifier)0>, long) ()
#10 0x00000000007b2eca in RenderLayer::onPointerUp(glm::vec<2, float, (glm::qualifier)0>, long) ()
#11 0x00000000007b0844 in PostProcessor::onPointerUp(glm::vec<2, float, (glm::qualifier)0>, long) ()
#12 0x00000000007b0844 in PostProcessor::onPointerUp(glm::vec<2, float, (glm::qualifier)0>, long) ()
#13 0x00000000007eccdb in Window::handleEvent(SDL_Event const&) ()
#14 0x000000000073b675 in Engine::handleEvent(SDL_Event&) ()
#15 0x000000000073adc4 in Engine::runMainLoop() ()
#16 0x000000000040e890 in main ()
(gdb) 

The error seems to be happening in this line in src/io/network/address.cpp:

if (addr->ifa_addr->sa_family == AF_INET)

There is a check in the loop if addr is null but in this case addr is fine but addr->ifa_addr is null.

I'm not sure if there is a deeper issue, but this patch fixes it:

--- SeriousProton-EE-2022.03.16/src/io/network/address.cpp      2022-03-15 23:05:53.000000000 +0100
+++ /tmp/address.cpp    2022-09-15 12:23:30.305529074 +0200
@@ -130,6 +130,10 @@
             {
                 continue;
             }
+            //printf("addr->ifa_addr is %p\n", (void *)addr->ifa_addr);
+            if (addr->ifa_addr == nullptr) {
+                continue;
+            }
             if (addr->ifa_addr->sa_family == AF_INET)
             {
                 ::getnameinfo(addr->ifa_addr, sizeof(struct sockaddr_in), buffer, sizeof(buffer), nullptr, 0, NI_NUMERICHOST);

Close Parentheses in LOG(WARNING) line causes Linux build to fail to compile

Commit 00e728a - Lines 32 & 76 have a typo that causes the EE Linux Build to fail.

SeriousProton/src/clipboard.cpp

LOG(WARNING) << "Failed to execute /usr/bin/xclip for clipboard access");

Should be:

LOG(WARNING) << "Failed to execute /usr/bin/xclip for clipboard access";

Remove ) before ; at the end of the line.

After fix, compiles successfully on for Linux.
Windows Build compiles fine before and after fix.

Once fixed, xclip and this update works fine so far after installing it on Debian Jessie. Items are copied to clipboard and items are pasted.

Output of compile:

[ 55%] Building CXX object CMakeFiles/EmptyEpsilon.dir/home/user/code/SeriousProton/src/clipboard.cpp.o
/home/user/code/SeriousProton/src/clipboard.cpp: In static member function 'static string Clipboard::readClipboard()':
/home/user/code/SeriousProton/src/clipboard.cpp:32:80: error: expected ';' before ')' token
         LOG(WARNING) << "Failed to execute /usr/bin/xclip for clipboard access");
                                                                                ^
/home/user/code/SeriousProton/src/clipboard.cpp: In static member function 'static void Clipboard::setClipboard(string)':
/home/user/code/SeriousProton/src/clipboard.cpp:76:80: error: expected ';' before ')' token
         LOG(WARNING) << "Failed to execute /usr/bin/xclip for clipboard access");
                                                                                ^
CMakeFiles/EmptyEpsilon.dir/build.make:2975: recipe for target 'CMakeFiles/EmptyEpsilon.dir/home/user/code/SeriousProton/src/clipboard.cpp.o' failed
make[2]: *** [CMakeFiles/EmptyEpsilon.dir/home/user/code/SeriousProton/src/clipboard.cpp.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/EmptyEpsilon.dir/all' failed
make[1]: *** [CMakeFiles/EmptyEpsilon.dir/all] Error 2
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2

Cant build debug

So I noticed I can build release using your latest .dlls files for the stuff I was missing. But when trying to build EE for debug it is failing in serious proton, I see you are working serious proton 2, I was wondering if you could update the build guide for EE or help me out. I would love to help add content and help out.

httpServer.cpp
image
image

Re-implement RenderTarget::drawPoint

Raised by Okerampa in Discord: drawPoint was commented out when moving to SDL2 in 81a27ef, and other draw functions were re-implemented afterward, but drawPoint wasn't.

The ghost dot trail behind ships on radar views seems to be the only use of drawPoint in EE.

Method to synchronize assets from server to clients

Assets that are stored on the server cannot be synchronized with clients. This is particularly commonly requested for content mods and their related assets, like sounds, core ShipTemplates, and models/textures/ModelData.

SP/EE were designed for in-person LAN play, where sharing custom content with clients and configuring before playing is relatively straightforward and collaborative effort. With online play, each player has to have access to the assets and the knowledge of where and how to install them, or the GM has to distribute a pre-modified EE package.

Instead of solely relying on clients having the same content already installed locally, SP should have a method for synchronizing such assets from the server to clients for each scenario.

Segfault on Debian 11 with tun interface

EmptyEpsilon crashes on my Debian 11 VServer with a Segmentation Fault in getLocalAddress().

As far as I understand, the problem is, that the .ifa_addr of the addr struct is a null-pointer, in the addr belonging to a local tun-Interface (OpenVPN virtual network device).

Error

Thread 1 "EmptyEpsilon" received signal SIGSEGV, Segmentation fault.
sp::io::network::Address::getLocalAddress () at /dev/shm/michael/SeriousProton/src/io/network/address.cpp:133

src/io/network/address.cpp:133

Backtrace

(gdb) bt
#0  sp::io::network::Address::getLocalAddress () at /dev/shm/michael/SeriousProton/src/io/network/address.cpp:133
#1  0x00005555556c3855 in sp::io::network::UdpSocket::joinMulticast (this=0x5555568eaed8, group_nr=666)
    at /dev/shm/michael/SeriousProton/src/io/network/udpSocket.cpp:112
#2  0x000055555562f7ed in GameServer::GameServer (this=0x5555568eaeb0, __vtt_parm=0x555555df7fe8 <VTT for EpsilonServer+8>, 
    server_name=..., version_number=20220316, listen_port=35666, __in_chrg=<optimized out>)
    at /dev/shm/michael/SeriousProton/src/multiplayer_server.cpp:53
#3  0x00005555556e5b42 in EpsilonServer::EpsilonServer (this=0x5555568eaeb0, server_port=35666, __in_chrg=<optimized out>, 
    __vtt_parm=<optimized out>) at ../src/epsilonServer.cpp:11
#4  0x00005555556d8659 in returnToMainMenu (render_layer=0x0) at ../src/main.cpp:438
#5  0x00005555556d6d03 in main (argc=2, argv=0x7fffffffe568) at ../src/main.cpp:383

Contents of *addr

(gdb) p (ifaddrs)*addr
$1 = {ifa_next = 0x555556989318, ifa_name = 0x555556989304 "tun0", ifa_flags = 69841, ifa_addr = 0x0, ifa_netmask = 0x0, ifa_ifu = {
    ifu_broadaddr = 0x0, ifu_dstaddr = 0x0}, ifa_data = 0x5555569898e0}

Solution

I really don't know why the ifa_addr pointer is 0x0. The ip a command shows an valid IPv4 address for this interface.

Since I didn't find anything helpful in the ifa_flags (it's IFF_UP | IFF_POINTOPOINT | IFF_RUNNING | IFF_NOARP | IFF_MULTICAST | IFF_LOWER_UP), I would simply add a check whether ifa_addr is present and otherwise continue the loop.

Regression in dtoa_milo

It appears #48 broke double-to-string results, at least on macOS/Clang.

Commit c8d34e1 edited dtoa_milo.h. L294-295:

-	for (;;) {
+	assert(*len >= 0);
+	for (; static_cast<std::size_t>(*len) < sizeof(buffer);) {

Since then, time values in game state logs' entries on macOS using Clang appear to use 8 significant digits but place the decimal incorrectly. (Windows builds using mingw/gcc produce expected correct results, suggesting this is compiler-specific.)

For example, game state log entries generated from a Clang build on macOS, in sequence on the default 1-second interval:

{"type":"state","time":0.0,...
{"type":"state","time":9999.9618...
{"type":"state","time":2005.9697...
{"type":"state","time":3016.1952...
{"type":"state","time":4027.3675...
{"type":"state","time":5037.9233...
{"type":"state","time":6044.9862...
{"type":"state","time":7058.2418...
{"type":"state","time":8071.3281...
{"type":"state","time":9078.3576...
{"type":"state","time":1008.8505...
{"type":"state","time":1109.3027...

The values are numerically "correct" (0, 0.9999, 2.005, 3.016, 4.027 ... 9.078, 10.08 would be expected), but the decimal is fixed to the fourth place inappropriately regardless of the value (0, 9999., 2005., 3016., 4027. ... 9078., 1008.), resulting in the values being out of order to their sequence. In the above example, the value at 1 second (9999) > the value at 9 (9078) seconds, the value at 10 seconds onward < the value at 2 seconds, etc.

This in turn breaks the game state log viewer, which relies on the time values being at least relatively accurate to each other in order to correlate each event line from the game state log in the correct order for the mission timeline.

Reverting that change in dtoa_milo.h restores most of the expected behavior on macOS. It still writes more significant digits than Windows/gcc builds, but the values are at least relatively correct:

{"type":"state","time":0.0...
{"type":"state","time":1.0129369497299195...
{"type":"state","time":2.0181570053100588...
...
{"type":"state","time":9.101694107055664...
{"type":"state","time":10.112862586975098...
{"type":"state","time":11.118337631225586...

There's an updated upstream version of dtoa_milo.h, but it doesn't make a similar change to this loop: https://github.com/miloyip/dtoa-benchmark/blob/master/src/milo/dtoa_milo.h

[Logging] Off-by-one severity in log output written to file

Steps to reproduce

  1. Get a debug build of EE and run it in Windows.
  2. Observe the log line severities in the console output (INFO, WARN, ERROR, DEBUG).
  3. Get a release build of EE and run it in Windows.
  4. Observe the log line severities in the EmptyEpsilon.log output.

Expected behavior

The severities match.

Observed behavior

In the console output, severities are as expected:

INFO: This is an INFO log line
WARN: This is a WARNING log line
ERROR: This is an ERROR log line
DEBUG: This is a DEBUG log line

In the EmptyEpsilon.log written to file, they're jumbled:

[WARNING ]: This is an INFO log line
[ERROR   ]: This is a WARNING log line
[CRITICAL]: This is an ERROR log line
[INFO    ]: This is a DEBUG log line

Diff used to reproduce:

diff --git a/src/main.cpp b/src/main.cpp
index 56d48926..d9787361 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -124,7 +124,7 @@ int main(int argc, char** argv)
 #else
     Logging::setLogLevel(LOGLEVEL_INFO);
 #endif
-#if defined(_WIN32) && !defined(DEBUG)
+#if defined(_WIN32)
     Logging::setLogFile("EmptyEpsilon.log");
 #endif
     LOG(Info, "Starting...");
@@ -140,6 +140,10 @@ int main(int argc, char** argv)
     }
 #endif
     LOG(Info, "Using ", configuration_path, " as configuration path");
+    LOG(Info, "This is an INFO log line");
+    LOG(Warning, "This is a WARNING log line");
+    LOG(Error, "This is an ERROR log line");
+    LOG(Debug, "This is a DEBUG log line");
     PreferencesManager::load(configuration_path + "/options.ini");

     for(int n=1; n<argc; n++)

In logging, the output seems off by one from the array of corresponding SDL priority labels:

    const std::array<std::string, SDL_NUM_LOG_PRIORITIES - 1> priority_labels{
        "[VERBOSE ]: ",
        "[DEBUG   ]: ",
        "[INFO    ]: ", // written for DEBUG level
        "[WARNING ]: ", // written for INFO level
        "[ERROR   ]: ", // written for WARNING level
        "[CRITICAL]: " // written for ERROR level
    };

Allow Cross Domain Origin access to the Web Server

Currently it only supports accessing the JSON page from the same server. Any webpages being served from another webserver (or locally from a file) can not access it due to CORS errors.

The following would need to be added around Line 301 in src/httpServer.cpp to create the necessary header to support Cross Domain access to the JSON files generated by EmptyEpsilon.

reply += "Access-Control-Allow-Origin: *\r\n";

Example
http://MyEEServer:8080/get.lua?alert=getAlertLevel()

Can be replicated by downloading https://gist.github.com/kwadroke/6f4aa0837a5be0621552
and accessing it via a browser using a file url (example: file:///home/user/ee_alert_status.html)

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.