online team shooter "Survive!" full sourcecode release

Posted By: SchokoKeks

online team shooter "Survive!" full sourcecode release - 11/11/09 22:10

As I've frozen this project, I'm releasing the full source code of the last release, Version 0.57. Original thread.
The game is programmed in C-Script, but a nearly done lite-C conversion is also included. Maybe you can find the remaining bugs.

Please read the "GUIDE TO CODE.txt" file before asking questions here.
Most models are missing because I don't have the right to distribute them. Check the guide on options how to get around this.


Download

Survive! V0.57 sourcecode via rapidshare.com
alternative download mirror


Read GUIDE TO CODE (also included in the above ZIP file)

If you have questions, please ask them in this thread so others can find the answers, too.

- Schokokeks


Posted By: Cowabanga

Re: online team shooter "Survive!" full sourcecode release - 11/12/09 11:51

Nice, maybe I can try to translate it to Lite-C.
Posted By: SchokoKeks

Re: online team shooter "Survive!" full sourcecode release - 11/12/09 12:59

Quote:
Nice, maybe I can try to translate it to Lite-C.

You'd only have to debug the Lite-C conversion that it included in the package. The biggest bug i can remember right now is that the weapons that the player hold in their hands don't show up or don't move with them, although the code looks perfectly right. maybe there is a problem with the you pointer.
Posted By: ambe

Re: online team shooter "Survive!" full sourcecode release - 02/03/10 09:14

I didnt quite undrestand how you attached the guns to the players with out creating lagg. could you fill me inn ? ;P
Posted By: SchokoKeks

Re: online team shooter "Survive!" full sourcecode release - 02/03/10 13:40

sure:

it is important that the weapons are not "networked" entitys, that would be a total waste of bandwith.

on every client, create them with ent_createlocal(..) for every player.
I've used proc_local to start functions for every player entity, that is a very helpful function, look it up in the manual if you don't know it yet.

give them the following function: (through ent_createlocal of course)

Code:
function attached_wp_act()
{
	set (me, PASSABLE);
	set (me, UNTOUCHABLE);
	proc_mode = PROC_LATE;  // important part: keeps the gun from lagging one frame behind!!


	while (you)
	{
		if (you == NULL) {break;}

		vec_for_vertex(my.x, you, 5); // position at vertex 5 of player, change to fit your model!!
		vec_set (my.pan, you.pan); //  make it point into the same direction as the player


		wait(1);
	}
	ent_remove(me);
}



this is from the lite-c code, it might not work correctly, but it should tongue
Posted By: ambe

Re: online team shooter "Survive!" full sourcecode release - 02/03/10 13:47

But how would the other players see this gun if its created locally?

I'm having my first crack at mp programing and as it is now it all seems like magic to me..
Posted By: SchokoKeks

Re: online team shooter "Survive!" full sourcecode release - 02/03/10 14:19

thats what proc_local() does. use proc_local once in the main player function that runs on the server.

proc_local starts a function for the entity it is called for on ALL clients. In that function, every client creates it own instance of the weapon. they (hopefully) all look and behave the same, and the player won't notice they are not synchronized over the network.

have you done and understood the multiplayer workshop (25) ?
Posted By: ambe

Re: online team shooter "Survive!" full sourcecode release - 02/03/10 14:43

Edit- disregard that, all i really need to know is how did you make the different clients able to show different weapons?
Posted By: ambe

Re: online team shooter "Survive!" full sourcecode release - 02/04/10 17:57

Edit-- sorry double post
Posted By: SchokoKeks

Re: online team shooter "Survive!" full sourcecode release - 02/04/10 19:49

For that, you need to transfer a skill, that saves which weapon the player has.
0 = no weapon, 1 = pistol, 2 = shotgun and so on

Every time this weapons changes, send the skill with send_skill(..., SEND_ALL) from the SERVER to the clients. Its important that this is only done on the server.

in the weapon action I've posted above you can add code that changes the weapon with ent_morph depending on the values of that skill.
Posted By: ambe

Re: online team shooter "Survive!" full sourcecode release - 02/04/10 20:18

thanks man you've been a big help tongue played you're game for a while now too with some friends nice performance..;P
© 2024 lite-C Forums