Ulysses

General => Developers Corner => Topic started by: LuaTenshi on August 01, 2011, 08:00:58 PM

Title: Help build a game mode!
Post by: LuaTenshi on August 01, 2011, 08:00:58 PM
It's a cool idea, but I've learned from personal experience that separate projects should stay separated. :)

I have said before that the game-mode should be integrated with ULX but I have decided to scrap that idea. But I would still like to make the game-mode.

I have an idea for a game mode that in my mind would be lots of fun.

The idea is that players a split into two factions, each faction will have a Commander, a General, Soldiers, and Engineers. Within the first hour of a round the teams start building a base. When the game starts the Soldiers will push forward to destroy the other teams base as the General formulates an attack strategy that is displayed in the soldiers HUDs. The Commander will be the foundation of both teams he will pretty much have the ability to ruin a team financially, he buys and summons each unique weapons.

Commanders and Generals are voted upon in the pregame lobby.

Please feel free to build on to my idea and help this game mode become a reality, if some one would explain game mode hooks to me in detail I will be able to work on this game mode as well.

This is my first huge project and I intend to pull through on it, to quote a movie... "May be not today, may be not tomorrow, but some day."


UPDATES
1. I have posted this on face-punch as well. HERE (http://www.facepunch.com/threads/1113716-Help-build-a-game-mode!)
2. Added a Source Forge Page HERE (https://sourceforge.net/p/theunitywithin/home/Home)
Title: Re: A Game mode integrated with ULX.
Post by: Megiddo on August 01, 2011, 08:15:34 PM
It's a cool idea, but I've learned from personal experience that separate projects should stay separated. :)
Title: Re: A Game mode integrated with ULX.
Post by: Megiddo on August 01, 2011, 09:43:27 PM
"A Game mode integrated with ULX" -- I'm saying that ULX should remain only an admin mod.
Title: Re: A Game mode integrated with ULX.
Post by: LuaTenshi on August 02, 2011, 11:15:52 AM
"A Game mode integrated with ULX" -- I'm saying that ULX should remain only an admin mod.

Ah OK, I will change the "view" then. Because I still would like to make a game-mode but I don't know enough to be able to do it on my own.
Title: Re: Help build a game mode!
Post by: Aaron113 on August 02, 2011, 02:21:06 PM
Its OK, reading this actually made me laugh at my self and made my day. I miss-typed on the "ccarm" part and I don't know what possessed me to put the "command" part in there.

Ps: I would like you to help me with my game-mode, because the idea I have is simply complicated here it is here...
http://forums.ulyssesmod.net/index.php/topic,5361.0.html (http://forums.ulyssesmod.net/index.php/topic,5361.0.html)
I can help on specifics.  I don't intend to help code an entire gamemode though.
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 02, 2011, 07:14:40 PM
I can help on specifics.  I don't intend to help code an entire gamemode though.

That's actually what I want I want people to work on bits and pieces that come together in unity to form a game-mode.

I wish there was a video on game mode creation I read that tut over 3 times and I still cant quite get it. I am starting to understand the basics tho.

I need to open an SVN on source-forge somehow...

Edit: I also need a name for this game-mode, I am not good with names.
Title: Re: Help build a game mode!
Post by: JamminR on August 02, 2011, 08:31:25 PM
Edit: I also need a name for this game-mode, I am not good with names.

Idea reminds me of any military or, eek, corporate environment.
Names that come to mind regarding both...
Grunts
Peons
Title: Re: Help build a game mode!
Post by: Ishidashadow on August 03, 2011, 12:28:45 AM
I felt as though that the OP didn't quite elaborate enough on the gamemode's function, so I spoke with the author of the thread about it and I wrote up an extended version of the ideas he had discussed with me. Hopefully this will answer some questions, though in my personal opinion this whole thing seems a tad too ambitious...

Quote
The general premise of the gamemode is an RTS/FPS hybrid that involves two teams and four classes. The four classes are as follows:

The Commander - The head-honcho behind the whole operation. Manning an overhead view, a player in this position sets up static structures that serve basic functions. Each team begins with a "core" structure that acts as the central defensive point. The enemy will do everything in their power to destroy it, so it must be guarded at call costs. The Commander cannot move this structure and can only build other structures within a certain range of the "core" (the exception being harvesters). Each building constructed has a range of assembly, thus the “global base area” is not always perfectly circular. Structures have a variety of functions, such as gathering resources to either use as material or to sell for funding. Buildings require both resources and money to use; therefore a structure such as a harvester is handled more as an investment rather than an instant gain. Commanders also purchase the weapons that the other classes will be able to use. Commanders are decided upon by a vote at the beginning of the game. If the vote fails, a random commander is chosen.

The Engineer – An expertise in the inner-workings of the operation. Engineers hold a special role of fortifying the “core” and the structures of the team’s base in order to provide the enemy an obstacle to their mission. The spawn menu is replaced with a limited menu in which only certain models (such as the blast door with its weight lowered) can be spawned. Engineers are equipped with a gravity gun and a low-damage, high-recoil pistol at start. Engineers are stripped of their gravity gun when they are out of the build range that the structures have. The props are automatically frozen when punted, so it the gravity gun cannot be used as a weapon. Each prop model has their own health and resource cost, so the Engineers and Commander must cooperate in order to balance out prop fortification, weapon use and structure handling.

The Soldier – The basic offensive unit of any squad. Playing as a soldier is straight-up team deathmatch, though soldiers do serve an integral role in the team. For one, they are the only class (excluding the general) that can destroy the enemy’s “core”. In addition to this they are the most heavily armed class, starting off with a medium-damage, low-ammo shotgun and then can permanently use any weapon that the Commander buys. Soldiers can shoot props and enemy structures to damage/destroy them. For the first few minutes of the game however, Soldiers are not allowed to enter enemy fort range, shoot any enemies within said range or damage props/structures that they own. What this essentially does is provides the all the Soldiers a chance to either get into a defensive position, a flanking point or just have fun killing other soldiers that have exited their stronghold. The Soldiers and Commander must also cooperate in order to provide efficient weaponry, as it costs money to provide arms.

The General – The intelligence agent and specialist in espionage. The General plays much like Solders in that they can also damage props and possess powerful artillery, but in contrast to Soldiers the General holds another function: planning out attacks. Unlike all the other classes, the General is able to spot enemies, their structures, and resource nodes from any distance by use of radar. While accessing the full radar view, the General can click on any point which draws a marker on the Soldiers’ HUD of said location. This waypoint-based system can be used for any purpose that the General wishes, whether it be to show where the enemy base is located, to display where a mass of enemies are positioned (perhaps to form a flanking strategy) or just assist the commander in harvester placement. The General, like the Commander, is voted upon at start and is chosen at random if said vote is unsuccessful. There is one drawback to the General though: their life is precious and limited. If the General of a team dies, the player is swapped to the Soldier class and a certain amount of time must be passed in order for the General to return. After the time has passed, another vote is presented to those within the fort to choose the General.

Due to the nature of this gamemode, a minimum of four players would be required (Commander and General on both teams) and at least eight players (One of each class on both teams) to experience all its features.
Title: Re: Help build a game mode!
Post by: JamminR on August 03, 2011, 02:17:09 PM
<clip> seems a tad too ambitious...<clip>

Perhaps, but, imagine what one might have said about ULib and ULX's current capabilities when originally being discussed in the beginning.
Though it grew to where it is today, I imagine dreaming should never stop.
Even if the full dream isn't realized...one always learns from it.
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 03, 2011, 07:09:31 PM
Any name ideas yet?
Title: Re: Help build a game mode!
Post by: JamminR on August 03, 2011, 08:33:19 PM
Any name ideas yet?
http://forums.ulyssesmod.net/index.php/topic,5361.msg24034.html#msg24034 (http://forums.ulyssesmod.net/index.php/topic,5361.msg24034.html#msg24034)
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 03, 2011, 09:37:00 PM
http://forums.ulyssesmod.net/index.php/topic,5361.msg24034.html#msg24034 (http://forums.ulyssesmod.net/index.php/topic,5361.msg24034.html#msg24034)

From that I see...

GaP
Grunts Vs Peons
GvP

I also see... "Turf Wars" but I think that one may be taken.

I like GaP what do you think?
Title: Re: Help build a game mode!
Post by: Ishidashadow on August 03, 2011, 09:48:18 PM
Perhaps, but, imagine what one might have said about ULib and ULX's current capabilities when originally being discussed in the beginning.
Though it grew to where it is today, I imagine dreaming should never stop.
Even if the full dream isn't realized...one always learns from it.

Very well said, I like that view on life. Perhaps I look upon my own failures with too much remorse to see the cup half-full; thanks for helping me grow as a person as well.  ;)

On Topic:

I do have a couple of names in mind - Partisan, Within Unity and Joint Stock, though these aren't exactly the "catchiest" of titles...
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 03, 2011, 11:12:22 PM
Very well said, I like that view on life. Perhaps I look upon my own failures with too much remorse to see the cup half-full; thanks for helping me grow as a person as well.  ;)

On Topic:

I do have a couple of names in mind - Partisan, Within Unity and Joint Stock, though these aren't exactly the "catchiest" of titles...

I read your names and when I got to the Within Unity part, I got all "COD Player" and started screaming because I like that so much. But I would change it to...
"The Unity Within" I think that has more of a catchy ring to it.
Title: Re: Help build a game mode!
Post by: Aaron113 on August 04, 2011, 09:05:22 AM
I'm terrible with names.  I have no idea.
Title: Re: Help build a game mode!
Post by: Megiddo on August 04, 2011, 02:41:54 PM
Hah, I'm also horrible with names. After all, ULX as a name was a rip-off from AMX/AMXX...
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 06, 2011, 12:11:28 AM
I have added yet another update, now there is a place for us to start building the Garry's-mod game modification that is called...

The Unity Within

Yep, I went with that name, I hope you all like it.

-----------

My friend was to lazy to create an account so I asked him if it was OK if I put what he said as a quote...

