marp | title | theme | class | headingDivider | author | size | ||
---|---|---|---|---|---|---|---|---|
true |
2024/01/22 z523087 Operating Systems Final Project Demo |
gaia |
|
1 |
Kajetan Wierszelis z523087 |
58140 |
2024/01/22 Operating Systems Final Project Demo Class of prof. 菅谷 みどり/SUGAYA Midori
Presentation prepared by:
- KajetanカイェタンWierszelis z523087
- Service Name
- Motivation (Describe design purpose)
- Program Source Code
- Explain How to Work (Demonstration/Video OK)
- Comments (what you learned, etc..)
The name came from inspiration of the classic "Snake" game, as once very popular on classic Nokia phones and game consoles. I wanted to reimplement the Snake game in terminal.
Also, the name shorts to SIT to allude to the host university name (initially the map was supposed to be modelled after campus, but this was dropped due to lack of time).
The service is meant to allow collecting real-time user input from multiple client terminals, and modify server-side game state parameters.
As mentioned, inspired by Snake; However due to lack of time and manpower, no GUI - just status messages.
This still allows for remote control of server from many clients.
- Server uses
fork()
, socket-handling and pipe to make multiple client connections possible - Data sent between server and client in structures
- Utilizes
ncurses
Based on previous class 9 (Sockets and echo server code) with added basic game logic.
Shown an explained (very shortly, we only have 4 minutes per team) in VS Codium
.
It's almost fully automated. How to:
- Run
make
. - Select any client window
- Press some key.
- Observe received position change.
- Repeat from "press some key" step.
Pressed key code 12 at time 90803498
Current position: (2, -5), score 2, port 33172
Connected to server on port 33172
Pressed key code 18 at time 908047009
Current position: (0, 5), score 0, port 33182
Connected to server on port 33182
socket() called
bind() called
listen() called
connect from 127.0.0.1: 33172
connect from 127.0.0.1: 33182
Player position: (0, -1) Port: 33172
Player position: (1, 0) Port: 33182
[...]
Player position: (2, -3) Port: 33172
Player position: (1, 5) Port: 33182
Player position: (2, -4) Port: 33172
Player position: (0, 5) Port: 33182
Player position: (2, -5) Port: 33172
- Incorporated
Makefile
to automate testing. - Automatic random port assignment.
- How to use
ncurses
to capture keyboard input. - Transmitting C structures via send() and recv().
- Send gamestate between parent and children of server using pipes.
- How to use zlib's
adler32
checksum. - How to timestamp structure. (These 2 were supposed to be checked to prevent cheating and calculate ping, but not enough time to actually implement that).
- Network communication principles (don't remember last time I had class on TCP)
- Low-level file management
- Operating Systems POSIX C programming (which now sometimes confuses me with Embedded C)
- Pipe logic (it's confusing at times)
- Synchronization of data and input (has to make sure client and server child process transmit in same order in both programs)
- Managing this project with other project and raport deadlines
Presentation prepared by Kajetan Wierszelis, z523087