-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade SDL to version 2 #792
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exciting to see this. I'd like to play test before I approve.
@Loki1950 , I'd like you to play test this with a joystick as I don't have one setup. https://stackoverflow.com/questions/27567846/how-can-i-check-out-a-github-pull-request-with-git |
Also, it looks like we need to add sudo apt-get install libsdl2-2.0-14 to our test environments. Is this done somewhere in the code? |
In our dependency scripts. https://github.com/vegastrike/Vega-Strike-Engine-Source/blob/master/script/bootstrap |
@royfalk I installed Any how...what version of Assets-Production are you using? I rebuilt by
Guessing I need to update the Assets-Production some how. |
I usually work against asset-production master. I see I split the units in a relatively recent commit so try updating it. |
Yeah, that was it. My last couple employers don't do forking, so I've been getting use to just pulling origin and needed to pull upstream instead. It's relatively stable now - at least with respect to your changes; only issues I'm running into were previously known and now SDL related. Still wish we could improve our logging when JSON stuff fails so we could point this out better. |
- Log which build is being used - For DEBUG builds do not do *any* optimization so that source can be easily inspected under GDB/Debugger - Add logging of JSON data to help with Debugging - Use an iterable loop in the GFX Mesh instead of index based for better reliability; old loop could end up in weird circumstances
Files royfalk#1 with a couple small fixes. |
Don't forget to update https://github.com/vegastrike/build-system-docker-images/blob/master/script/bootstrap as well. It will be an apt command on some distros; an RPM-based command on others; etc. But hopefully you can just add SDL2 to the existing package lists, without too much trouble. Let me know if you want any help with that. We will also need to adjust vcpkg.json for the Windows builds. We will need to adjust the macOS CI scaffolding as well. |
Yeah, pulling upstream can be pretty important. I try to do that on a regular basis. |
@@ -38,10 +37,11 @@ int CoordinateSelectChange = 0; | |||
int CoordinateSelectmousex; | |||
int CoordinateSelectmousey; | |||
extern Vector MouseCoordinate(int mouseX, int mouseY); | |||
extern KBSTATE keyState[LAST_MODIFIER][KEYMAP_SIZE]; | |||
|
|||
extern KBSTATE mouseButtonState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um... what? Is it keyboard state or mouse button state?
At best, this is very confusing; at worst, it may not be correct at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's interesting....
https://wiki.libsdl.org/SDL2/SDL_GetMouseState - 32bit value
https://wiki.libsdl.org/SDL2/SDL_GetKeyboardState - 8bit value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks for a modifier key is also pressed ie:Ctrl,Alt etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh...it's our own definition - https://github.com/vegastrike/Vega-Strike-Engine-Source/blob/master/engine/src/in.h#L25
Perhaps it should be renamed to BUTTON_STATE or something - equally applies to Mouse, Keyboard, and even Joysticks and other inputs that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the BUTTON_STATE
idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm mixed on whether that should be in this PR or a separate one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want this in this PR. It's a mostly cosmetic thing and will impact 520 instances in around 30 files. It's better to do it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@royfalk OK, fair enough. That can be done in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment about keyboard state vs. mouse button state.
Protect from dividing by zero, and Log when it's attempted
Sorry. I'll try to get to all of this tomorrow. |
Nope I'm flying tomorrow. Will have to wait till middle of next week. |
I think this is a limitation of the JSON library we're using. I suspect that when we move to boost, we'll get better errors. |
Should we get this PR ready for commit before changing that as it is in a different repo? |
@BenjamenMeyer @Loki1950 please try and build and play using a joystick. Before we go and switch dependencies, I'd like to know basic game play isn't affected. |
@stephengtuggy has joystick same model as mine even I am limited to my laptop ATM which does not have a build environment. |
Sorry, guys, I've been pretty busy the last few weeks. New job and such. I will try to test these changes some this weekend. With my joystick. We really need to get the CI fixed. Both in general, and for this PR specifically. I don't have a high degree of confidence in this code without the CI working (even if that's not the fault of these changes). There's just too much uncertainty involved. Also, if the left-right control cuts in and out, that's concerning to me. I don't think it was like that before. Was it? Another thing. Why do we have to update to the latest Assets-Production upstream master in order to run the latest game engine code? I thought we agreed that the game engine was supposed to remain backwards compatible with the old asset formats? Finally: A lot of these "JSON errors" seem to come from expected JSON files just not being present at all. Can't we check for those conditions specifically, and display an error message that is more specific about the files being missing? (If we error out at all in that case -- see last paragraph.) |
We discussed the keyboard state vs. mouse state nomenclature issue, and agreed to tackle that later.
I am a lot less familiar with the CI. What's broken and how can I help?
I have not experienced that in my testing. The game has many bugs and instabilities. Not sure if this is new or specific to @BenjamenMeyer 's system and hardware.
This is partly a limitation of simpleson, the JSON parsing library I've used. I wanted boost, but we did not support this version yet. We need 1.75 for it. |
You could maybe start by reviewing #789 .
This PR specifically touches code related to the keyboard and mouse inputs. If we are seeing issues related to that functionality -- issues that might be new -- that, to me, is a major red flag. I'm not willing to move forward with merging this PR until we have a lot more certainty about where these issues are coming from.
Backwards compatibility of the asset file formats is a requirement for 0.9.x. If we cannot sustainably support both old and new formats, then we need to go back to the old asset formats only, at least until 0.10.x. |
I'll try to take a look. Sept is going to be busy for me IRL though so will see what I can do.
I think it may have been; may be not as often but I don't think its new. So I'm not concerned about it for this branch unless others are seeing it.
The point of the Engine Version was for Game Assets to be able to determine if they were compatible. If we need to make a breaking change on master since the last release then we need to rev that version so the Game Assets will error out or at least warn accordingly. We already rev'd it for 0.9.x to Version 2 (https://github.com/vegastrike/Vega-Strike-Engine-Source/blob/master/engine/CMakeLists.txt#L79) - 0.8.x was Version 1 and 0.7.x and earlier is considered Version 0. So we're good to make some breaking changes in 0.9.x. We should update the dev branches (master) our two associated assets (VS:UtCS/Assets Production; PWCU) so they continue to function though as we do. |
@royfalk The Windows build failures might be specified to this branch:
We probably need to update the Windows dependencies to include SDL2 as well. Fortunately looks like we can lookup packages easily enough: https://vcpkg.io/en/packages |
- Add SDL2 to the VCPkg configuration used by the Windows CI
@royfalk I added SDL2 to the vcpkg config in my PR against your fork/branch. |
Seems some of the platforms are failing on:
I wonder why there's an inconsistency since some platforms are building just fine. Interesting...Mac and Windows are now passing the build, but Linux is failing due to the above. 🤷 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly I think we need to hold this until we resolve the CI issue since this is directly related specifically to this PR and would break our primary platform (Linux)...otherwise we should be good to go.
#792 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my previous couple comments
Linux CI will pass once we update the images - currently in progress - vegastrike/build-system-docker-images#43 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving now that CI is passing
This upgrades SDL to version 2.
This is needed for dear imGui and also a good thing in general.
This PR touches inputs and not much else. Things to test are keyboard, mouse and joystick.
Code Changes:
Issues: