Raptor007 / aq2-tng

Action Quake 2: The Next Generation. Raptor007's sandbox for testing changes. When verified stable, this code is pushed to the official aq2-tng repo:
https://github.com/aq2-tng/aq2-tng/tree/bots
4 stars 2 forks source link

Add Espionage mode from ETE library #111

Closed darkshade9 closed 5 months ago

darkshade9 commented 2 years ago

Hello,

I was talking with Paril over Discord about the potential of bringing over the last 'major' game mode of AQ2 over to TNG, that being Espionage mode. For those unfamiliar, it's a scene/mission-based mode where you have to perform objectives to gain round points, and the various types of scenes lend to different styles of play. For example, the Domination mode that was recently added is very much like the Capture and Hold mode in Espionage.

That said, there's a significant challenge ahead here. The code for Espionage (from the AQDT team) is likely lost to time entirely. I contacted Black Monk but I don't think he either has the code anymore, or he's sick of me asking for it after 20 years :) In either case, there's decompilation using something like Ghidra to discover the basic logic and functionality of the library, and the server package itself that contains the scene data for all game modes, which could be reverse engineered into a modern Espionage mode.

The goal here is to merge the last major variant of the original AQ2 1.52 code into TNG to create the 'end-all-be-all' library that can play any game mode, any time. Understandably with the current backlog of bugs and feature requests, this seems like a significant undertaking, but I wanted to throw the idea out and provide whatever support I can into it.

Raptor007 commented 2 years ago

Hi! I'm not familiar with Espionage mode but it sounds like a cool project, and a good fit for TNG if we can make it happen.

Disassembling or decompiling can be really messy, especially if the binary did not include debug symbols, which was often the case in the 90's to make downloads as small as possible. It may be easier to just play the mode, get a feel for it, and try to clone it that way. That's how I wrote Domination mode after playing it in UT99.

It looks like Espionage is running on 54.144.85.231:27913 and a quick search found this old binary on FilePlanet but let me know if you have a better way of playing Espionage or getting the files to host it.

Sorry, sometimes thing get busy for me, and when I have time I tend to bounce from project to project. AQ2:TNG is long overdue for me to bounce back to and clear some things off that to-do list!

darkshade9 commented 2 years ago

The most recent library is version 4.7 (running on that server, hosted by me), and it does include symbols (but not debug symbols). Running it through Ghidra provides all of the Espionage-specific function names and some idea on how the logic works, but like you said, it's messy. I have all of the files needed to host and play, and the docs do a pretty good job of explaining it. I have forked this repo and I have a branch that has some basic documentation as well as the wiki with a bit as well.

https://wiki.aq2world.com/wiki/Game_Modes:Espionage https://github.com/darkshade9/aq2-tng/tree/paril-notes/action/scenes https://assets.aq2world.com/archive/websites/aqdt.fear.net/aqdtdocs/index.html

Link to files: Linux (32-bit) https://files.aq2world.com/archives/aqo/aqete-47-i386-glibc.tgz Windows (64-bit) https://files.aq2world.com/archives/aqo/aqete-47-x86.zip

Paril agreed that it might be easier to take what the docs and configs tell us and reverse engineer it. We can setup a time to play to get an idea on how each scenario works if you are interested.

There's a bit of activity going on in the scene, we have started a mass migration of individual AQ2 Discord servers into a single one. The official AQ2World Discord server -- link if you want to join up: https://discord.gg/uQPtEmD53j

Raptor007 commented 2 years ago

I still want to help do this sometime, but we have a new baby so scheduling is very tricky right now. When I have some time, my first step will probably be to just do a LAN game myself to see how it works. Maybe you could also list out your favorite ETE features to make sure we hit all the important ones.

Not sure if you need this, but apparently I had ETE v4.6b installed at some point long ago (based on some files in my AQ2 folder) and found this scenes folder, which seems to define Espionage objectives: https://www.raptor007.com/action-quake2/aq2ete-scenes.zip

darkshade9 commented 2 years ago

Congrats on the new baby! You'll be plenty busy with all that comes with along with all that goes into baby stuff.

Regarding Espionage, some scenes only need 2 people to test (CNH, CTB, OFC) while others are minimum 4 (ETV, ATL, FRD) due to the nature of the scenarios. We can pretty easily test with duplicate clients.