Quote from: Teh Engineer
I like the name GaP better, it just fits better then then the one you have now.
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 06, 2011, 08:29:58 PM
This is my script for the damage effects, I do not understand hooks at all, and hook.call has no explanation on the Gmod wiki.

Code: [Select]
function GM:EntityTakeDamage( ent )
 
if ent:IsPlayer() then
Hp = ent:Health()
if(Hp <= 41) then

Mult = (200 - Hp - 159)

hook.Call( "RenderScreenspaceEffects", RenderEFunc, Hp, Mult )
end
end
 end
---
Code: [Select]
local function RenderEFunc(Hp, Mult)

local tab = {}
tab[ "$pp_colour_addr" ] = 5 * Mult
tab[ "$pp_colour_addg" ] = 0
tab[ "$pp_colour_addb" ] = 0
tab[ "$pp_colour_brightness" ] = 0
tab[ "$pp_colour_contrast" ] = 1
tab[ "$pp_colour_colour" ] = 1
tab[ "$pp_colour_mulr" ] = Hp * 2
tab[ "$pp_colour_mulg" ] = 1
tab[ "$pp_colour_mulb" ] = 1
 
DrawColorModify( tab )
DrawMotionBlur( 0.5, 0.5, 0.1)
DrawBloom( 1, Hp/100, 3, 9, 9, 1, 255, 0, 0 )

end
 
hook.Add( "RenderScreenspaceEffects", "RenderEFunc", RenderEFunc )
Title: Re: Help build a game mode!
Post by: Megiddo on August 06, 2011, 10:53:31 PM
You don't need to use hook.Call for this, you only need to register the hook. (using hook.Register)
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 07, 2011, 01:31:34 PM
You don't need to use hook.Call for this, you only need to register the hook. (using hook.Register)

How would I use that? Its not even on the Gmod Wiki...

