(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Hosted Projects > Reinventing the Craft > Miscellaneous

Miscellaneous A forum for a variety of functions where users may also request other features.

Reply
 
LinkBack Thread Tools Display Modes
Old 07-09-2007, 09:56 PM   #1 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

WarSocAPI

//============================================================================
// WarSocAPI - v2.00
native SocStart takes nothing returns boolean
native SocExit takes nothing returns boolean
native SocTCPConnect takes string ip, integer port, integer mode returns integer
native SocTCPListen takes integer port, integer maxqueue, integer mode returns integer
native SocTCPAccept takes integer socket, integer mode returns integer
native SocTCPIP takes integer socket returns string
native SocSetNagle takes integer socket, boolean on returns integer
native SocTCPConnected takes integer socket returns boolean
native SocUDPConnect takes integer port, integer mode returns integer
native SocSendUDPMessage takes integer udpsocket, string ip, integer port, integer buffer returns integer
native SocSendTCPMessage takes integer tcpsocket, integer buffer returns integer
native SocReceiveMessage takes integer socket, integer length, integer buffer returns integer
native SocPeekMessage takes integer socket, integer length, integer buffer returns integer
native SocGetLastInIP takes nothing returns string
native SocGetLastInPort takes nothing returns integer
native SocSetSync takes integer socket, integer mode returns integer
native SocCloseSocket takes integer socket returns boolean
native SocGetSocketLastError takes integer socket returns integer
native SocGetMyHost takes nothing returns string
native SocCompareIp takes string ip, string mask returns boolean
native SocBufferWriteByte takes integer val, integer buffer returns integer
native SocBufferWriteShort takes integer val, integer buffer returns integer
native SocBufferWriteUShort takes integer val, integer buffer returns integer
native SocBufferWriteInt takes integer val, integer buffer returns integer
native SocBufferWriteUInt takes integer val, integer buffer returns integer
//native SocBufferWriteFloat takes real val, integer buffer returns integer
native SocBufferReadByte takes integer buffer returns integer
native SocBufferReadShort takes integer buffer returns integer
native SocBufferReadUShort takes integer buffer returns integer
native SocBufferReadInt takes integer buffer returns integer
native SocBufferReadUInt takes integer buffer returns integer
//native SocBufferReadFloat takes integer buffer returns real
native SocBufferWriteString takes string str, integer buffer returns integer
native SocBufferReadString takes integer buffer returns string
native SocBufferClear takes integer buffer returns boolean
native SocBufferSize takes integer buffer returns integer
native SocBufferCreate takes nothing returns integer
native SocBufferDestroy takes integer buffer returns integer
native SocBufferCopy takes integer bufferdestination, integer buffersource returns integer
native SocMacAddress takes nothing returns string
native MD5 takes string s returns string
native SocBufferMD5 takes integer buffer returns string
native SocBufferExists takes integer buffer returns boolean
native SocNetConnected takes nothing returns boolean

native SocBufferWriteOrderID takes integer val, integer buffer returns integer
native SocBufferReadOrderID takes integer buffer returns integer

Tutorial: N/A
Download: N/A
Native Set Type: Single Player
Release: 0.10
Other: N/A
__________________
"Wulfy loves Nex!"

Last edited by MindWorX; 11-24-2007 at 07:01 PM.. Reason: Update 0.10
MindWorX is offline   Reply With Quote
Old 11-24-2007, 07:02 PM   #2 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

Bump, Update, Complete Revamp. No backwards compatability
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 11-24-2007, 08:15 PM   #3 (permalink)
Model & Tutorial Moderator
 
Pyritie's Avatar

 
Join Date: Nov 2006
Posts: 7,328

Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)

Super Donor: This user has donated at least $100 to The Hive. Hero Contest #1 Winner: Slatie 

What do these do?
Pyritie is offline   Reply With Quote
Old 11-24-2007, 08:23 PM   #4 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

WarSocAPI is a very advanced API, that requires netcoding knowledge to use... It's added for people who want to experiment. I'm adding a demo map at some point, to show some basic usages.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 11-24-2007, 08:40 PM   #5 (permalink)
Model & Tutorial Moderator
 
Pyritie's Avatar

 
Join Date: Nov 2006
Posts: 7,328

Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)

Super Donor: This user has donated at least $100 to The Hive. Hero Contest #1 Winner: Slatie 

Oh so is this more for multiplayer maps?
Pyritie is offline   Reply With Quote
Old 11-24-2007, 08:50 PM   #6 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

Nope, actually it's for singleplayer only. But, it can be use to make singleplayer maps, into multiplayer maps. If that makes any sense.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 11-24-2007, 09:05 PM   #7 (permalink)
Model & Tutorial Moderator
 
Pyritie's Avatar

 
Join Date: Nov 2006
Posts: 7,328

Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)

Super Donor: This user has donated at least $100 to The Hive. Hero Contest #1 Winner: Slatie 

