UnofficialCrusaderPatch / UnofficialCrusaderPatch2

Unofficial balancing patch installer for Stronghold Crusader 1
MIT License
430 stars 59 forks source link

Game Overlay #453

Open GRhin opened 5 years ago

GRhin commented 5 years ago

I expect this is outside of UCP's purview. I would like to know if its possible (at least if someone can point me in the right direction to figure it out myself) to create an overlay for SHC that uses current game information for a spectator/viewer For example it will show on top of the stronghold game some text with player names, worker count, army count, and gold count, maybe a "greatest lord" score. A more advanced version would allow the viewer to select a player to show in-depth information (i.e. score breakdown, army breakdown -how many of each unit, eco breakdown -how many of each type of eco building are manned/built). This is all information that should be accessible somehow from the process (the way cheat editor can access them), so getting the information might be the easy part, displaying it over SHC may be the hard part, an inferior solution would be to allow me to pull those stats into OBS so it will show up on my streams, which is the place i want it for. However others might want this for other purposes.

JuGGerNaunT commented 5 years ago

It is possible. Especially an inferior solution, since SH store its all its data in static arrays. The hard part here, though, is to find a developer who agree to sacrifice his time on such tool.

GRhin commented 5 years ago

I know basics of coding, worked as a web developer for a few years. I just need to figure out what to google to get me started. Googling "ingame overlay" comes up with twitch overlays or programs to display fps over games.

JuGGerNaunT commented 5 years ago

I would recommend to start with some kind of widget for OBS since it much easier and such approach is much more flexible. I don't know if OBS supports native applications as a widget, but if it does all you need to do is to create simple form/panel with visual values and update those values with game data. You can get game data same way cheat engine do using ReadProcessMemory function. Game overlay for SH is more universal since other players also may use for their purposes but it require more advanced programming knowledge. You need to inject you code into the game and use game functions to draw information on the screen. Since SH uses fossil DirectDraw7 technology you also very limited in what you can display and how you have to do it. Game itself only draw text, rectangles, straight lines and sprites.

GRhin commented 5 years ago

Thanks for that, I have found a nodejs library that allows for doing this, which means less to figure out for me. OBS does not read from an application, however it can open a browser source, so nodejs may be best for that too. As for SH overlay limitations, all I really need is text, the only thing that would be more difficult in that case is to set up a player select option to give detailed breakdowns, But the base score/troops/gold details is the main thing. It does sound like its a bit above my skill level at this current stage though.

GRhin commented 4 years ago

I have worked on the inferior version with @patel-nikhil https://github.com/patel-nikhil/SHCLiveStatReader

Ill leave this open as a request of the complex version, and of having stats show in-game