Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Anselme on Sat 02/01/2021 15:22:38

Title: TCP-IP plugin in the global script
Post by: Anselme on Sat 02/01/2021 15:22:38
Hi everybody, I am new on the forum, however I learned AGS since 2 months, and I have already made some videos to show how to make a life bar, how to shoot at an enemy, and how to allow 3D isometric in AGS with artificial intelligence.
Shooting test with life bar: https://www.youtube.com/watch?v=kK-BI_QBynI&t=1s
AI with 3D isometric: https://www.youtube.com/watch?v=cwznx4pXowA&t=1s

So in fact my new game "Virus Monster Infection" will be ready in a few days, and it will not be a multiplayer game. Somehow, for other games, I have already the TCP-IP plugin, but I have an important question, I mean, even if it just allows to talk in a chat room between 2 persons in their respective home, that's already enough, it's better than nothing to be able to do that.
So my question is: Once we have put the TCP-IP plugin in the AGS main folder, what code do we have exactly to write in the global script, and in a room please, that would be super useful for me. I am planning to create RTS games with AGS.
Title: Re: TCP-IP plugin in the global script
Post by: eri0o on Sat 02/01/2021 22:13:49
I had no idea there was a tcp up plug-in, could you link to it?
Title: Re: TCP-IP plugin in the global script
Post by: Anselme on Sun 03/01/2021 11:18:29
Yes of course no problem, here is a link to a website with the TCP-IP plugin, and also a lot of other plugins allowing snow or fire and rain effects, or lightning effects too in AGS: https://americangirlscouts.org/agsresources/plugins.html

If you have the knowledge of how to code at least a chat room in AGS that would be super great.
Title: Re: TCP-IP plugin in the global script
Post by: Crimson Wizard on Sun 03/01/2021 17:40:23
Quote from: Anselme on Sun 03/01/2021 11:18:29
Yes of course no problem, here is a link to a website with the TCP-IP plugin, and also a lot of other plugins allowing snow or fire and rain effects, or lightning effects too in AGS: https://americangirlscouts.org/agsresources/plugins.html
That page contains very old plugins from ancient AGS times. For example, TCP/IP plugin files are of year 2003.

A newer alternative is called "AGS Sockets". There was a forum thread, but it's kind of outdated too (https://www.adventuregamestudio.co.uk/forums/index.php?topic=48937.0)
The most recent release can be found here: https://github.com/FTPlus/AGSsock/releases/tag/AAC-rc2

I believe this plugin was used in "AGS Awards" client.
Here's the AGS Awards project source, it may be used as a big example of how to write network client:
https://bitbucket.org/agsa/ags-awards-source/src/master/AGS%20Project/


EDIT: original Sockets plugin is WyZ, AGS Awards client is made by Snarky and Dualnames afaik, also eri0o particupated by making it cross-platform (if I am not mistaken), so hopefuly some of them will be able to give more instructions.

I had a simple game made with this plugin in the past, but seems like lost the sources...
Title: Re: TCP-IP plugin in the global script
Post by: Anselme on Sun 03/01/2021 18:49:00
Thanks so much for the sources I will study it little by little, because I am focusing on making my game, I also downloaded the 3D project from EriOo about 3D maths in AGS, for now what I know is that I have enough knowledge to create adventure games, RPGs and RTS with AGS, I will take my time to study the multiplayer option and eventually 3D maths, like rotating the camera when the player moves on the sides, that's feasable.
Thank you so much!
Title: Re: TCP-IP plugin in the global script
Post by: Crimson Wizard on Sun 03/01/2021 18:51:42
Quote from: Anselme on Sun 03/01/2021 18:49:00I also downloaded the 3D project from EriOo about 3D maths in AGS, for now what I know is that I have enough knowledge to create adventure games, RPGs and RTS with AGS, I will take my time to study the multiplayer option and eventually 3D maths, like rotating the camera when the player moves on the sides, that's feasable.

I think I should mention this, to be frank, AGS currently is not the best engine for genres like RTS where you have a lot of dynamically spawning and moving objects. It's technically possible, but will be much easier in other engines.
Same with 3D, you can code 3D drawing in AGS script, but it will work very slow, because it will not use your graphic card's 3D acceleration. Ideally someone should create a 3D plugin instead to draw textures with actual OpenGL/Direct3D.

Turn based multiplayer games may be pretty well done in AGS though.

Title: Re: TCP-IP plugin in the global script
Post by: Anselme on Sun 03/01/2021 19:14:15
Yeah I understand, but when I say RTS I mean that the number of units that you can create will be limited to, let's say, 90 units in one campaign game or a 1vs1, and you cannot create them again, and thus they will be strong units, and the map will be only 8 times taller and larger than the screen size, so it will not be so huge like in age of empires. I know that there are better engines than AGS but I am not so good at coding everything from A to Z, so I prefer the mixing simple softwares like AGS, combining graphic interface and code.
So I give now some tricks for the people who would like to make at least "simple" RTS games in AGS:

Open a "BASS" type project
create a character and give him a view of an invisible sprite.png
Control the camera with keyboards:
global script.asc

44.function repeatedly_execute()
45.{
46.Game.Camera.SetAt(cChar181.x, cChar181.y);
47.  if (IsKeyPressed(eKeyW))
48.{
49.  cChar181.Move(cChar181.x, cChar181.y -10, eBlock, eAnywhere);
50.}
51.
52.  if (IsKeyPressed(eKeyS))
53.{
54.  cChar181.Move(cChar181.x, cChar181.y +10, eBlock, eAnywhere);
55.}
56.
57.  if (IsKeyPressed(eKeyA))
58.{
59.  cChar181.Move(cChar181.x -10, cChar181.y, eBlock, eAnywhere);
60.}
61.
62.  if (IsKeyPressed(eKeyD))
63.{
64.  cChar181.Move(cChar181.x +10, cChar181.y, eBlock, eAnywhere);
65.}
66.}

And to select and deselect a character, function anyclick on character and then -> cChar12.SetAsPlayer();

And for the life of your city center just make a GUI bar like I did in the video with the life bar, dont forget in the properties of the button to put: clickable = false; clip image = true, in order that when the life bar goes down or up, it actualizes itself on the screen. Make a lifebar for your main city center and one another for the enemy's city center.
Create a an invisible lifebar for every unit, use left click to move, use right click to attack, or build buildings.
Set a timer in order that every 3 or 4 minuts an enemy unit appears in the enemy's camp and comes to attack you, and draw a large region around the enemy's camp, and then in the events, when "walks on region", then the enymy units follow your units (cEnemy1.FollowCharacter(player));
With these bases anybody who knows AGS well can make RTS games with AGS.