GMod - What are you working on? January 2015 (#41)

How much of a FPS impact do you think this has at average?

Given the FPS drop that the portal gun had using just two render targets, I’m guessing about 20-30.

[editline]clarity[/editline]
20-30 fps in total, that is; not a reduction of 20-30.

I set the portal depth to the maximum with no frame drop? (with ALL graphics related settings at maximum, including AA, AT, MB, HDR, etc.) at 1920x1080, VSync though. No frame drop in Portal 2 either, on max settings, at 1920x1080, in Co-Op mode, with 4 portals on screen at once.

He’s talking about the addon…

Ah. I don’t know much about that one.

How is this post dumb? Is it because I’m not up to date with the shit everyone else here does? Seriously? I don’t know much about this particular “Portal Gun addon”, other than it involved a portal gun, apparently with portals that render using 2 RT textures.

Just added autocomplete to my adminmod.

http://p.sup.sx/i/1421311676.gif[/t]
[t]http://p.sup.sx/i/1421311637.gif

As I said before, those are the TDM cars from workshop.

Does that work with quotes?

I really like what you did with that 3d2d vehicle speed :slight_smile:

Autocomplete is a sorely underused feature. What’s worse is when developers skip autocomplete AND they neglect the help text option.

Always use that fourth argument in

concommand.Add.

I always tried to make this work, could you publish an example ?

Since we’re on the topic of auto-fill ( a very useful but underused system )… Here’s what I’m working on:

It is commonly misunderstood how to properly integrate it despite wiki having a good example. On top of that, if you define a console command on the server and want autocomplete you need to have the console command defined on the client and network it to the server to execute it on the server ( which is why I added that feature to my net system: https://bitbucket.org/Acecool/acecooldev_base/src/master/gamemode/shared/classes/networking/cl_networking.lua?at=master first function; and I’ll be adding helper functions to easily add it )


networking:AddConCommand( "dev_spawnent", function( _cmd, _input )
	// Set up out list, and process the input; it needs to be trimmed because the space ( which separates args ) isn't excluded...
	_input = ( !_input || _input == "" ) && "" || string.Trim( string.lower( _input ) );
	local _list = concommand.GetAutofillEntityList( _cmd, _input, _list )

	return {
		_cmd .. " <Entity ClassName>";	// This one is to show the player what is expected
		unpack( _list );	// And this shows data based on what the user is typing
	};
end, "[DEV] Spawns an entity, x, ( 5 feet + object size ) in front of the player." );



//
// This will be changed into a full fledged autofill system; this particular partial will be in charge of 
// replacing <entity> or whatever in the template text.
//
function concommand.GetAutofillEntityList( _cmd, _input )
	// Helper function to avoid needing to repeat this code over and over... Pass by reference, we're modifying _list directly.
	local function ProcessEntityList( _cmd, _input, _data, _list )
		for k, v in pairs( _data ) do
			local _bContains = !_input || _input == "" || string.StartWith( string.lower( k ), _input );
			local _blacklisted = ( BLACKLISTED_ENTITIES[ string.lower( k ) ] || BLACKLISTED_WEAPONS[ string.lower( k ) ] );
			if ( _bContains && !_blacklisted ) then
				table.insert( _list, _cmd .. " " .. k );
			end
		end

		return _list;
	end

	// All of the _list = aren't needed because of pass by ref, the helper-function is modifying the actual list
	// so it isn't needed; but I plan on recoding it to make it much more robust so I'm leaving it...
	local _list = { };
	_list = ProcessEntityList( _cmd, _input, list.Get( "SpawnableEntities" ), _list );
	_list = ProcessEntityList( _cmd, _input, list.Get( "NPC" ), _list );
	_list = ProcessEntityList( _cmd, _input, list.Get( "Weapon" ), _list );
	_list = ProcessEntityList( _cmd, _input, list.Get( "Vehicles" ), _list );

	return _list;
end

So I’m working on making it easy to add autofill so you can set up an autofill by specifying arguments ( like “<cmd> <ent_class>”, “<cmd> <ent_id>”, “<cmd> <player_steamid>”, “<cmd> <player_name>” and see if I can add sub-options such as <player_steamid:display name> so a name will be displayed but the steamid will be used when selected )…

[editline]15th January 2015[/editline]

The wiki has a great tutorial, the function I provided to generate a list will also work ( just create the blacklist table, etc in the form: blacklists = { weapon = true, ent_class = true }; etc… )

Why would you even… Just table.insert at the first position.

The function returns a table while the autocomplete system requires a table, not tables in tables.

This was just the first “proof” I wrote to start developing the automatic auto-fill system so there will be changes to optimize it ( and when it is done it’ll require an argument which sets the layout of the auto-fill meaning I can just return _list; because the list will automatically insert the layout string as the first entry and process any replacements ).

I could define the table there and then using Lua pass-by-reference system to modify the table directly without needing to return anything which would also allow me to return _list but that just means more code the end-developer will need to write for the system to work. It’ll be more of a 1 line thing when I’m done such as:


networking:AddConCommand( "ban", "<player_steamid:display name> <time:abs, duration>" );

which would then add a clientside console command “ban” which networks to the server ( meaning the console command exists on the server and can have all of the checks but have a clientside autocomplete while the security checking remains on the server ) with automatic display of the helper string and player names which get replaced with steamid then number for ban time…

Inserting at the first position is as bad as what the current code does. It inserts at the first position and shifts all other values over by 1 ( n times ) whereas the current one is n for the current table, ie n-1…

It’ll be revised and optimized so that unpack won’t be needed in the future and the helper line will be the first entry before the others are added ( instead of the dev needing to create the list before the call to the helper/replacer function, etc… )

This code is ran once at startup. Optimization at this level means nothing.

Yes.

There’s a pretty basic example on the wiki that should give an idea how it works. http://wiki.garrysmod.com/page/Autocomplete_Tutorial

Actually, results change as the player types for auto-complete to narrow down the list; it isn’t ran once…

But registering the autocomplete is ran but once, and that is where the dispute is.