123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- import processing.net.*;
-
- int i_citizenAmount = 100;
- /*
- todo
- !!!FIX ONE SIDED COLOR TRANSMISSION!!!
- steady control over selectedCitizen. right click on house to enter it.
- reset view and selectCitizen(0) after long time no input
- fix zoom, add zoom level
- saarbrücken map
- add ui panel for selected citizen in non-debug
-
- enter house
-
- dominanz
- wächst mit anzahl der am tag durchgeführten kommunikationen
- sinkt mit zeit ohne kommunikation
- (durchgeführte kommunikationen nach tag resetten)
- beeinflusst wie stark eigene farbe übertragen oder übernommen wird
- proportional zur farbintensität? alle grau = weltfrieden though
-
- goTo fast immer haus-spezifisch machen. liste der häuser von citizen mit ähnlicher farbe, werden öfter besucht
- ab und zu nach hause gehen
- goTo random point on map = spaziergang. passiert vorwiegend sonntags? wochentage?
-
-
- andere lösung finden ausser teleportieren bei unmöglicher pfadfindung
-
- idee:
- processing client - spieler verfolgt einen einzigen citizen
- ignore-liste
- ziel: möglichst viele zur eigenen farbe bekehren
-
-
- alte ideen:
-
- //citizen kann "lookat" mit 180° winkel mit bullseye förmigen gradient welches die chance etwas zu bemerken darstellt
- //setFocus(entity) durch geräusche auch von objekten ausserhalb des sichtfeldes aufrufbar
-
- //citizen kann "focus", guckt mit den augen in die richtung. 2. augen-vektor! kopf wird mitgedreht je nach "openness"
- //citizen kann "take", nimmt gegenstand in die hand. arraylist "holds" - gegenstände in der hand
-
-
- */
-
- //settings
- boolean b_rundgang = true;
-
- boolean b_loadSun = false; //load sun from web-api instead of local json file (local file is adressed to january 4th 2019. might implement a check that downloads today's information only once...
-
- int i_sMapReso = 8; //the higher the smaller the reso, 2 is best quality but takes some time to download
-
- int i_timeTickMS = 200; //milliseconds how long until next minute ticks on clock
-
- float f_walkSpeedMin = 2;
- float f_walkSpeedMax = 3;
-
- float f_nodeResolution = 0.1; //defines density of path-finding nodes, multiplied with resolution
- int i_pathAlgorithm = 4;
-
-
- boolean b_cameraLock = false;
- boolean b_autoPlay = false;
- boolean b_realTime = false;
- boolean b_controlEyeWithMouse;
- boolean b_housesTexts;
- boolean b_debug = false;
- boolean b_drawNodes = false;
-
-
- int i_windowW, i_windowH, i_viewportW, i_viewportH;
-
-
- PImage img_helptext;
-
- Server server;
- Client client;
-
- void setup() {
- fullScreen();
- //size(700, 600);
-
- i_windowW = width;
- i_windowH = height;
-
- server = new Server(this, 5210);
-
- img_map = loadImage(dataPath("map/map2.png"));
- img_houses = loadImage(dataPath("map/houses_without_borders2.png"));
-
- pg_map = createGraphics(img_houses.width, img_houses.height);
-
- surface.setResizable(true);
- registerMethod("pre", this);
-
- i_mapW = pg_map.width;
- i_mapH = pg_map.height;
-
- img_helptext = loadImage("helptext.png");
-
-
- initTime();
- initHouses();
- initPathFinding();
- initWeather();
- initCitizen();
- initInteractables();
- initUI();
- zoomOut();
-
- }
-
-
- String s_fromClient;
- int i_mapLevelTransferC;
- int i_makeThemGoC;
-
- int i_idleFrames;
- iPVector iv2_mouseBufferIdle = new iPVector(0, 0);
- void idleRecord(){
- if(mouseX == iv2_mouseBufferIdle.x && mouseY == iv2_mouseBufferIdle.y){
- i_idleFrames++;
- if(i_idleFrames >= 5000){
- buttons[1].click();
- }
- } else {
- i_idleFrames = 0;
- }
- iv2_mouseBufferIdle.x = mouseX;
- iv2_mouseBufferIdle.y = mouseY;
- }
-
- void draw() {
- background(127);
- for (int i = 0; i < i_citizenAmount*3; i++){ //so bad
- clientCommunication();
- }
-
- time();
-
- if (b_makeThemGo) {
- //citizen[i_makeThemGoC].goTo(int(random(0, pg_map.width)), int(random(0, pg_map.height)));
- citizen[i_makeThemGoC].goToRandom();
- i_makeThemGoC ++;
- if (i_makeThemGoC >= citizen.length) {
- b_makeThemGo = false;
- i_makeThemGoC = 0;
- }
- }
-
- pg_map.beginDraw();
- pg_map.background(127);
-
- //pg_map.tint(50,50,200,255);
-
- int nightC = 0;
- if (i_flexibleTime > 300 && i_flexibleTime < 550) {
- nightC = (int)map(i_flexibleTime, 300, 550, 50, 255);
- }
- if (i_flexibleTime <= 300 || i_flexibleTime >= 1300) {
- nightC = 50;
- }
- if (i_flexibleTime >= 550 && i_flexibleTime <= 1000) {
- nightC = 255;
- }
- if (i_flexibleTime > 1000 && i_flexibleTime < 1300) {
- nightC = (int)map(i_flexibleTime, 1000, 1300, 255, 50);
- }
-
- pg_map.tint(nightC, nightC, (int)map(nightC, 50, 255, 150, 255), 255);
- i_visionTransparency = (int)map(nightC, 50, 255, 0, 150);
- //150-450 //morgen
- //1000-1300 //abend
-
-
- if (b_debug) pg_map.image(img_houses, 0, 0, img_houses.width, img_houses.height);
- else pg_map.image(img_map, 0, 0, img_houses.width, img_houses.height);
-
- pg_map.fill(0);
- pg_map.textSize(7);
- pg_map.textAlign(CENTER);
-
- if (b_debug && b_housesTexts) {
- for (House house : houses) {
- house.display();
- }
- }
- if (b_drawNodes) drawNodes();
-
- for (int i = 0; i < interactables.length; i++) {
- interactables[i].update();
- }
-
- for (int i = 0; i < citizen.length; i++) {
- if (citizen[i].b_linked) {
- citizen[i].update();
- if (i != i_selectedCitizen)
- citizen[i].display();
- if (b_debug)
- citizen[i].debug();
- }
- }
- if (b_controlEyeWithMouse) {
- citizen[i_selectedCitizen].turnTo(citizen[i_selectedCitizen].f_xPos-(float)constrain(i_mapViewToMap(mouseX, i_mapOffsetX), 0, pg_map.width), citizen[i_selectedCitizen].f_yPos-(float)constrain(i_mapViewToMap(mouseY, i_mapOffsetY), 0, pg_map.height), 0) ;
- }
-
- if (i_selectedCitizen != 0) citizen[i_selectedCitizen].display();
-
- pg_map.endDraw();
- image(pg_map, i_mapOffsetX, i_mapOffsetY, i_mapW, i_mapH);
- drawUI();
- idleRecord();
- }
|