-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPseudo Code.txt
More file actions
78 lines (65 loc) · 1.63 KB
/
Copy pathPseudo Code.txt
File metadata and controls
78 lines (65 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Server Pseudo Code for Milestone 1
v 1
-----------------------------------
START
setup socket pair for ui
capture sigint
fork ui
UI
prompt setup info
while running
get input
if quit
create quit packet
send to switchboard
exit
if other
other
SETUP
wait for "setup packet" from ui
initialize
PROCESS CONTROL
5 socket pairs
5 forks
CONNECTION MANAGER
create, bind,
loop
listen, accept
pass accepted socket+info to inbound switchboard
INBOUND SWITCHBOARD
allocate socket lists
while 1
listen on all sockets
if new connection
add new connection to socket to list of inbound sockets
pass socket+info to outbound switchboard
if movement packet
pass to gameplay controller
if game status packet
pass to game status controller
.... etc
GAMESTATUS CONTROLLER
initialize objectives array
while 1
listen on ipc socket
update objectives
send to outbound switchboard
GAMEPLAY CONTROLLER
*just milestone1*
wile 1
listen on ipc-socket
read player information
update player information
send to outbound switchboard
OUTBOUND SWITCHBOARD
allocate tcp and udp socket list
while 1
listen on socket
if new connection
add tcp socket descriptor
open udp socket
else
forward to esired players
CLEANUP
sigint all processes
close all connections