Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 6 of 9 1 2 3 4 5 6 7 8 9
Re: Locoweed's Multiplayer Tutorial [Re: Locoweed] #29082
08/31/04 10:17
08/31/04 10:17
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline OP
Expert
Locoweed  Offline OP
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
I just upgraded to the 6.30 public beta (procrastination) and have found some problems. All are fixed but one. A serious one, waiting for answer to whether it is a bug or not. Once this last quirk is resolved I will go back and update everything to reflect the changes I made today. Some of these changes fix the problems that some of you were bringing to my attention earlier. I just didn't have the latest update, sorry. All should be running smooth after the transition is over.

I ran into another fine snag too, that took me quite a while to figure out. Since in the tutorial we were doing animation locally, the weapon would always move with the server's animation, which might slightly be off the client's local animation. So the weapon wouldn't always be exactly in hand on the clients. After some suffering, I finally got the code together where all the weapons are created locally too, so they attach to the local animation. Actually, another interesting addition to the tutorial I wasn't planning to actually do. I either made it work or scrapped the local animation example. It was a close call, I was having a heck of time figuring a simple effective way of doing it, and laziness due to insueing retirement plus A6.3 public beta stress, was causing me to day-dream about taking a nap and removing the local animation tommorrow. I totally tore up the code with 4 different ideas I had, all failed, before the moment of Insight . Then, it all came together using a interesting (brilliant, heh) technique. Whew!

Chapter 12 should be out a soon, after the new quirk is figured out.

Temporary solutions to make the existing tutorials files run with 2 PLAYERS ONLY over LAN with host computer with A6.30 public beta release:

1) in declarations under Variables add:
Code:
 

var dplay_smooth = 0; // no movement prediction



With the A6.3 public beta release, the program began to overshoot movement alot on clients even on LAN. I need to look into my code and see if that is where the problem is. It could also have something to do with the beta., but this will make it run better for now.

2) In main() function change this:
Code:
 

if(connection == 2) // client?
{
while (temp_player_number == 0) // wait for server to assign client temp player number
{
wait(1);
}
}



to

Code:

if(connection == 2) // client?
{
//TODO: Temporary!
temp_player_number = 2; // temporary fix to let us test with 2 players until send_var()
// problem resolved
while (temp_player_number == 0) // wait for server to assign client temp player number
{
wait(1);
}
}



The send_var() command doesn't seem to work from on_server = function;'s function in A6.30 beta.

3) In action move change this:

Code:

force_turn.pan = my.force_y * speed_sidewards_factor * TIME;;
force_turn.tilt = 0;
force_turn.roll = 0;
ROTATE(my,force_turn,NULLVECTOR); // rotate the player



To:

Code:

// get new pan
my.pan = my.force_y * speed_sidewards_factor * TIME + my.pan;



Rotate() is now truely an obsolete 3DGS command. Rotate() has retired, just like me very soon. So, I suppose, I will be Obsolete here soon too.

If the tutorial chapter you are on does not have a line that I said to change above, that's fine, just don't change it or add it since it doesn't exist. But for now, go ahead and add the var dplay_smooth = 0; even if it wasn't there.

Since I upgraded to the A6.30 public beta and had to get weapons attached to local animation, I figure I am at the same place in the tutorial progress as yesterday, plus I have an 'Enigma' problem to solve too. Not to mention, all the documentation changes and the previous chapter level updates and uploads yet to come. Not bad for a days work, lol. (I had 'this feeling" that updating was a bad idea, but I couldn't resist). Actually I had to do it, since this tutorial is for A6.3, but I still regret doing it today. It was a real downer, I went from happy to sad real fast.

Loco Person

Last edited by Locoweed; 08/31/04 13:24.

Professional A8.30
Spoils of War - East Coast Games
Re: Locoweed's Multiplayer Tutorial [Re: Locoweed] #29083
09/01/04 01:56
09/01/04 01:56
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline OP
Expert
Locoweed  Offline OP
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Sorry for all the post, but alot going on with getting things back to working order. The major problem I was encountering is now solved. So I will be updating all of the old chapter's and their sources today. I will let you know when they are all working with the A6.30 public beta.

EDIT;

Ok all chapters' source code updated and uploaded.

Here are the final changes I went back and changed in the old chapters' source code to get everything running with A6.30 public beta where applicable to that chapter (Chapter 5 and on I believe).

1) in declarations under Variables I added:
Code:
 

var dplay_smooth = 0; // no movement prediction



With the A6.3 public beta release, the program began to overshoot movement alot on clients even on LAN. I need to look into my code and see if that is where the problem is. It could also have something to do with the beta., but this will make it run better for now.

2) In main() function I changed this:
Code:
 

//--------------------------------------------------------------------
// MAIN
//--------------------------------------------------------------------
function main()
{
randomize(); // set random seed
level_load(world_str); // load level

// if not a single player game, wait for connection
ifdef server;
while(connection== 0) {wait(1);} // wait until level loaded and connection set
endif;
ifdef client;
while(connection== 0) {wait(1);} // wait until level loaded and connection set
endif;



to

Code:

//--------------------------------------------------------------------
// MAIN
//--------------------------------------------------------------------
function main()
{
randomize(); // set random seed


// if not a single player game, wait for connection
ifdef server;
while(connection== 0) {wait(1);} // wait until level loaded and connection set
endif;
ifdef client;
while(connection== 0) {wait(1);} // wait until level loaded and connection set
endif;

level_load(world_str); // load level, must be after connection is set



The level_load() command must now be used after connection is set or it is possible for send_var() not to work properly under certain conditions. Slacer actually figured this out. Thanks brother!

3) In action move I changed this:

Code:

force_turn.pan = my.force_y * speed_sidewards_factor * TIME;;
force_turn.tilt = 0;
force_turn.roll = 0;
ROTATE(my,force_turn,NULLVECTOR); // rotate the player



To:

Code:

// get new pan
my.pan = my.force_y * speed_sidewards_factor * TIME + my.pan;



Rotate() is now truely an obsolete 3DGS command.

You WILL find that major updates, such as A6.30 is going to be, especially a big multiplayer update, that you may have to go through growing pains like this. I doubt after A6.30 you will have to worry about this, atleast with multiplayer for a while, so the tutorial should run for quite some time and hopefully someone will update it if it goes obsolete. Everyone has permission to upgrade or change this code and make the improvements you made available to others.
END_EDIT;

Loco

Last edited by Locoweed; 09/01/04 07:39.

Professional A8.30
Spoils of War - East Coast Games
Re: Locoweed's Multiplayer Tutorial [Re: Locoweed] #29084
09/03/04 15:56
09/03/04 15:56
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline OP
Expert
Locoweed  Offline OP
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Sorry everyone,

I really tried to get this done before I had to quit, but my time is out. I have uploaded what may be the final source code. It is Chapter12, not really as complete as as wanted the chapter and the chapter is not documented. If I have time I will most certainly try to complete the tutorial, but I really don't see it happening in the near future.

Here's is what I got added into the Chapter 12 source.

1) Player's can now choose a profession by left-clicking on a profession panel. I didn't have time to get the code flawless, so the Host must select his profession before any clients join game.

2) Finally got local weapons code completed so that the correct weapon is attached to the local animation. Some very interesting code and much more difficult that I imagined it would be. The main snag I had was getting my.profession into the proc_local. I tried everything but couldn't get it to work. So, finally, I ended up making a seperate proc_local() for each profession and called the correct one from action move.

3) I added one ammo pack at game start (Ammunition Cartridge) and the code for it to be removed when touched by correct profession (Operations Officer). This should atleast give you the technique for picking up power-ups. I did not get to the ammunition remaining code, so you would need to add that where the ammo is removed in code.

Probably the last 2 screenshots:

A client joing a game looking down on game play before he selects a profession:


2 players looking at each other:


I also didn't get to fighting code and thus, I didn't get to code for instance, of what happens if Host dies? Does he get the Choose Profession panels again? I didn't actually get to test it with multiple connections. Not too worried about that. But, whether the code might fail if 2 clients join at almost the same time, worries me a bit. I never got to check that either. Also, never got to tweak it out for the internet after the A6.30 public beta. But, for the most part, the script should be fairly tight.

Another Note: I was just looking at animation, and one computer's animation was much faster than other. I forgot to add FPS_LOCK to the program, which I think is probably very important in a multiplayer game. Mention this incase I don't ever get this change in.

I hope what I got done helps someone. Please feel free to improve on the code and share it with community if you figure it out. I will try to get someone to take over the tutorial if anyone wants to. Not much left really. I was planning local effects and sounds. The techniques to make this happen could fairly easily be extracted from the code that exist. I was going to do attacks (bullets, etc) globally.

I should be able to get the documention updated to cover everything I hope. I haven't got to change the documentation for what is mentioned in above post or Chapter 12 at this time.

The Chapter 12 source can be found at my 3DGS link below under Multiplayer.

Best Wishes,
Happy Programming,
God Bless,
Sincerely,
Frederick "Locoweed" Sims

"Was this a TUSC thread?" Heh.


Professional A8.30
Spoils of War - East Coast Games
Re: Locoweed's Multiplayer Tutorial [Re: Locoweed] #29085
09/04/04 04:14
09/04/04 04:14
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
A herculean effort and one you should be immensly proud of!
Truly, this is the BEST 3DGS tutorial to date...Period....better than the manual (duh ) and infinitly better than Alains.


As a conclusion to your project, what, in your opinion, is left to do? You stated that there was alot you didn't get to do, but I would like to know what direction you could see for chapter 12, 13, 14, etc. Give us a list so that someone can take up the torch you have single handedly borne these last few months.


Also, do us a favor....Don't submit to the contest....otherwise, there really is no point in anyone else submitting!!!! (<---joke....you DESERVE the $450 and then some)

Re: Locoweed's Multiplayer Tutorial [Re: fastlane69] #29086
09/04/04 09:53
09/04/04 09:53
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
I agree, this is a really good tutorial! I cant even begin to explain how valuable this tutorial is to me! Thanks, and I hope everything works out great for you.


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: Locoweed's Multiplayer Tutorial [Re: William] #29087
09/04/04 14:44
09/04/04 14:44
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline OP
Expert
Locoweed  Offline OP
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Thanks.

@ fastlane69,

Very good question indeed!

Chapter 12: Attaching and Picking Up Items
Some problems that were created by this chapter that need fixed:

1) The profession selection code after game start has create 2 problems that I didn't have time to work on that need to be fixed. (Or I think so).

A) The Host shouldn't have to select his profession before others can join and choose theirs. This may not be so simple. It has to do with how I wrote the code with host is always player_number 1. This needs to be fixed. so the host doesn't necessary have to choose profession before any clients do.

B) A related problem, that I believe will happen and is not serious for this tutorial, but would possibly be for a real game. If a client joins and does not select profession, and another clients joins game after him but selects profession before him, the player's entity.player_number will not equal his player_number(a variable) that is being displayed on the screen. The entity.player_number will be set to the in the order of entity creation, while the player's variable player_number is set by the order in which he joined game. So basically, until fixed, an entity that was created out of order of the join sequence, could not tell if this player owned him by
if(my.player_number == player_number) // Does this player own me?
(Maybe get rid of variable player_number and just use player.player_number for everything?)

I wrote the start-up code in a certain way after some of the earlier server test. I did not want to actually assign a player_number until after a a player actually created an entity because, what would happen was, If a player quit before his entity was created, I was using in player action:

Code:

my.ENABLE_DISCONNECT = ON; // player can disconnect from session



and in player event:

function player_events()
{
// client disconnected
if (EVENT_TYPE == EVENT_DISCONNECT)
{
number_of_players -= 1; // decrement number of players
player_number_quit = my.player_number; // set player quit to me since I quit
// Go through all entities, any player# that was above mine, decrement his player number
you = ent_next(NULL);
while(you != NULL)
{
if(you.player_number > player_number_quit)
{
you.player_number -= 1;
send_skill(you.player_number, SEND_ALL); // send new player#
}
you =ent_next(you);
}
send_var(player_number_quit); // let everyone know player that quit
send_var(number_of_players); // let everyone know new number of players
ent_remove(me); // remove ent of player that quit
}
}

So if the player didn't actually have and entity and got disconnected, the whole player number system would get off. So basically, the player_number code needs revamped now, possibly using

Code:
 if (event_type == event_leave)




in server_called instead of event_disconnect in player_events? So the connection code and player_number code needs revised. This may or May Not be a simple task. I have alot of variables being passed in different locations setting up player number data. But hey, it's atleast well docemented what I was doing before Chapter 12 changes.

2) Need to add all the ammo packs for each profession (NPC's too) and randomly create them and place them into level. When picked up need to add to my.ammunition_remaining for that player and display it. I was thinking random(10) rounds of ammo per pack.

3) Need to create Lunar Candy power-ups, which heals all professions and needs randomly created and placed in level. When picked I was thinking of adding 10%-15% of max_health to player or NPC.

Chapter 13 : Using Items and Attacking.

1) Need to create profession(weapon actually) specific attack code. Bullets, radition beams, etc themselves would be global. Their effects and sounds would be local. Decreasing ammunition_remaining upon attack and doing correct damage. Key input for attacking. Weapon range as per game description.

2) Local animation code for attacks would need to be added to animate() function.

3) Death code, go back to choose profession panels I suppose.

4) Lunar Pychosis Rating (score) code need to be written and displayed.


Chapter 14 : Managing the Amount of data sent.

Alot of this covered in earlier chapters. Any other techniques for lessening network traffic should be here with an example of it used in game. Maybe some new A6.30 commands like SEND_UNRELIABLE mode if possible, although most of what I have written needs to be reliable.

Chapter 15 : NPC's and Multiplayer AI.

Simple example of AI for the 2 bot types. Entity_scan() or whatever with cave_man pathfinding or however detailed one wants to get. If attacked, will probably attack that player back. May attack player randomly if he is within a certain range. Goes and picks up his ammo packs if within a certain range and ammunition not full. May run if hurt bad.

Chapter 16 : Putting the Pieces Together to Make The Game .