So it's like two players are playing the same map via single player, but using this API the mapmaker could make it so that what one player does in the game influences the other?
Pyritie is offline   Reply With Quote
Old 11-24-2007, 09:16 PM   #8 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

Exactly. I've actually made maps that allowed chatting with all others on a private server, might upload the script for it.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 01-19-2008, 12:33 AM   #9 (permalink)
 
Toadcop's Avatar

BuranX
 
Join Date: Jun 2005
Posts: 69

Toadcop has little to show at this moment (10)Toadcop has little to show at this moment (10)


hmmmm.... it's very interesting... ^^
it's stable ? have you tested it etc. cause i have LAN at so i could make some test (if needed) + i am self interested in such things...

gj i will test it ! =)
// well cool stuff what you have here =) +1
__________________
"Mein Herz Brennt!" fur TcX
Current favorite tune: Re:Locate - Rogue
Toadcop is offline   Reply With Quote
Old 01-19-2008, 09:34 AM   #10 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

It has been tested a lot, and so far there has been no problems. Only thing worth mentioning is that SocSendTCPMessage has shown some speed issues, but I'm working on a way around that so it wont be sending a lot of messages, but rather one big one with all the data, which should actually end up saving a few bytes of data in the long run. The only problem with doing that is that the engine will be more vulnerable to packet losses since instead of only a little data lost, it might be a lot of data.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 01-21-2008, 06:52 PM   #11 (permalink)
 
wd40bomber7's Avatar

Starcraft2 Fan
 
Join Date: Aug 2006
Posts: 960

wd40bomber7 is on a distinguished road (70)wd40bomber7 is on a distinguished road (70)


Looks like Winsoc on crack.
Could you explain the usage of the following:
native SocTCPIP takes integer socket //Sets ip? For what?
native SocSetNagle takes integer socket, boolean on //?!
native SocPeekMessage takes integer socket, integer length, integer buffer //Looks at message without clearing from buffer?
native SocBufferReadByte takes integer buffer //What does this do compared to SocReceiveMessage
native SocBufferWriteOrderID takes integer val, integer buffer returns integer //The order of what?
native SocBufferReadOrderID takes integer buffer //?
native MD5 takes string s returns string //? Isn't MD5 an encryption?
native SocBufferMD5 takes integer buffer //?
native SocBufferWriteByte takes integer val, integer buffer //What does this do compared to SocSendTCPMessage
native SocCompareIp takes string ip, string mask //Compare to what?
native SocBufferDestroy takes integer buffer //Whats the point of creating/destroying your buffer? Shouldn't it always exist?
I'm thinking about using this to create multiplayer for my FPS. This is because all camera movements use GetLocalPlayer or they are global. This causes a high chance of d/c. Also it could never really work on bnet because people would need to use RTC just to run it.

This doesn't seem to support more then one connection. If this pans out I'll go build a server in VB. (I know how to use winsock, at least in VB)
__________________
I can help you.......... Maybe......
Give Rep to those that help you!

I'm back! My computers been finished.
wd40bomber7 is offline   Reply With Quote
Old 01-21-2008, 09:25 PM   #12 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

Quote:
Originally Posted by wd40bomber7 View Post
Looks like Winsoc on crack.
Could you explain the usage of the following:
native SocTCPIP takes integer socket //Sets ip? For what?
native SocSetNagle takes integer socket, boolean on //?!
native SocPeekMessage takes integer socket, integer length, integer buffer //Looks at message without clearing from buffer?
native SocBufferReadByte takes integer buffer //What does this do compared to SocReceiveMessage
native SocBufferWriteOrderID takes integer val, integer buffer returns integer //The order of what?
native SocBufferReadOrderID takes integer buffer //?
native MD5 takes string s returns string //? Isn't MD5 an encryption?
native SocBufferMD5 takes integer buffer //?
native SocBufferWriteByte takes integer val, integer buffer //What does this do compared to SocSendTCPMessage
native SocCompareIp takes string ip, string mask //Compare to what?
native SocBufferDestroy takes integer buffer //Whats the point of creating/destroying your buffer? Shouldn't it always exist?
I'm thinking about using this to create multiplayer for my FPS. This is because all camera movements use GetLocalPlayer or they are global. This causes a high chance of d/c. Also it could never really work on bnet because people would need to use RTC just to run it.

This doesn't seem to support more then one connection. If this pans out I'll go build a server in VB. (I know how to use winsock, at least in VB)
native SocTCPIP takes integer socket //Sets ip? For what?Doesn't set the IP, it gets the IP of a socket.

native SocSetNagle takes integer socket, boolean on //?!Turns on/off the naggle (TCP_NODELAY) algorithm. I don't remember exactly what it's for, i never use it.
http://en.wikipedia.org/wiki/Nagle's_algorithm

native SocPeekMessage takes integer socket, integer length, integer buffer //Looks at message without clearing from buffer?Exactly

native SocBufferReadByte takes integer buffer //What does this do compared to SocReceiveMessageThis reads a byte from a Buffer, SocReceiveMessage is used to receive a buffer to read from.

native SocBufferWriteOrderID takes integer val, integer buffer returns integer //The order of what?native SocBufferReadOrderID takes integer buffer //?OrderID is a units order ID, used to save bytes on buffers because it converts a range of common orders into two bytes rather than four.

native MD5 takes string s returns string //? Isn't MD5 an encryption?Yes, it's part of the WarSocAPI by coincidence and used by the native below
native SocBufferMD5 takes integer buffer //?Used to create an MD5 hash of a buffers contents, useful for checking if a buffer has be changed in any way.

native SocBufferWriteByte takes integer val, integer buffer //What does this do compared to SocSendTCPMessageRead the part about SocBufferReadByte

native SocCompareIp takes string ip, string mask //Compare to what?Compares and IP to a mask, for example:
82.192.160.50 compared to 82.192.*.* would be true
while
82.192.160.50 compared to 82.193.*.* would be false

native SocBufferDestroy takes integer buffer //Whats the point of creating/destroying your buffer? Shouldn't it always exist?Buffers is what is sent through the sockets, they're the key to data transfer. I most cases one buffer would be enough, but sometimes you need more. In my WIP demo, i have a buffer for receiving and sending, so i'm sure they'll never have a collision and write to the same buffer.
Quote:
This doesn't seem to support more then one connection. If this pans out I'll go build a server in VB. (I know how to use winsock, at least in VB)
Sockets is the way you have multiple connections. Sockets can be compared to pipes, they're what connect you to the other end. You can have as many pipes as you want, to wherever you want.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 04-05-2008, 11:47 PM   #13 (permalink)

User
 
Join Date: Jan 2006
Posts: 6

pro)opt-Tim is an unknown quantity at this point (0)


Hi there. You did a very good job. That was what i searching for last 3-4years. Im planning to create a MMORPG based on War3, where player could switch locations etc etc, unlimited players. Well, i have a questions of using Buffersocket.

Well, i tried this:
Code:
native SocBufferReadString 	takes integer buffer							returns string
and made some ingame outputs, that happens every 1 sec:

Code:
    call DisplayTextToForce(GetPlayersAll(),"0:"+I2S(SocReceiveMessage(udg_ConnectedSocket,500,udg_Buffer)))
    call DisplayTextToForce(GetPlayersAll(),"1:"+(SocBufferReadString(udg_Buffer) ))
    call DisplayTextToForce(GetPlayersAll(),"2:"+I2S(SocBufferSize(udg_Buffer)) )
    call DisplayTextToForce(GetPlayersAll(),"3:"+I2S(SocBufferReadShort(udg_Buffer)) )
    call DisplayTextToForce(GetPlayersAll(),"4:"+I2S(SocBufferReadUShort(udg_Buffer)) )
    call DisplayTextToForce(GetPlayersAll(),"5:"+I2S(SocBufferReadInt(udg_Buffer)) )
    call DisplayTextToForce(GetPlayersAll(),"6:"+I2S(SocBufferReadUInt(udg_Buffer)) )
    call DisplayTextToForce(GetPlayersAll(),"7:"+I2S(SocBufferReadByte(udg_Buffer)) )
And the second one(ReadString) doesnt works, and always is blank, also when im sending message from another socked... Can you give some advantage to me please?
Well, it will be good, if you make a some descriptions to several functions, b/c im not using c++ or vb, so its some problematic for me to understand all functions. You said that you made a map with working chat, but unfortunately i have not founded it :(.
__________________
pro)opt Rules?
pro)opt-Tim is offline   Reply With Quote
Old 04-06-2008, 12:25 AM   #14 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

Due to lack of any real tutorial yet, since i'm still working on it, i have a map here, that uses the functions, and works to have one player connect to another. I hope it suffices for your needs sofar. I'm sorry i can't be of much more help, but explaining how WarSoc works, would be like writing the whole tutorial in one post.

One advice tho.
SocReceiveMessage(udg_ConnectedSocket,500,udg_Buffer)instead use this
SocReceiveMessage(udg_ConnectedSocket,0,udg_Buffer)which receives everything instead of just 500 bytes.

Also, SocReceiveMessage returns a number larger than 0 if it actually received something, so usage like this is optimal
if(SocReceiveMessage(udg_ConnectedSocket,0,udg_Buffer) > 0) then
    //do stuff
endif
Attached Files
File Type: w3x WarSoc Proff of Concept Space Map.w3x (577.1 KB, 56 views)
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 04-06-2008, 12:11 PM   #15 (permalink)

User
 
Join Date: Jan 2006
Posts: 6

pro)opt-Tim is an unknown quantity at this point (0)


Thank you for your fast reply :)! It's very useful information.
__________________
pro)opt Rules?
pro)opt-Tim is offline   Reply With Quote