1. Post #1
    Gold Member
    mrflippy's Avatar
    June 2005
    128 Posts
    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][*]trigger_capture_area: triggers when players step on it to capture the point[*]team_control_point: the control point entity[*]team_control_point_master: 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.

    Download
    Reply With Quote Edit / Delete Reply United States Show Events Useful Useful x 1 (list)

  2. Post #2
    Yobdren's Avatar
    June 2008
    1,772 Posts
    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.

  3. Post #3
    Gold Member
    mrflippy's Avatar
    June 2005
    128 Posts
    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.
    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?

  4. Post #4
    Yobdren's Avatar
    June 2008
    1,772 Posts
    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.

  5. Post #5
    Gold Member
    mrflippy's Avatar
    June 2005
    128 Posts
    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.

  6. Post #6
    Yobdren's Avatar
    June 2008
    1,772 Posts
    I just felt it was easier. Because there are only two teams, -100% goes to one team, and +100% goes to another.

  7. Post #7
    Gold Member
    mrflippy's Avatar
    June 2005
    128 Posts
    I threw together a quick Fretta gamemode to test out the control points.

    Download

  8. Post #8
    Gold Member
    mrflippy's Avatar
    June 2005
    128 Posts
    ugh, what the hell

  9. Post #9
    Jaykin Bacon: Episode 3
    SteveUK's Avatar
    May 2005
    2,566 Posts
    I threw together a quick Fretta gamemode to test out the control points.

    Download
    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
    

    :barf:

    Loops are your friend. At least then you can support multiple cap points.

  10. Post #10
    Gold Member
    mrflippy's Avatar
    June 2005
    128 Posts
    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
    

    :barf:

    Loops are your friend. At least then you can support multiple cap points.
    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

  11. Post #11
    Jaykin Bacon: Episode 3
    SteveUK's Avatar
    May 2005
    2,566 Posts
    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
    Why wouldn't you have done it as a loop to begin with?

  12. Post #12
    Gold Member
    mrflippy's Avatar
    June 2005
    128 Posts
    Why wouldn't you have done it as a loop to begin with?
    Because I was falling asleep and didn't want to design another object.

  13. Post #13
    Gold Member
    Deco Da Man's Avatar
    July 2007
    964 Posts
    Because I was falling asleep and didn't want to design another object.
    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?

  14. Post #14

    April 2009
    57 Posts
    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
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Dumb Dumb x 2 (list)