Are you telling me to use it the same way that I am using hook.Call?
Title: Re: Help build a game mode!
Post by: Megiddo on August 07, 2011, 02:24:36 PM
Sorry, not hook.Register... hook.Add. It's as you had it in the post above, if it's not working there's probably a bug in the code..
Title: Re: Help build a game mode!
Post by: JamminR on August 07, 2011, 04:31:32 PM
You mentioned you didn't understand hooks...well, for a game mode, you better learn! :)
In simplest terms I can think of;

Garry wrote hooks into Gmod.
Those hooks watch for specific events (Spawn,Death, TakeDamage, Suicide, ... ) within the game, no matter what type of game mode.
Adding a hook watcher (hook.add) makes your code look for any of those events, and if they occur, do something.
See also http://wiki.garrysmod.com/?title=Hook (http://wiki.garrysmod.com/?title=Hook)
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 07, 2011, 09:07:26 PM
I was reading the posts carefully and I found that Megiddo said that the code I had from before should work, now I feel stupid for posting script veriations  :-[

I will check to see if I get any other problems, also just woundering if any one else is working, or thinking about working on some thing for this game-mode.

I have decided to keep this closer to ULX and stay farther away from Facepunch because I was told and have also seen that facepunch is not a place for development.

(Why am I up at 5:30 AM you ask thats because I was haunted with thoughts about the game-mode...)
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 09, 2011, 02:20:04 PM
I am adding this into "...\lua\autorun\"

Code: [Select]
function GAMEMODE:EntityTakeDamage( ent )
 
if ent:IsPlayer() then
Hp = ent:Health()
if(Hp <= 41) then
hook.Call( "RenderScreenspaceEffects", RenderEFunc, ent, Hp )
end
end
end

local function RenderEFunc( ent, Hp )

local tab = {}
tab[ "$pp_colour_addr" ] = 5
tab[ "$pp_colour_addg" ] = 0
tab[ "$pp_colour_addb" ] = 0
tab[ "$pp_colour_brightness" ] = 0
tab[ "$pp_colour_contrast" ] = 1
tab[ "$pp_colour_colour" ] = 1
tab[ "$pp_colour_mulr" ] = Hp * 2
tab[ "$pp_colour_mulg" ] = 1
tab[ "$pp_colour_mulb" ] = 1

DrawColorModify( tab )
DrawMotionBlur( 0.5, 0.5, 0.1)
DrawBloom( 1, Hp/100, 3, 9, 9, 1, 255, 0, 0 )

end

hook.Add( "RenderScreenspaceEffects", "RenderEFunc", RenderEFunc )

I get the following error when my health reaches 41...

Code: [Select]
ERROR: Hook 'RenderEFunc' Failed: [lua\autorun\sh_damageeffect.lua:24] attempt to call method 'DrawColorModify' (a nil value)
Removing Hook 'RenderEFunc'

I have tried sending the entity over to my hook with no results. I have also tried separating it and putting the hook into the client folder but I got the same error...

Code: [Select]
ERROR: Hook 'RenderEFunc' Failed: [lua\autorun\client\cl_damageeffect.lua:14] attempt to call global 'DrawColorModify' (a nil value)
Removing Hook 'RenderEFunc'

Any ideas on how I can fix this?

Edit: I need help before my head explodes!!! Because I looked in the script of weather mod and it looks like he is doing that the same way I am...

Title: Re: Help build a game mode!
Post by: Aaron113 on August 09, 2011, 04:05:14 PM
I think your problem is you're running it shared.  Try making a client folder inside the autorun folder and place the file in there.  It's just a guess.
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 09, 2011, 06:39:13 PM
I think your problem is you're running it shared.  Try making a client folder inside the autorun folder and place the file in there.  It's just a guess.

I already tried that and still no luck.

I get the same error.
Title: Re: Help build a game mode!
Post by: Aaron113 on August 09, 2011, 09:43:08 PM
Ahhh, sorry.  Must've missed that in your post.  I've never messed with this stuff.  I'm clueless.
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 09, 2011, 10:02:59 PM
Ahhh, sorry.  Must've missed that in your post.  I've never messed with this stuff.  I'm clueless.

The funny thing is that I looked at weather mods lua and the example lua on the gmod wiki, and by what I see they are both doing it the same way I am, I must be missing some thing...

Edit: Megiddo seems to know what he is doing with hooks and such may be he can help me...

Edit: Seems like no one know what to do to fix that... :'(
Title: Re: Help build a game mode!
Post by: Stickly Man! on August 12, 2011, 05:07:15 PM
So your hooks should be set up properly, your main error is here:

Code: [Select]
[lua\autorun\client\cl_damageeffect.lua:24] attempt to call global 'DrawColorModify' (a nil value)
It's saying the global function DrawColorModify doesn't exist. This could either be caused by:
A) Your code isn't being executed on the client (which isn't the case if this error is appearing on your client console)
B) You're trying to call the DrawColorModify function before it is created (unlikely, seeing as how it looks like it requires player action to trigger the hook)
C) DrawColorModify doesn't exist. Looking at where the function is defined (http://luabin.foszor.com/code/lua/postprocess/color_modify.lua#22 (http://luabin.foszor.com/code/lua/postprocess/color_modify.lua#22)), it appears that it is part of a post-process effects file. Aren't those only loaded in the sandbox and sandbox-derived gamemodes? If possible, try running this section of code within the sandbox gamemode and see if it works.
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 12, 2011, 05:49:09 PM
The odd thing is that I am running it in sandbox and when I change the Post Processing effects manually they work without giving any errors.

