beyond-all-reason / beyond-all-reason/RecoilEngine
How many bytes is GameID?
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 38
Description
Event handler seems to accept gameID as a dynamic span (pointer + size) suggesting its size doesn't need to be constant
https://github.com/beyond-all-reason/RecoilEngine/blob/a84018ffa94c74d1f93b47f5d9a47991a68d3b5b/rts/System/EventHandler.cpp#L570
Some event listeners ignore the size and just assume it's 16 bytes anyway:
https://github.com/beyond-all-reason/RecoilEngine/blob/a84018ffa94c74d1f93b47f5d9a47991a68d3b5b/rts/Lua/LuaHandle.cpp#L859-L863
Some functions never even receive a size, just a raw pointer:
https://github.com/beyond-all-reason/RecoilEngine/blob/a84018ffa94c74d1f93b47f5d9a47991a68d3b5b/rts/Net/Protocol/BaseNetProtocol.cpp#L82
Demo format seems to have space for 64 bytes (each byte is encoded in two when ASCII, e.g. 0xFF)?
https://github.com/beyond-all-reason/RecoilEngine/blob/a84018ffa94c74d1f93b47f5d9a47991a68d3b5b/tools/DemoTool/StringSerializer.h#L18-L24
Where defined it's sometimes `uint8_t [16]` and sometimes `unsigned char [16]`, which should be the same in practice but who knows, C++ is scary.
Perhaps there should be some sort of `using gameID_t = std::array ` that everything could consistently use?
Contributor guide
Research direction
Start by comparing the GameID handling in rts/System/EventHandler.cpp, rts/Lua/LuaHandle.cpp, and rts/Net/Protocol/BaseNetProtocol.cpp with the demo serialization in tools/DemoTool/StringSerializer.h. Trace the existing uint8_t[16] and unsigned char[16] definitions and their callers to determine the intended size and representation. Done means the project has a documented, consistent GameID convention and the affected interfaces use it consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100