• Control Points
    13 replies, posted
  • Avatar of mrflippy
  • I've been working on a set of control point entities for a few weeks. The general idea is to have a set of entities that mappers and gamemode creators can use to make control point games. I'm basing them fairly heavily on the TF2 entities to start with. In addition to a usable set of gmod entities, I hope to provide a set of base control point entities that can be easily inherited to use for specific cases or other games. My test case right for this right now are the TF2 entities -- I can load up a TF2 map in Garry's Mod and the existing control point entities work with my framework. My initial idea is to provide entity types based on the TF2 entities (the gmod entities will likely have different names to differentiate): [list] [*][url=http://developer.valvesoftware.com/wiki/Trigger_capture_area]trigger_capture_area[/url]: triggers when players step on it to capture the point [*][url=http://developer.valvesoftware.com/wiki/Team_control_point]team_control_point[/url]: the control point entity [*][url=http://developer.valvesoftware.com/wiki/Team_control_point_master]team_control_point_master[/url]: controls the points [/list] I think there are some other entities involved sometimes, but these three are my goal for version 1. I have the trigger and point entities more or less functional, but haven't started on the master yet. Features and Goals: [list] [*]Supports key/values entered in Hammer [*]Supports inputs/outputs entered in Hammer [*]Supports Garry's Mod hook system [list] [*]Will raise events at appropriate times (point captured, start capture, etc. actual list of events still TBD) [*]These can be hooked by using the existing gmod hook.Add function [/list] [*]Works with existing Garry's Mod team system [list] [*]Works for more than 2 teams (This may be too complicated; we'll see) [/list] [*]Easy to hook into gamemodes -- a gamemode creator shouldn't have to modify the control point entity code at all, just drop them in and configure/hook events. [/list] I'm at work, so no screenshots right now, but imagine a couple of TF2 control point images right here. I threw together a quick Fretta gamemode to test out the control points. [url="http://mrflippy.net/garrysmod/control_points/control_points.zip"]Download[/url]
  • Avatar of Yobdren
  • I was working on a control point system too, but haven't had the opportunity to test it yet. I'm not so certain if you need a master entity, though.
  • Avatar of mrflippy
  • [QUOTE=Yobdren;15696261]I was working on a control point system too, but haven't had the opportunity to test it yet. I'm not so certain if you need a master entity, though.[/QUOTE] Yeah, I was leaving that until last. I think something like it is probably necessary if you want to let a mapper define the control point layout though. How far did you get on your system?
  • Avatar of Yobdren
  • Fairly far. I didn't implement any master entity, but it runs off the control point and the brush for the capture zone. It should earn capture based on the players inside it. For example, 1 player from team 1 means that it gains 1 capture every time it adds percentage. Two makes it 2. If there are two from team 1 and one from team 2, only 1 capture will be added every check. The rate can be configured by the mapper.
  • Avatar of mrflippy
  • Yeah, I was thinking about adding an attacker/defender difference capture mode later. Right now it just does the standard any defender blocks the cap.
  • Avatar of Yobdren
  • I just felt it was easier. Because there are only two teams, -100% goes to one team, and +100% goes to another.
  • Avatar of mrflippy
  • I threw together a quick Fretta gamemode to test out the control points. [url="http://mrflippy.net/garrysmod/control_points/control_points.zip"]Download[/url]
  • [QUOTE=mrflippy;15717255]I threw together a quick Fretta gamemode to test out the control points. [url="http://mrflippy.net/garrysmod/control_points/control_points.zip"]Download[/url][/QUOTE] [lua]function GM:CheckRoundEnd() --TODO: this is super hacky, clean it up local capPoints = ents.FindByClass("team_control_point"); if(capPoints[1]:GetOwningTeamId() == TEAM_RED and capPoints[2]:GetOwningTeamId() == TEAM_RED and capPoints[3]:GetOwningTeamId() == TEAM_RED) then GAMEMODE:RoundEndWithResult(TEAM_RED); elseif(capPoints[1]:GetOwningTeamId() == TEAM_BLUE and capPoints[2]:GetOwningTeamId() == TEAM_BLUE and capPoints[3]:GetOwningTeamId() == TEAM_BLUE) then GAMEMODE:RoundEndWithResult(TEAM_BLUE); end end [/lua] :barf: Loops are your friend. At least then you can support multiple cap points.
  • Avatar of mrflippy
  • [QUOTE=SteveUK;15722154][lua]function GM:CheckRoundEnd() --TODO: this is super hacky, clean it up local capPoints = ents.FindByClass("team_control_point"); if(capPoints[1]:GetOwningTeamId() == TEAM_RED and capPoints[2]:GetOwningTeamId() == TEAM_RED and capPoints[3]:GetOwningTeamId() == TEAM_RED) then GAMEMODE:RoundEndWithResult(TEAM_RED); elseif(capPoints[1]:GetOwningTeamId() == TEAM_BLUE and capPoints[2]:GetOwningTeamId() == TEAM_BLUE and capPoints[3]:GetOwningTeamId() == TEAM_BLUE) then GAMEMODE:RoundEndWithResult(TEAM_BLUE); end end [/lua] :barf: Loops are your friend. At least then you can support multiple cap points.[/QUOTE] Oh yeah, it was 6am and I wanted to get it working. That's definitely changing in the future. I'm not even sure whether that code is going to remain there or go into an entity yet. Edit: I even put a comment there and everything :-P
  • [QUOTE=mrflippy;15723396]Oh yeah, it was 6am and I wanted to get it working. That's definitely changing in the future. I'm not even sure whether that code is going to remain there or go into an entity yet. Edit: I even put a comment there and everything :-P[/QUOTE] Why wouldn't you have done it as a loop to begin with?
  • Avatar of mrflippy
  • [QUOTE=SteveUK;15725200]Why wouldn't you have done it as a loop to begin with?[/QUOTE] Because I was falling asleep and didn't want to design another object.
  • Avatar of Deco Da Man
  • [QUOTE=mrflippy;15726442]Because I was falling asleep and didn't want to design another object.[/QUOTE] What? You could've just used loops in the first place.. it would have been easier than doing the if/elseif spam. And what the hell are you talking about, 'design another object'.. the fuck?
  • Can this be scripted for moar than two teams? Could you also script the points to provide resources if the gamemode allowed it? Could you have a master point wich waw non contestable its jus for a mode im thinking of freating involving turf warz