UDP protocols are a good way to go here. I agree with Herbert.
However, you have design work to do beyond just "how will this multiplayer node talk and listen". There's considerable design work involved in "what" these nodes need to be saying. An agreement on how timing and network delays or drops, especially with UDP Sockets, are handled would be part of your networked game design.
There are design notes available on the World Wide Web about multiplayer UDP networked game designs that are pretty good reading. These folks aren't likely going to be talking about Smalltalk, but the concepts and general lessons learned are good.
- Steve
On Jun 5, 2009, at 5:05 AM, Herbert König <herbertkoenig(a)gmx.net> wrote:
Hi Martin,
MB> I am still looking for a way to program my network game (four
MB> players on four different computers collaboratively control the
MB> direction of one object, each is responsible to move the object in
MB> one of four directions.)
you may try simple Socket connections via UDP. ByteArrays make nice
Buffers as ByteArray has methods to stuff in Floats, Integers and
Strings.
The class to look at is Socket.
On the class side newUDP will create a new UD socket, which you assign
a port via setPort:
Receiving and sending is done via receiveUDPDataInto: and
sendUDPData:toHost:port:
You query the receiving socket with dataAvailable before actually
receiving data.
If you search the swiki or the mailing list archives for these method
names you will find examples.
Cheers,
Herbert
_______________________________________________
Beginners mailing list
Beginners(a)lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Please help me.
I am trying to switch from VisualWorks to Squeak but I can't connect to any
my DB2 and Oracle databases.
I am using this files:
ftp://ftp.squeak.org/3.10/win/SqueakVM-Win32-3.10.6-bin.zipftp://ftp.squeak.org/3.10/Squeak3.10.2-7179-basic.ziphttp://ftp.squeak.org/3.0/platform-independent/SqueakV3.sources.gzhttp://map.squeak.org/accountbyid/cf58c358-46ee-465e-b6db-2740e9b32a53/file…
At first I tried old ODBC code from
http://wiki.squeak.org/squeak/uploads/2480/ODBC-dgd.10.cs.gz
and got "Could not coerce arguments" at my win32 (XP and Windows 2003
Server) computers. I can't understand this because all seems right.
At SqueakDebug.log we can see
------------------------------------
Error: Could not coerce arguments
28 May 2009 4:18:23 pm
VM: Win32 - a SmalltalkImage
Image: Squeak3.10.2 [latest update: #7179]
SecurityManager state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir C:\squeak\1
Trusted Dir C:\squeak\1\vvm
Untrusted Dir C:\My Squeak\vvm
ODBCLibrary(Object)>>error:
Receiver: an ODBCLibrary
Arguments and temporary variables:
aString: 'Could not coerce arguments'
Receiver's instance variables:
handle: @ 16r4BF70000
name: 'odbc32'
ODBCLibrary(Object)>>externalCallFailed
Receiver: an ODBCLibrary
Arguments and temporary variables:
errCode: 6
Receiver's instance variables:
handle: @ 16r4BF70000
name: 'odbc32'
ODBCLibrary>>sqlBindCol:columnNumber:targetType:targetValue:bufferLength:strLength:
Receiver: an ODBCLibrary
Arguments and temporary variables:
statementHandle: a SQLHSTMT
columnNumber: 1
targetType: 1
targetValue: an ExternalData
bufferLength: 8192
strLenght: a SQLInteger
Receiver's instance variables:
handle: @ 16r4BF70000
name: 'odbc32'
ODBCColumn>>bindBuffer
Receiver: an ODBCColumn DUMMY (VarChar 1 nullable)
Arguments and temporary variables:
------------------------------------
where
sqlBindCol: statementHandle columnNumber: columnNumber targetType:
targetType targetValue: targetValue bufferLength: bufferLength strLength:
strLenght
"SQLRETURN
SQLGetData(
SQLHSTMT StatementHandle,
SQLUSMALLINT ColumnNumber,
SQLSMALLINT TargetType,
SQLPOINTER TargetValue,
SQLINTEGER BufferLength,
SQLINTEGER *StrLen_or_Ind);"
<cdecl: short 'SQLBindCol' (SQLHSTMT ulong short void* long SQLInteger*)>
^ self externalCallFailed
I think all types are correct.
Also at Windows 2003 x64 I receive "Error:[Microsoft][ODBC Driver Manager]
Data source name not found and no default driver specified [State:IM002]"
for any datasource.
After that I am trying ODBC code from
http://www.squeaksource.com/ODBC/ODBC-rjl.10.mcz
| con rs |
con _ ODBCConnection dsn:'somedsn' user:'somename' password:'somepwd'.
rs := con resultSetFor: 'SELECT ''xxx'' manana FROM dual'.
(con query: 'SELECT ''xxx'' manana FROM dual') results do:[:row | Transcript
show: row; cr].
con close.
squeak image crashes somewhere near calling of "con resultSetFor:". No
SqueakDebug.log generated in this case. Crash.dmp contains:
------------------------------------
---------------------------------------------------------------------
Mon Jun 01 10:37:54 2009
Exception code: C0000005
Exception addr: 0040BD85
Access violation (read access) at 91233BDA
EAX:91233BDA EBX:96A4E35C ECX:00000003 EDX:96A4E35F
ESI:11233B78 EDI:91233BDB EBP:0000138C ESP:0006F998
EIP:0040BD85 EFL:00010286
FP Control: FFFF027F
FP Status: FFFF5061
FP Tag: FFFFFFFF
Hardware information:
Manufacturer: Unknown
Model: Unknown
Number of processors: 1
Page size: 4096
Memory Information (upon launch):
Physical Memory Size: 2097151 kbytes
Physical Memory Free: 1681472 kbytes
Page File Size: 4194303 kbytes
Page File Free: 4194303 kbytes
Virtual Memory Size: 2097151 kbytes
Virtual Memory Free: 2064020 kbytes
Memory Load: 40 percent
Processor 0: AMD Athlon(tm) 64 Processor 3400+
Identifier: x86 Family 15 Model 12 Stepping 0
~MHZ: 2411
Operating System: Microsoft Windows Server 2003 (Build 3790 Service Pack 1)
Registered Owner: unnamed user
Registered Company: unknown organization
SP major version: 1
SP minor version: 0
Suite mask: 110
Product type: 3
Display Information:
Graphics adapter name: NVIDIA GeForce4 Ti 4200
Primary monitor resolution: 1024 x 768
Device: NVIDIA GeForce4 Ti 4200
Adapter String: GeForce4 Ti 4200
Bios String: Version 4.25.00.29.00
Chip Type: GeForce4 Ti 4200
DAC Type: Integrated RAMDAC
Memory Size: 0x04000000
Driver Versions:
nv4_disp: 6.14.10.9371
VM Version: Squeak 3.10.6 (release) from Aug 30 2007
Compiler: gcc 2.95.2 19991024 (release)
Current byte code: 200
Primitive index: 264
Loaded plugins:
odbc32
SqueakFFIPrims 1 February 2007 (e)
LargeIntegers v1.5 1 February 2007 (i)
Matrix2x3Plugin 1 February 2007 (i)
FloatArrayPlugin 1 February 2007 (i)
BitBltPlugin 1 February 2007 (i)
B2DPlugin 1 February 2007 (i)
SecurityPlugin 1 February 2007 (i)
FilePlugin 1 February 2007 (i)
MiscPrimitivePlugin 1 February 2007 (i)
Stack dump:
------------------------------------
(Sorry for my English)
Victor