I'll work on a list of all the features and add it to this issue.

Raptor007 commented 2 years ago

Thanks! By the way, if you could just fix the linefeeds in a_match.c, a_xmenu.c, and tng_stats.c (change CRLF back to LF) then I can approve your pull request #113 and clean up the special character stuff.

darkshade9 commented 2 years ago

I think the notes here are sufficient, if you have any questions or want to test some things out, let me know (scroll down to the README under the file listings). I've included links to the original AQDT (archived site) and the Wiki:

https://github.com/darkshade9/aq2-tng/tree/paril-notes/action/scenes https://wiki.aq2world.com/wiki/Game_Modes:Espionage

darkshade9 commented 2 years ago

I added some initial cvars for Espionage at https://github.com/darkshade9/aq2-tng/commit/9c77692ba13222240cb2886c8dc2f41e8979443a but it made me think that Espionage could be approached a few different ways -- could we tie into the Q2Pro entity overrides system and create scenarios from there? Not sure how to handle multiple scenarios on the same map, but that could reduce the amount of work involved in getting files parsed into game memory.

darkshade9 commented 2 years ago

Just took a look around at the contents of the tng directory. Currently it contains aqg files for Message locations flg files for Flag locations for CTF mode dom files for Domination mode locations

It could be used in the Espionage capacity as well, these become activated when use_espionage is set to 1 ctb files for Capture the Briefcase ofc files for One Flag Capture cnh files for Capture 'n Hold etv files for Escort the VIP frd files for Find, Retrieve, Deliver atl files for Assassinate the Leader (and a generic atl.atl that gets loaded for any map that does not have one specified, like cloud.atl)

darkshade9 commented 1 year ago

I had some recent chats with @iceman12k around getting the most basic of these game modes (ATL) directly as a game mode flag (like use_3teams).

Components needed:

darkshade9 commented 1 year ago

I've made some significant strides in this, we have a semi-functional Assassinate the Leader and Escort the VIP modes.

https://github.com/actionquake/aq2-tng/tree/gamemode/espionage

Raptor007 commented 1 year ago

Awesome! Let me know if you need help with anything, or when/if you're ready to push it upstream.

(Sorry, I was busy working on a big update for X-Wing Revival so I haven't looked at TNG for a bit, but that's done now!)

darkshade9 commented 1 year ago

Nice, congrats on the release.

Right now I'm struggling a bit with a few components as I think I've reached my knowledge limits. Essentially, ATL and ETV code was mostly derived from the Domination and CTF code, with a few custom bits and pieces.

  1. The 'flag' code is a bit of an amalgam of CTF and Dom, as the 'flag' in ETV mode is not an inventory item like in CTF, it acts more like a Domination target point, but the game ends when the leader touches it. I'm having problems getting it to 'reset' back to being unowned/untouched when a new round begins.
  2. Since the gamemode is GS_ROUNDBASED I've had to sprinkle in some respawn logic -- it 'works', but it could be greatly improved. I haven't tested custom spawn points extensively yet. The challenge I am facing is that the non-leaders should be respawning near their leader, rather than at their original spawnpoint, and I haven't figured out a good way to do that to ensure they don't respawn in closed-off rooms, or inside of a solid, or any other permutation that would cause the player to get stuck.
  3. Sometimes the game will just announce a winner, even though I think I've made very specific winning conditions, and they should reset every round (is leader alive, did leader touch the flag, etc)
  4. Chase cam won't activate on death anymore, need to find out why (probably a symptom of going_observer)
  5. HUD/scoreboard skin indexes don't seem to work, ideally I'd like to have the same scoreboard as CTF or Dominion, and perhaps an additional spot for the leader/leader_skin index

Probably a few other smallish bugs but those are the big ones right now.

I should mention, it's based on the latest AQtion, but I should be able to get a clean PR into your TNG upstream without all of the AQtion-specific stuff. There should be no dependencies on it.

darkshade9 commented 8 months ago

Made significant strides here, ATL and ETV modes are both very playable. Tracking bugs in https://github.com/actionquake/aq2-tng/issues

If we ever get enough people to playtest, we might be able to officially release it

darkshade9 commented 5 months ago

This is complete, Espionage ATL and ETV is live in TNG now. The other game modes could be migrated over but I think those are lower priority.