Plan out project structure
This commit is contained in:
commit
59c3f6e34e
7 changed files with 100 additions and 0 deletions
6
chunkdb.py
Normal file
6
chunkdb.py
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
class ChunkDB():
|
||||||
|
"""
|
||||||
|
Load and save chunks to a SQLite db.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
27
chunks.py
Normal file
27
chunks.py
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
class ChunkDiff():
|
||||||
|
"""
|
||||||
|
Represents differences between two chunks (changes to be made to a chunk).
|
||||||
|
Can be used to transform a chunk into another chunk.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Chunk():
|
||||||
|
"""
|
||||||
|
Represents a chunk (16x8 characters on the map).
|
||||||
|
Is able to generate diffs
|
||||||
|
- from another chunk
|
||||||
|
- from direct changes
|
||||||
|
- from accumulated changes
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
class ChunkPool():
|
||||||
|
"""
|
||||||
|
Is a collection of chunks.
|
||||||
|
Allows user to manage (get, modify, delete) chunks, keeps track of chunks for them.
|
||||||
|
Load chunks it doesn't know.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
36
client.py
Normal file
36
client.py
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
|
||||||
|
class Client():
|
||||||
|
def __init__(self, address):
|
||||||
|
self.address = address
|
||||||
|
self.clock = threading.RLock()
|
||||||
|
#self.pool = Chunkpool()
|
||||||
|
#self.map_ = Map(sizex, sizey, self.pool)
|
||||||
|
#self.chunkmap = Chunkmap(sizex, sizey, self.pool) # size changeable by +/-?
|
||||||
|
|
||||||
|
#self.sock = socket.Socket(...)
|
||||||
|
|
||||||
|
def launch(self):
|
||||||
|
# try to connect
|
||||||
|
# launch socket thread
|
||||||
|
# update display
|
||||||
|
# -> launch input thread
|
||||||
|
|
||||||
|
def get_input(self, scr):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def main(argv):
|
||||||
|
if len(argv) != 2:
|
||||||
|
print("Usage:")
|
||||||
|
print(" {} address".format(argv[0]))
|
||||||
|
return
|
||||||
|
|
||||||
|
client = Client(argv[1])
|
||||||
|
client.launch()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv)
|
||||||
8
clientchunkpool.py
Normal file
8
clientchunkpool.py
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
from .chunks.py import ChunkPool
|
||||||
|
|
||||||
|
class ClientChunkPool(ChunkPool):
|
||||||
|
"""
|
||||||
|
A ChunkPool that requests/loads chunks from a client.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
8
dbchunkpool.py
Normal file
8
dbchunkpool.py
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
from .chunks.py import ChunkPool
|
||||||
|
|
||||||
|
class DBChunkPool(ChunkPool):
|
||||||
|
"""
|
||||||
|
A ChunkPool that can load/save chunks from/to a database.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
15
maps.py
Normal file
15
maps.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
class Map():
|
||||||
|
"""
|
||||||
|
A map which displays chunks and a cursor on the screen.
|
||||||
|
Allows for user to modify chunks in an intuitive way.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
class ChunkMap():
|
||||||
|
"""
|
||||||
|
A map that shows which chunks are currently loaded.
|
||||||
|
Might show additional details too (i.e. if a chunk has been modified).
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
0
server.py
Normal file
0
server.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue