Merge remote-tracking branch 'origin/master'
# Conflicts: # .gradle/6.9.2/executionHistory/executionHistory.lock # .gradle/6.9.2/fileHashes/fileHashes.lock # .gradle/buildOutputCleanup/buildOutputCleanup.lock
This commit is contained in:
commit
efb8363f38
BIN
.gradle/6.9.2/executionHistory/executionHistory.bin
Normal file
BIN
.gradle/6.9.2/executionHistory/executionHistory.bin
Normal file
Binary file not shown.
BIN
.gradle/6.9.2/fileHashes/fileHashes.bin
Normal file
BIN
.gradle/6.9.2/fileHashes/fileHashes.bin
Normal file
Binary file not shown.
BIN
.gradle/6.9.2/fileHashes/resourceHashesCache.bin
Normal file
BIN
.gradle/6.9.2/fileHashes/resourceHashesCache.bin
Normal file
Binary file not shown.
BIN
.gradle/6.9.2/javaCompile/classAnalysis.bin
Normal file
BIN
.gradle/6.9.2/javaCompile/classAnalysis.bin
Normal file
Binary file not shown.
BIN
.gradle/6.9.2/javaCompile/jarAnalysis.bin
Normal file
BIN
.gradle/6.9.2/javaCompile/jarAnalysis.bin
Normal file
Binary file not shown.
BIN
.gradle/6.9.2/javaCompile/javaCompile.lock
Normal file
BIN
.gradle/6.9.2/javaCompile/javaCompile.lock
Normal file
Binary file not shown.
BIN
.gradle/6.9.2/javaCompile/taskHistory.bin
Normal file
BIN
.gradle/6.9.2/javaCompile/taskHistory.bin
Normal file
Binary file not shown.
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="jbr-11" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
107
Meilenstein I/Diary - Stand 22-3-14.txt
Normal file
107
Meilenstein I/Diary - Stand 22-3-14.txt
Normal file
@ -0,0 +1,107 @@
|
||||
NOTE: Dies ist die .txt-Version des Diary, die .docx-Version ist im Ordner "documentation", allerdings unter dem namen "Protokoll" (Name hier geändert um Verwechslung mit client-server-Protokoll zu vermeiden).
|
||||
|
||||
|
||||
|
||||
|
||||
02.03.2022 – alle Gruppenmitglieder
|
||||
|
||||
- Einrichtung Git und IntelliJ
|
||||
|
||||
- Spielidee: Jonas: Werwolf-Spiel
|
||||
|
||||
6 Spieler, rundenbasiert
|
||||
|
||||
Grobe Idee: Es gibt einen Geist und 5 Personen, die in einem Nachtzug in benachbarten Kabinen fahren. Ein Geist kann in der Nacht einen anderen „gesunden“ Spieler (Person) infizieren. Dabei läuft der Geist neben anderen Personen und sie „hören“ den Geist (Benachrichtigung). Wenn die Nacht vorbei ist, müssen sich alle Spieler entscheiden, ob sie sagen, sie hätten etwas gehört oder nicht (mit Chat). Dann gibt es am Tag eine Abstimmung, wer der Geist ist (Stimme der Geister zählt nicht). Der Spieler mit den meisten Stimmen wird aus dem Spiel geworfen. In der nächsten Nacht stimmen die verbliebenen Geister ab, wen sie infizieren wollen. Anschliessend beginnt die Infektionsphase erneut.
|
||||
|
||||
Das Spiel ist vorbei, wenn nur Geister oder nur Personen übrig sind.
|
||||
Schräge/isometrische Grafik, prerendered
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
08.03.2022 – alle Gruppenmitglieder
|
||||
|
||||
- Ziele für heute: Spieldesign/Spielregeln, Analyse, Projektplanung
|
||||
|
||||
- Spieldesign:
|
||||
|
||||
- Mindestens 6 Spieler (bei weniger als 6 human players wird der Rest mit NPCs aufgefüllt)
|
||||
|
||||
- Zwei Arten/Rollen von Spielern: ghosts, humans
|
||||
|
||||
- Server kommuniziert Spielern, ob sie humans oder ghosts sind
|
||||
|
||||
- Spieler, der neues Spiel kreiert, ist Admin (darf neues Spiel z.B. auch nur mit NPCs anfangen)
|
||||
|
||||
- ghosts vs. humans: Geister können Menschen infizieren und zu Geistern machen. Sind nur Geister im Spiel übrig, haben Geister gewonnen. Haben die Menschen den ursprünglichen Geist aus dem Spiel geworfen, haben sie gewonnen.
|
||||
|
||||
(- Versucht ein Geist, einen Menschen zu infizieren, ist nicht sicher, ob er es schafft)
|
||||
|
||||
- Eine Runde = ein Tag-Nacht-Zyklus
|
||||
|
||||
- Geister haben separaten Chat, in dem sie entscheiden können, wen sie in der nächsten Nacht infizieren
|
||||
- Nacht: Geister aktiv, infizieren Menschen
|
||||
- Infizierte wissen, wer sie infiziert hat
|
||||
- Läuft der Geist neben Menschen, ohne sie zu infizieren, werden diese benachrichtigt
|
||||
- Tag: anonyme Abstimmung, wer aus Spiel herausgekickt werden soll
|
||||
|
||||
- time limit: Wenn man in einer bestimmten Zeit nicht abgestimmt hat, kriegt man eine Stimme für sich selbst
|
||||
|
||||
- Spieler dürfen vor der Abstimmung sagen, ob sie einen Geist gehört haben oder nicht (Geister können Menschen dabei täuschen)
|
||||
|
||||
- Stimmen der Geistern zählen nicht
|
||||
|
||||
- Rausgeworfene Spieler werden Zuschauer
|
||||
|
||||
- Nach Abstimmung wissen alle, wer ausgewählt worden ist, und ob der Spieler Geist war.
|
||||
|
||||
|
||||
Zusammenfassung:
|
||||
|
||||
- Spielbeginn: 6 Spielfelder. Erste Runde beginnt. Es ist Nacht, es gibt einen Geist. Geist stimmt für einen Menschen, den er infizieren will (Abstimmung mit time-limit; in möglichen späteren Runden stimmen mehrere Geister über zu infizierenden Menschen). Er infiziert diesen Menschen.
|
||||
|
||||
- Infizierter wird benachrichtigt, dass er nun Geist ist; zudem Benachrichtigungen über Bewegung des Geistes
|
||||
|
||||
- Es wird Tag: Menschen stimmen ab (mit Chat für Menschen, mit time limit), Geister-Stimmen zählen nicht. Wenn ein Geist die meisten Stimmen erhalten hat, wird er zum Zuschauer. Wenn Menschen für einen Menschen stimmen, werden sie benachrichtigt, dass er kein Geist ist (er wird nicht rausgeworfen) und das Spiel geht mit ihm weiter.
|
||||
|
||||
- Spielende: entweder es gibt nur Geister (Geister gewonnen) oder erster Geist durch Menschen-Abstimmung aus dem Spiel geworfen (Menschen gewonnen).
|
||||
|
||||
- Spieltitel: “Night train to Budapest”
|
||||
|
||||
- Durchspielen auf Papier
|
||||
|
||||
- Softwareanforderungen:
|
||||
- 2D-Grafik
|
||||
- Event-Handler (kümmert sich um Input/Output)
|
||||
|
||||
- Zustandsspeicherung/Zustandsverwaltung (ist Tag / Nacht / Abstimmungszeit / Infektionszeit?)
|
||||
|
||||
- Client/Server-Kommunikation
|
||||
|
||||
- Separate Chatfunktion
|
||||
|
||||
|
||||
- Grundlagen der Projektplanung
|
||||
- Netzwerkprotokoll
|
||||
- Client/-Serverstruktur
|
||||
- Chatfunktion
|
||||
- Spiellogik (Speicherung, Methoden für Veränderung)
|
||||
- GUI
|
||||
- Klassenstruktur (Datenstrukturen, Client/Server greifen darauf zu)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
11.03.2022 – alle Gruppenmitglieder
|
||||
|
||||
- Einrichtung, Synchronisation GanttProject
|
||||
|
||||
- Projektplanung: Anfang (parallelisierbar): Klassenstruktur (Human, Ghost, …), Spiellogik (Spielzustand, Voting), Client/Server (rundenbasiert), später: GUI (2D-Engine, Animation), Chat (mit speziellem Ghost-Modus)
|
||||
|
||||
- Aufgabenaufteilung Meilenstein 1: Vorbereitung Präsentation (Jonas), Übersicht Netzwerk (Sebastian), Softwareanforderungen (Alex), detaillierter Projektplan (Seraina)
|
||||
|
||||
- Netzwerktopologie für das Spiel: Stern
|
||||
|
||||
|
||||
5
Meilenstein I/Presentation - Google Slides.url
Normal file
5
Meilenstein I/Presentation - Google Slides.url
Normal file
@ -0,0 +1,5 @@
|
||||
[{000214A0-0000-0000-C000-000000000046}]
|
||||
Prop3=19,11
|
||||
[InternetShortcut]
|
||||
IDList=
|
||||
URL=https://docs.google.com/presentation/d/118LfYVjs4Ynv55BnAWHeOGlN-gCtpKnjH9fYefICL1c/edit?usp=sharing
|
||||
@ -0,0 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta http-equiv="x-ua-compatible" content="IE=edge"/>
|
||||
<title>Test results - HelloWorldTest</title>
|
||||
<link href="../css/base-style.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../css/style.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="../js/report.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1>HelloWorldTest</h1>
|
||||
<div class="breadcrumbs">
|
||||
<a href="../index.html">all</a> >
|
||||
<a href="../packages/ch.unibas.dmi.dbis.cs108.example.html">ch.unibas.dmi.dbis.cs108.example</a> > HelloWorldTest</div>
|
||||
<div id="summary">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="summaryGroup">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="infoBox" id="tests">
|
||||
<div class="counter">1</div>
|
||||
<p>tests</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="failures">
|
||||
<div class="counter">0</div>
|
||||
<p>failures</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="ignored">
|
||||
<div class="counter">0</div>
|
||||
<p>ignored</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox" id="duration">
|
||||
<div class="counter">0.009s</div>
|
||||
<p>duration</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="infoBox success" id="successRate">
|
||||
<div class="percent">100%</div>
|
||||
<p>successful</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tabs">
|
||||
<ul class="tabLinks">
|
||||
<li>
|
||||
<a href="#tab0">Tests</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="tab0" class="tab">
|
||||
<h2>Tests</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Test</th>
|
||||
<th>Duration</th>
|
||||
<th>Result</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td class="success">testMain()</td>
|
||||
<td class="success">0.009s</td>
|
||||
<td class="success">passed</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p>
|
||||
<div>
|
||||
<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines
|
||||
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
||||
</label>
|
||||
</div>Generated by
|
||||
<a href="http://www.gradle.org">Gradle 6.9.2</a> at 06.03.2022, 13:30:14</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,29 @@
|
||||
|
||||
import java.io.*;
|
||||
import java.net.Socket;
|
||||
|
||||
public class BudaClient {
|
||||
public static void main(String[] args) {
|
||||
Socket sock = null;
|
||||
try {
|
||||
sock = new Socket("localhost", 8090);
|
||||
OutputStream out= sock.getOutputStream();
|
||||
BufferedReader conin = new BufferedReader(new InputStreamReader(System.in));
|
||||
String line = "";
|
||||
while (true) {
|
||||
line = conin.readLine();
|
||||
out.write(line.getBytes());
|
||||
if (line.equalsIgnoreCase("Quitx")) {
|
||||
break;
|
||||
}
|
||||
//line.startsWith() //todo: automatically handle name lengths
|
||||
//TODO: Implement inputStream in.
|
||||
}
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
|
||||
public class BudaClientThread implements Runnable {
|
||||
int number;
|
||||
Socket socket;
|
||||
String name;
|
||||
|
||||
|
||||
public BudaClientThread(int number, Socket socket) {
|
||||
this.number = number;
|
||||
this.socket = socket;
|
||||
name = "";
|
||||
}
|
||||
|
||||
public void run() {
|
||||
System.out.println("Connection " + number + " established.");
|
||||
try {
|
||||
InputStream in = socket.getInputStream();
|
||||
OutputStream out = socket.getOutputStream();
|
||||
byte[] command;
|
||||
String comString;
|
||||
while (true) {
|
||||
command = new byte[5];
|
||||
System.out.println("Waiting to receive a line");
|
||||
in.read(command);
|
||||
System.out.println("Got a line!");
|
||||
comString = new String(command);
|
||||
System.out.println("Client number " + number + " sent this message: " + comString);
|
||||
if (comString.equalsIgnoreCase("Quitx")) {
|
||||
BudaServer.quit = true;
|
||||
System.out.println("I just set quit to true!");
|
||||
break;
|
||||
}
|
||||
|
||||
//todo: do as switch.
|
||||
|
||||
if (comString.equalsIgnoreCase("NAME:")) { //todo: implement these as methods?
|
||||
setName(in);
|
||||
}
|
||||
|
||||
if (comString.equalsIgnoreCase("NAMES")) {
|
||||
printnames();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void printnames() {
|
||||
for (BudaClientThread t: BudaServer.Clients) {
|
||||
System.out.println(t.name + " connected (#" + t.number + ")");
|
||||
}
|
||||
}
|
||||
|
||||
public void setName(InputStream in) throws IOException {
|
||||
//byte[] namebyte = new byte[0];
|
||||
String nameString = "";
|
||||
int i;
|
||||
while (true) {
|
||||
i = in.read();
|
||||
if (i == 46) break;
|
||||
nameString = nameString + (char) i;
|
||||
}
|
||||
this.name = nameString;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class BudaServer {
|
||||
public static boolean quit = false; //todo: meaningfully implement this
|
||||
public static HashSet<BudaClientThread> Clients = new HashSet<BudaClientThread>();
|
||||
static int connections = 0;
|
||||
|
||||
public static void main(String[] args) {
|
||||
ServerConnector ServC = new ServerConnector();
|
||||
Thread ServCThread = new Thread(ServC);
|
||||
ServCThread.start();
|
||||
System.out.println("Server has entered its main loop");
|
||||
while (!quit) {
|
||||
//Main server stuff goes here
|
||||
}
|
||||
//ServCThread.stop(); //todo: find some alternative for this.
|
||||
System.out.println("stopping the main BudaServer thread.");
|
||||
System.out.println("Quitting after the next connection is made.");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import java.io.*;
|
||||
import java.net.Socket;
|
||||
|
||||
public class ClientListener implements Runnable{
|
||||
private final Socket sock;
|
||||
|
||||
public ClientListener(Socket sock) {
|
||||
this.sock = sock;
|
||||
}
|
||||
|
||||
public void run(){
|
||||
byte[] command = new byte[5];
|
||||
String comString;
|
||||
|
||||
try {
|
||||
InputStream in = sock.getInputStream();
|
||||
in.read(command);
|
||||
System.out.println("Got a line!");
|
||||
comString = new String(command);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
public class ServerConnector implements Runnable{
|
||||
public void run() {
|
||||
try {
|
||||
System.out.println(
|
||||
"Warte auf Verbindungen auf Port 8090...");
|
||||
ServerSocket servSock = new ServerSocket(8090);
|
||||
while (true) {
|
||||
Socket socket = servSock.accept();
|
||||
System.out.println("got a connection: socket " + BudaServer.connections + socket.toString());
|
||||
BudaClientThread newClientThread = new BudaClientThread(++BudaServer.connections, socket);
|
||||
BudaServer.Clients.add(newClientThread);
|
||||
Thread bCT = new Thread(newClientThread);
|
||||
bCT.start();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.out.println("server got an error");
|
||||
System.err.println(e);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user