Skip to content

Commit 3a99a29

Browse files
committed
adding original files
1 parent bff9be9 commit 3a99a29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+14905
-0
lines changed

arch.png

25.8 KB
Loading

client1.py

+523
Large diffs are not rendered by default.

cmdline_example.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from twisted.spread import pb
2+
from twisted.internet import reactor
3+
factory = pb.PBClientFactory()
4+
server = None
5+
def gotServer(serv):
6+
global server
7+
server = serv
8+
reactor.stop()
9+
10+
connection = reactor.connectTCP('localhost', 8000, factory)
11+
d = factory.getRootObject()
12+
d.addCallback(gotServer)
13+
#<Deferred at 0xac5680>
14+
reactor.run()
15+
print server
16+
#<twisted.spread.pb.RemoteReference instance at 0xb1f488>
17+

conch_snippet.txt

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
&gt;&gt;&gt; from twisted.spread import pb
2+
&gt;&gt;&gt; from twisted.internet import reactor
3+
&gt;&gt;&gt;
4+
&gt;&gt;&gt; factory = pb.PBClientFactory()
5+
&gt;&gt;&gt; server = None
6+
&gt;&gt;&gt;
7+
&gt;&gt;&gt; def gotServer(serv):
8+
... global server
9+
... server = serv
10+
...
11+
&gt;&gt;&gt; connection = reactor.connectTCP('localhost', 8000, factory)
12+
&gt;&gt;&gt; d = factory.getRootObject()
13+
&gt;&gt;&gt; d.addCallback(gotServer)
14+
&lt;Deferred at 0xc227a0 current result: None&gt;
15+
&gt;&gt;&gt; server.callRemote('GameStartRequest')
16+
&lt;Deferred #0&gt;
17+
Deferred #0 called back: 1
18+
&gt;&gt;&gt; up, right, down, left = 0,1,2,3
19+
&gt;&gt;&gt; server.callRemote('CharactorMoveRequest', up)
20+
&lt;Deferred #1&gt;
21+
Deferred #1 called back: 1
22+
&gt;&gt;&gt; server.callRemote('CharactorMoveRequest', right)
23+
&lt;Deferred #2&gt;
24+
Deferred #2 called back: 1
25+
&gt;&gt;&gt; server.callRemote('CharactorMoveRequest', down)
26+
&lt;Deferred #3&gt;
27+
Deferred #3 called back: 1
28+
&gt;&gt;&gt; server.callRemote('CharactorMoveRequest', left)
29+
&lt;Deferred #4&gt;
30+
Deferred #4 called back: 1

diagram-channel.png

2.68 KB
Loading

diagram-gui-cutscene.png

8.21 KB
Loading

diagram-gui-dialog.png

7.42 KB
Loading

diagram-gui-main.png

6 KB
Loading

diagram-gui-menu.png

4.75 KB
Loading

diagram-gui-options.png

3.74 KB
Loading

diagram-incoming.png

15 KB
Loading

diagram-outgoing.png

13.8 KB
Loading

diagram-serialization-flowchart.png

5.95 KB
Loading

diagram-visualstages.png

29.6 KB
Loading

events.py

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#SECURITY NOTE: anything in here can be created simply by sending the
2+
# class name over the network. This is a potential vulnerability
3+
# I wouldn't suggest letting any of these classes DO anything, especially
4+
# things like file system access, or allocating huge amounts of memory
5+
6+
class Event:
7+
"""this is a superclass for any events that might be generated by an
8+
object and sent to the EventManager"""
9+
def __init__(self):
10+
self.name = "Generic Event"
11+
12+
class TickEvent(Event):
13+
def __init__(self):
14+
self.name = "CPU Tick Event"
15+
16+
class QuitEvent(Event):
17+
def __init__(self):
18+
self.name = "Program Quit Event"
19+
20+
class MapBuiltEvent(Event):
21+
def __init__(self, map):
22+
self.name = "Map Finished Building Event"
23+
self.map = map
24+
25+
class GameStartRequest(Event):
26+
def __init__(self):
27+
self.name = "Game Start Request"
28+
29+
class GameStartedEvent(Event):
30+
def __init__(self, game):
31+
self.name = "Game Started Event"
32+
self.game = game
33+
34+
class CharactorMoveRequest(Event):
35+
def __init__(self, direction):
36+
self.name = "Charactor Move Request"
37+
self.direction = direction
38+
39+
class CharactorMoveEvent(Event):
40+
def __init__(self, charactor):
41+
self.name = "Charactor Move Event"
42+
self.charactor = charactor
43+
44+
class CharactorPlaceEvent(Event):
45+
"""this event occurs when a Charactor is *placed* in a sector,
46+
ie it doesn't move there from an adjacent sector."""
47+
def __init__(self, charactor):
48+
self.name = "Charactor Placement Event"
49+
self.charactor = charactor
50+
51+
class ServerConnectEvent(Event):
52+
def __init__(self, serverReference):
53+
self.name = "Network Server Connection Event"
54+
self.server = serverReference
55+
56+
class ClientConnectEvent(Event):
57+
"""this event is generated by the Server whenever a client connects
58+
to it"""
59+
def __init__(self, client):
60+
self.name = "Network Client Connection Event"
61+
self.client = client
62+
63+
64+
from twisted.spread import pb
65+
class CopyableTickEvent(TickEvent, pb.Copyable, pb.RemoteCopy):
66+
def __init__(self, obj ):
67+
pass
68+
69+
class CopyableQuitEvent(QuitEvent, pb.Copyable, pb.RemoteCopy):
70+
def __init__(self, obj ):
71+
pass
72+
73+
class CopyableMapBuiltEvent(MapBuiltEvent, pb.Copyable, pb.RemoteCopy):
74+
def __init__(self, obj ):
75+
pass
76+
77+
class CopyableGameStartRequest(GameStartRequest, pb.Copyable, pb.RemoteCopy):
78+
def __init__(self, obj ):
79+
pass
80+
81+
class CopyableGameStartedEvent(GameStartedEvent, pb.Copyable, pb.RemoteCopy):
82+
def __init__(self, obj ):
83+
self.game = id( obj.game )
84+
85+
class CopyableCharactorMoveRequest(CharactorMoveRequest, pb.Copyable, pb.RemoteCopy):
86+
def __init__(self, obj ):
87+
CharactorMoveRequest.__init__(self, obj.direction)
88+
89+
class CopyableCharactorMoveEvent(CharactorMoveEvent, pb.Copyable, pb.RemoteCopy):
90+
def __init__(self, obj ):
91+
CharactorMoveEvent.__init__(self, obj.charactor)
92+
93+
class CopyableCharactorPlaceEvent(CharactorPlaceEvent, pb.Copyable, pb.RemoteCopy):
94+
def __init__(self, obj ):
95+
self.charactor = id( obj.charactor )
96+
97+
class CopyableServerConnectEvent(ServerConnectEvent, pb.Copyable, pb.RemoteCopy):
98+
def __init__(self, obj ):
99+
ServerConnectEvent.__init__(self, obj.server)
100+
101+
class CopyableClientConnectEvent(ClientConnectEvent, pb.Copyable, pb.RemoteCopy):
102+
def __init__(self, obj ):
103+
ClientConnectEvent.__init__(self, obj.client)

0 commit comments

Comments
 (0)