Skip to content
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

surfaceflags are defined in engine code, not in game code #107

Closed
illwieckz opened this issue May 13, 2018 · 6 comments · Fixed by Unvanquished/Unvanquished#1107 or #177
Closed

surfaceflags are defined in engine code, not in game code #107

illwieckz opened this issue May 13, 2018 · 6 comments · Fixed by Unvanquished/Unvanquished#1107 or #177

Comments

@illwieckz
Copy link
Member

See: src/engine/qcommon/surfaceflags.h

They contains Unvanquished-specific code like CONTENTS_NOALIENBUILD. Those flags are game-specific, for example the value for Unvanquished's nobuild surfaceflag is known to be the value for the Urban Terror metalstep surface.

@illwieckz
Copy link
Member Author

illwieckz commented May 13, 2018

Can we imagine a kind of proxy array?

Engine would have:

#define ENGINE_SURF_METALSTEP 0x1;
#define ENGINE_SURF_NOBUILD   0x2;
#define ENGINE_SURF_SNOWSTEP  0x4;
#define ENGINE_SURF_LANDMINE  0x8;

One game would have:

#define GAME_METALSTEP 0x1;
#define GAME_SNOWSTEP  0x2;

surfaceflags[GAME_METALSTEP] = ENGINE_METALSTEP;
surfaceflags[GAME_SNOWSTEP]  = ENGINE_SNOWSTEP;

Other game would have:

#define GAME_SURF_NOBUILD   0x1;
#define GAME_SURF_METALSTEP 0x2;

surfaceflags[GAME_SURF_NOBUILD]   = ENGINE_NOBUILD;
surfaceflags[GAME_SURF_METALSTEP] = ENGINE_METALSTEP;

So, instead of testing for SURFACEFLAG we would test for surfaceflags[SURFACEFLAGS], I don't know if it's silly or not… [Well, this is absolutely silly, it's not how bitwise operations works, but you got the idea of something acting like a proxy].

@DolceTriade
Copy link
Contributor

I think we need to ensure that all the surfaceflags used by the engine are common between all the games. The game should be able to define additional surface flags in their own header files that the engine doesn't need to know about.

IIUC, these surface flags are just used as parameters to trace functions. It would be sufficient to simply have two header files.

@illwieckz
Copy link
Member Author

illwieckz commented Oct 21, 2018

One of great thing in QVM / NaCl is that any game developer can provide a game without having to go to the engine build process that requires having a toolchain (and perhaps the related hardware) for all supported OS and architectures. Doing this kind of customization at run time to enable game developers to not have to rebuild engine themselves on a release purpose would lower the entry gap a lot. I'm not sure people rebuild themselves and have to rebuild themselves the whole Godot, UE4, Unity or the Source Engine to be able to release.

Having to rebuild and ship its own engine was the biggest issue of id tech 3 in the long time, that was a project killer. See comments in this Smokin' Guns thread:

TheDoctor: Also, I think, it was a bad idea for every Q3 mod to become standalone. If there would be a chance for a number of games to share a single engine again, this would help to share a player base and assemble forces.

This and my answer starting with Yeah, that was both a bad idea and a big mistake.

Going through the engine release process is very hard (and we know something about it), making that process a requirement is deadly for projects. There is some technical issue related to this but the biggest issues are related to how human beings behave.

@illwieckz
Copy link
Member Author

Another related issue (but simple issue) is terminology. It would be possible to use a generic team_red / team_blue wording, and well, we already do this, look at plat23 map! 😉

And this would make things less weird if some game needs to add a third team or more and require surfaceflags for that.

@illwieckz illwieckz added this to To Do in Smokin' Guns Oct 24, 2018
@illwieckz illwieckz added this to To Do in Xonotic Oct 24, 2018
@illwieckz illwieckz added this to To do in UnrealArena Oct 24, 2018
@illwieckz illwieckz added this to To do in Unvanquished Oct 24, 2018
@illwieckz illwieckz removed this from To do in Unvanquished Oct 24, 2018
@illwieckz illwieckz added this to To do in Standalone via automation Oct 24, 2018
@illwieckz illwieckz removed this from To do in UnrealArena Oct 24, 2018
@illwieckz illwieckz removed this from To do in Xonotic Oct 24, 2018
@illwieckz illwieckz removed this from To do in Smokin' Guns Oct 24, 2018
@t4im
Copy link
Contributor

t4im commented Nov 14, 2018

Might be useful to get a general overview about where the maps used by games differ by collecting surface and content flags somewhere. Including for games that have not yet decided to attempt a daemon port.

@illwieckz
Copy link
Member Author

@t4im such surface flags are documented in q3map2 source tree, in game_*.h files:
https://gitlab.com/xonotic/netradiant/tree/master/tools/quake3/q3map2

example:
https://gitlab.com/xonotic/netradiant/blob/master/tools/quake3/q3map2/game_unvanquished.h

By comparing quake3 and unvanquished we see that unvanquished's nobuild content flag uses the same value quake3 uses for metalstep surfaceflag. Content flags and surface flags are not same things but I guess there is something wrong somewhere like setting the content flag from the surface flag or something like that because urbanterror (quake3)'s metalsetp surfaces prevents to build in unvanquished.

NetRadiant trees has all the defines [GtkRadiant has] (with more games and more options).

Sometime those files are living within their own fork tree, like the game_smokinguns.h file (I will import it one day btw).

Games can also ship those defines in a custinfoparms.txt file.

illwieckz added a commit to illwieckz/Daemon that referenced this issue Mar 4, 2019
illwieckz added a commit to illwieckz/Daemon that referenced this issue Mar 10, 2019
@illwieckz illwieckz added T-Improvement Improvement for an existing feature T-Cleanup and removed T-Improvement Improvement for an existing feature labels Mar 24, 2019
illwieckz added a commit to illwieckz/Daemon that referenced this issue Jan 5, 2020
…fix DaemonEngine#107

the surfaceflags.h file is entirely rewritten from scratch as SurfaceFlags.h
under BSD license, which is better for a header file that is common to engine and game
illwieckz added a commit to illwieckz/Daemon that referenced this issue Jan 5, 2020
…fix DaemonEngine#107

the surfaceflags.h file is entirely rewritten from scratch as SurfaceFlags.h
under BSD license, which is better for a header file that is common to engine and game
illwieckz added a commit to illwieckz/Daemon that referenced this issue Jan 5, 2020
…fix DaemonEngine#107

the surfaceflags.h file is entirely rewritten from scratch as SurfaceFlags.h
under BSD license, which is better for a header file that is common to engine and game
Standalone automation moved this from To do to Done Apr 11, 2020
illwieckz added a commit that referenced this issue Apr 11, 2020
…fix #107

the surfaceflags.h file is entirely rewritten from scratch as SurfaceFlags.h
under BSD license, which is better for a header file that is common to engine and game
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Standalone
  
Done
3 participants