This is my current script, another error also turned up...

Code: [Select]
function GAMEMODE:EntityTakeDamage( ent )
 
if ent:IsPlayer() then
Hp = ent:Health()

if(Hp <= 41) then
hook.Call( "RenderScreenspaceEffects", RenderEFunc, ent, Hp )
end
end
end

//Should I split the script here and put the above in Server and whats below in Client?

function RenderEFunc( ent, Hp )

local tab = {}
tab[ "$pp_colour_addr" ] = 5
tab[ "$pp_colour_addg" ] = 0
tab[ "$pp_colour_addb" ] = 0
tab[ "$pp_colour_brightness" ] = 0
tab[ "$pp_colour_contrast" ] = 1
tab[ "$pp_colour_colour" ] = 1
tab[ "$pp_colour_mulr" ] = Hp * 2
tab[ "$pp_colour_mulg" ] = 1
tab[ "$pp_colour_mulb" ] = 1

DrawColorModify( tab )

DrawMotionBlur( 0.5, 0.5, 0.1 )
DrawBloom( 1, Hp/100, 3, 9, 9, 1, 255, 0, 0 )

end

hook.Add( "RenderScreenspaceEffects", "RenderEFunc", RenderEFunc )

The errors I get are...

Code: [Select]
ERROR: Hook 'RenderEFunc' Failed: [lua\autorun\sh_damageeffect.lua:25] attempt to call global 'DrawColorModify' (a nil value)
Removing Hook 'RenderEFunc'
ERROR: GAMEMODE:'EntityTakeDamage' Failed: [addons\ulib\lua\ulib\shared\hook.lua:173] attempt to index local 'gm' (a function value)
ERROR: GAMEMODE:'EntityTakeDamage' Failed: [addons\ulib\lua\ulib\shared\hook.lua:173] attempt to index local 'gm' (a function value)

The sh_damageeffect.lua:25 error appears only once when my health reaches 41.

The hook.lua:173 error spams in console when ever I take damage and my health is below 41.

Edit: I have found an old post about the hook.lua:173 and a quote from Megiddo says...

Not a ULib problem. You would (or at least should, feel free to test) get a nearly exact error without ULib. Something is calling hook.Call incorrectly.

When did I start calling hook.Call incorrectly?
Title: Re: Help build a game mode!
Post by: Megiddo on August 12, 2011, 10:41:57 PM
You shouldn't be using hook.Call at all, so that's incorrect by itself. You don't need to call the hook, that's why it's a hook.
Title: Re: Help build a game mode!
Post by: LuaTenshi on August 25, 2011, 09:59:35 AM
I am currently busy with my server so this is going to be locked for a bit, if you wish to help or have some scripts ready please contact me.