Programming three team CTF


I was wanting to use it because I wanted to make a green team mod & a new 3-way CTF gametype for it, but it turns out quite a bit of g_team.c & ai_team.c would have to be rewritten because of this…
Currently, the only 2 possible values for the friendly/enemy team would be TEAM_RED & TEAM_BLUE, I would like those to be TEAM_FRIENDLY, TEAM_ENEMY1, & TEAM_ENEMY2 for this gametype to be possible… Those values should be wildcards, and should be controlled by which teams are in the map, for ex. Blue & Red are at it again in 2-way CTF, TEAM_FRIENDLY would be the team that the bots/humans are on (on the Blue Team’s case, it would be TEAM_BLUE, & for the Red Team, it would be TEAM_RED. TEAM_ENEMY1 would be the opposite team (opposite values than TEAM_FRIENDLY), & TEAM_ENEMY2 would be set to no team, since there’s only 2 teams in that CTF. This configuration would allow you to select more than the blue/red team in 2-team CTF, & all 3 teams in 3-team CTF. I know what you’re thinking @zturtleman, it’s a bit unorthodox to have 3 teams in CTF, isn’t it? TEAM_FRIENDLY would in this case depend on whichever team you selected/whatever bots were selected to go there. Same with TEAM_ENEMY1 & TEAM_ENEMY2. Gameplay’s the same, except this time, there are 2 enemies of your team instead of one, & if you grab both teams’ flags, you earn 2 captures for your team because you captured 2 flags.
Green team is possible because there is a green team skin pk3 which is downloadable via
Hope I’m not tiring you out, @zturtleman

Make a Spearmint SDK to create mods for Spearmint

uh, yeah I’d probably just add TEAM_GREEN instead of conditional TEAM_ enums. Going to have to rework a lot of code either way.


I agree with that @zturtleman. Anyways, here’s a link to the green skin pk3, make sure to have the engine check to see whether that pk3 exists & if it doesn’t (or if checksum isn’t correct(would require modifications to mint-game.settings for this)), don’t allow selection of the green team, otherwise allow it.


I think you misunderstood. I meant if I was doing it I would add TEAM_GREEN but I’m not doing it, you are. I don’t think it fits in mint-arena and I don’t have time to start a new game/mod right now.


So TEAM_GREEN it is then. Well, yes, I am doing this so yeah. You can help if you wish. I realize you just don’t have time as it is, @zturtleman.


Three Teams aren’t new in Q3a mod scene. Maybe this will help you coltongit:


I’ve already got the green flags, the announcer sounds, the models, everything ready to go for the green team. Thanks for the help @KuehnhammerTobias. But yes, I will check out Tribal, and maybe I might use some of that mod’s stuff if it’s got better material.


I ran into a brick wall at the function int OtherTeam at g_team.c. Is it possible for me to use two teams for the returned value, & if so, how do you do it? I’m sorry for being a noob at C, but I’d just like to know. Any ideas @KuehnhammerTobias?


I assume you mean if you can return two different values at once! If so, than NO you will return only one return value. You have to rewrite the function, so you will always return the correct ‘other’ team.
BTW: Three teams is a hugh task! If you still using Notepad for your programming attempts, you will fail!


Probably having a cvar (like g_redenemyteam) could solve this calamity, @KuehnhammerTobias. It would be read-only & would only be used by the game to determine who’s the other team.
When at 0, Blue team’s the enemy,
When at 1, Green team’s the enemy.
Anyways, how do I program a cvar in for this very purpose? I think @zturtleman’s probably done quite a few of that.


I’m using Notepad++ for this task which is Notepad but allows you to program at the same time.


I wonder if it’s possible to do tag team CTF this way… using the neutral flag texture as a white flag & making skins for the white team…


I highly recommend to start doing it!
You will run into problems you currently didn’t even think of. But don’t be afraid, the problems would be solvable.

Just some general thoughts about making mods:

  1. what do you want to have, how should the final result look/feel/play like.
  2. what changes have to be made to which module (game, cgame, ui).
  3. search the whole codebase (game, cgame, ui) for already existing code you can reuse.
  4. search the Internet for tutorials (I already pointed you to some awesome tutorials)*.
  5. bigger projects (like 3 team ctf) will profit from version control software (put your mod on github).
  6. start with the game logic, than do the cgame stuff (effects, HUD, ui, whatnot).
  7. don’t expect others to do the work for you,
  8. but always feel free to ask for help if you can’t fix a problem you tried to solve for hours by your self.
  9. always do testing your code with some friends, sometimes others don’t like the things you deem as good.
  10. release, advertise, praise your code, and have fun!

*If you don’t like E-tutorials, I highly recommend this one: Focus on mod programming for Quake 3 Arena
There is a chapter explaining how to reuse existing flags for other colors, iirc…

Of course, you can make white skins, you need a paint program to do this…, this isn’t really related to programming.


I could just use the neutral flag skin off Team Arena… But thank you @KuehnhammerTobias! I won’t disappoint with this mod! It’s also my very first mod as well, & most likely the very first mod ever made for Spearmint. As such, I could use your help. Anyways, I’ve got qagame & the ui coded up, next up is cgame, then I’ll update my fork of mint-arena (I have one from when zturtleman fixed up the grappling hook) to the latest version & include the changes at the same time. Then we’ll see if it compiles & works correctly. If I find bugs that I can’t solve, then I hope you guys will help with this, OK?


cgame’s now finished, textures for the new team are underway (one of them has a story to it as well). Man, this is gonna be awesome…


Textures are all finished, a bunch of them turned out to be like the one I talked about in the last post - some of them actually went the other way around for some reason… Shaders are finished too. Here’s what I got for resources at this point:
Green team textures/flag models (includes fully independent models/CTF skins for some of the players, even the green ones):!wslUFRyL!8e9X_B-uViiUtOl0wHAZfdAvpDg8plegnwWpNj7XEQ0
Green team skins for everybody else:
Enjoy looking at my progress so far! Resource wise, at least. Reaper21x made the CTF skins for most of the characters, I’m just finishing up his work now. (Cadavre, Harpy, Yuriko, Grrl, literally everybody will be available for play in the up-&-coming mod). It will also allow you to play on the original 2 teams with them as well.


I ran into a brick wall when I got the code together and I tried to compile it. What I got for a compilation result is attached in this post if you’re wondering.
Here’s what I get:

Mind figuring out what’s wrong here guys? If only I knew what was wrong, @KuehnhammerTobias


Same as last time. You didn’t declare TEAM_GREEN. You also didn’t declare PW_GREENFLAG, and posssibly a few other things aren’t declared. Additionally you missed a ‘(’ somewhere,…

Why are you so resistant against suggestions? Put your code on Github, start become more professional!
Most people aren’t willingly to help if you resist to do at least a few minimum steps. It was already told to you [somewhere here] (Next tier won’t unlock for me in Spearmint) that it is more convenient for myself and others to see the changes you have made to the code!
As far as I am concerned, I’ll loose patience at some point,…


TEAM_GREEN doesn’t automagically exist. It has to be declared so it exists and has a value. Look at code/game/bg_public.h.


That should be fixed now. I think I forgot cg_newdraw.c when I coded the functions originally… I’ll go ahead & do that.