Finishing touches to make the BioSphereIV: Lunar Mania game decription an actual working multiplayer game. Maybe add names above player's entities, possibly a health bar too. Some way to tell players's scores. Make sure when a player first joins, he has a few seconds or so (grace period) before anyone can hit him, so he doesn't die each time during connection. Possible better models that more reflect game description if they are accessable. Players and bots should start with some ammo. Bot's should randomly be re-created after death in a random amount of time. Max number of bot's, ammo_packs, and lunar_candy in level at one time should be set. Stamina or endurance code. When running or attacking it goes down. If stamina is 100%, gradually add health (resting).

Documentation would have to be rechecked, making sure any changes made are added to it.

1) I already have made some slight changes to get the code working with A6.30 public beta I don't think I have changed yet in documentation and any changes in connection/player_number assignment code would require changing the chapter that covers that.

2) Also, internet testing and whatever needed changes to improve code for internet play would probably be a good idea.


That's about it! Hey, you asked! Then truly, it would be the Ultimate 3DGS Tutorial ever hands down!

If anyone does complete it, you can change the name from Locoweed's Multiplayer Tutorial, to whatever, just listing under title or in contributions all who contributed.

If you are interested, I have the document in Word that I can get you, also, I have alot of Chapter 12 documention done up to where I had to do the major restructuring of code to get weapons to attach to local animation instead of to the server's animation.

Let me know,
I will help as much as I can,
Especially, getting started,
Loco


Professional A8.30
Spoils of War - East Coast Games
Re: Locoweed's Multiplayer Tutorial [Re: Locoweed] #29088
09/05/04 14:45
09/05/04 14:45
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline OP
Expert
Locoweed  Offline OP
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Hi,

Luckily, I got all current problems fixed and finished the all code for the first 12 Chapters! So, all the connection and player_number code is working correctly now. Clients can choose profession before host. Ammo_packs and lunar candy (+health) code finished. A player can pick up a max of 50 rounds of ammunition and lunar candy only while his health is less than his max_health. Since, the attack code isn't finished, you won't be able to pick up the lunar candy because the player's health starts at max. But the code for adding health and removing candy is there. All the power-up models were obviously done in a matter of minutes, heh.

So, luckily for anyone who wants to finish or add to code, you only have to worry about adding Chapters 13 - 16.

I haven't and may not have time to redo documentation for the changes. Hopefully I will, but if not, I would guess someone could update the documentation. If I don't post new documentation in the next couple of days, that means I probably won't get it done.

@ fastlane69,
I didn't want to leave you a mess incase you wanted to work on it. The code for the first 12 Chapters is squared away now.

Last Screenshot by me:


Last Update by me, Chapter 12. I have made a .exe file available for those wanting to check it out.

Enjoy,
Locoweed


Professional A8.30
Spoils of War - East Coast Games
Re: Locoweed's Multiplayer Tutorial [Re: Locoweed] #29089
09/08/04 00:38
09/08/04 00:38
Joined: Apr 2002
Posts: 33
usa
lazarus01 Offline
Newbie
lazarus01  Offline
Newbie

Joined: Apr 2002
Posts: 33
usa
THANK YOU, THANK YOU, THANK YOU! dont feel bad about not completeing the full tutorial, what youve done already is extremely comprehensive and detailed and i have learned much from it. imho opinion conitec should hire you to be a full time tutorial writer for them! this tutorial is a major contribution to the 3dgs community and you deserve much credit for it. your tut is extremely relevent to my 3dgs work and to what many people are trying to do with 3dgs. a masterpiece indeed. thanks,

LAZ

Re: Locoweed's Multiplayer Tutorial [Re: lazarus01] #29090
09/08/04 10:54
09/08/04 10:54
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline OP
Expert
Locoweed  Offline OP
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Well, more good news!

I can't stand leaving it incomplete, so I am going to finish it, code and documentation. I am not going to do the NPC AI chapter (you'll have to figure that one out on your own), but the rest I am going to finish. It will cause me a few nights with 2 hours of sleep or so during the busiest time of the year (like last night, 2 hours of sleep, yawn). I am such a fool for doing it, but I will feel better.

So no worries, the masterpiece will be complete. I was feeling real bad about those who would want to do the tutorial, only to find it disorganized and incomplete, so I power coded all night last night and I should have the code uploaded tonight if all goes well. The code is very, very, very close too done. The updated documentation should follow soon.

Loco

Last edited by Locoweed; 09/08/04 11:07.

Professional A8.30
Spoils of War - East Coast Games
Re: Locoweed's Multiplayer Tutorial [Re: Locoweed] #29091
09/08/04 11:20
09/08/04 11:20
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Continually proving "you da' man".

From all of us to all of you....Thanks.

Page 6 of 9 1 2 3 4 5 6 7 8 9

Moderated by  HeelX, Tobias_Runde 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1