diff --git a/Server.py b/Server.py index 223372a..6f59632 100644 --- a/Server.py +++ b/Server.py @@ -14,26 +14,52 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. +import os +from time import sleep from twisted.internet import reactor import gameEngine from gameEngine.ServerFactory import ServerFactory +from gameEngine.InputHandler import InputHandler from gameEngine.World import World +import asciiWidgets +from asciiWidgets.AsciiUI import AsciiUI + class Server: def __init__( self ): - # Initializing the simulation - self.world = World( 2 ) + self.stop = False + self.threadPool = None + self.world = World( self, 2 ) + self.inputHandler = InputHandler( self ) + self.asciiUI = AsciiUI( self, self.world ) + + def quitLoop( self ): + while( self.stop == False ): + sleep( 0.1 ) + reactor.stop() + def run( self ): + self.threadPool = reactor.getThreadPool() + print '\033[32mInfo\033[0m Starting world thread...' - reactor.callInThread( self.world.run ) + reactor.callInThread( self.world.run, self.threadPool ) + + print '\033[32mInfo\033[0m Starting input handler thread...' + reactor.callInThread( self.inputHandler.run, self.threadPool ) + + print '\033[32mInfo\033[0m Starting ASCII UI thread...' + reactor.callInThread( self.asciiUI.run, self.threadPool ) + + reactor.callLater( 1, self.quitLoop ) print '\033[32mInfo\033[0m Starting listening socket...' reactor.listenTCP( 65000, ServerFactory() ) - + print '\033[32mInfo\033[0m Starting reactor...' reactor.run() - + if( __name__ == '__main__' ): Server = Server() Server.run() + os.system( 'clear' ) diff --git a/asciiWidgets/ActivityBar.py b/asciiWidgets/ActivityBar.py new file mode 100644 index 0000000..424091d --- /dev/null +++ b/asciiWidgets/ActivityBar.py @@ -0,0 +1,32 @@ +#!/usr/bin/python +#*** encoding:utf-8 *** + +# This file is part of La Vida +# Copyright (C) 2011 Florian R. A. Angermeier +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +from AsciiWidget import AsciiWidget + +class ActivityBar( AsciiWidget ): + def __init__( self, pos, character ): + self.cmdPrefix = '\033[' + self.cmdSeperator = ';' + self.cmdPostfixPosition = 'H' + self.cmdPostfixColor = 'm' + self.cmdTab = '\t' + self.pos = pos + self.character = character + + def printWidget( self ): + cmdPosition = '%s%i%s%i%s' % ( self.cmdPrefix, self.pos[0], self.cmdSeperator, self.pos[1], self.cmdPostfixPosition ) + output = '%sActivity: %s (%s)' % ( cmdPosition, self.character.brain.activity, self.character.brain.activityTimer ) + print '%s' % ( output ) diff --git a/asciiWidgets/AsciiUI.py b/asciiWidgets/AsciiUI.py new file mode 100644 index 0000000..0f88e96 --- /dev/null +++ b/asciiWidgets/AsciiUI.py @@ -0,0 +1,55 @@ +#!/usr/bin/python +#*** encoding:utf-8 *** + +# This file is part of La Vida +# Copyright (C) 2011 Florian R. A. Angermeier +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +import os +from time import sleep +from twisted.internet import reactor + +from GameClock import GameClock +from NeedBar import NeedBar +from ActivityBar import ActivityBar +from MapView import MapView + +class AsciiUI: + # The ASCII user interface base class which provides the drawing loop. + + def __init__( self, server, world ): + self.server = server + self.gameClock = GameClock( ( 1, 1 ) , world) + self.needBarSleep = NeedBar( ( 2, 1 ), 'Sleep ', world.characters[ 0 ], 'sleep' ) + self.needBarFood = NeedBar( ( 3, 1 ), 'Food ', world.characters[ 0 ], 'food' ) + self.needBarWater = NeedBar( ( 4, 1 ), 'Water ', world.characters[ 0 ], 'water' ) + self.needBarUrination = NeedBar( ( 2, 30 ), 'Urination ', world.characters[ 0 ], 'urination' ) + self.needBarHygiene = NeedBar( ( 3, 30 ), 'Hygiene ', world.characters[ 0 ], 'hygiene' ) + self.needBarFun = NeedBar( ( 4, 30 ), 'Fun ', world.characters[ 0 ], 'fun' ) + self.needBarSocial = NeedBar( ( 2, 60 ), 'Social ', world.characters[ 0 ], 'social' ) + self.activityBar = ActivityBar( ( 5, 1 ), world.characters[ 0 ] ) + self.mapView = MapView( (6, 0), world ) + + def run( self, treadPool ): + os.system( 'clear' ) + while( self.server.stop != True ): + self.gameClock.printWidget() + self.needBarSleep.printWidget() + self.needBarFood.printWidget() + self.needBarWater.printWidget() + self.needBarUrination.printWidget() + self.needBarHygiene.printWidget() + self.needBarFun.printWidget() + self.needBarSocial.printWidget() + self.activityBar.printWidget() + self.mapView.printWidget() + sleep( 1 ) diff --git a/asciiWidgets/AsciiWidget.py b/asciiWidgets/AsciiWidget.py new file mode 100644 index 0000000..1077f17 --- /dev/null +++ b/asciiWidgets/AsciiWidget.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +#*** encoding:utf-8 *** + +# This file is part of La Vida +# Copyright (C) 2011 Florian R. A. Angermeier +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +class AsciiWidget: + # The abstract base class for all ascii widgets. + + def __init__( self, pos ): + self.cmdPrefix = '\033[' + self.cmdSeperator = ';' + self.cmdPostfixPosition = 'H' + self.cmdPostfixColor = 'm' + self.cmdTab = '\t' + self.pos = pos diff --git a/asciiWidgets/GameClock.py b/asciiWidgets/GameClock.py new file mode 100644 index 0000000..b5ecc39 --- /dev/null +++ b/asciiWidgets/GameClock.py @@ -0,0 +1,36 @@ +#!/usr/bin/python +#*** encoding:utf-8 *** + +# This file is part of La Vida +# Copyright (C) 2011 Florian R. A. Angermeier +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +from AsciiWidget import AsciiWidget + +class GameClock( AsciiWidget ): + def __init__( self, pos, world ): + self.cmdPrefix = '\033[' + self.cmdSeperator = ';' + self.cmdPostfixPosition = 'H' + self.cmdPostfixColor = 'm' + self.cmdTab = '\t' + self.pos = pos + self.world = world + + def printWidget( self ): + cmdPosition = '%s%i%s%i%s' % ( self.cmdPrefix, self.pos[0], self.cmdSeperator, self.pos[1], self.cmdPostfixPosition ) + cmdColor = '%s1%s' % ( self.cmdPrefix, self.cmdPostfixColor ) + output = '%s%sGame date: %i/%i/%i%sGame time: %i:%i:%i' % ( cmdPosition, cmdColor, self.world.gameMonth, self.world.gameDay, self.world.gameYear, + self.cmdTab, self.world.gameHour, self.world.gameMinute, self.world.gameSecond ) + cmdColor = '%s0%s' % ( self.cmdPrefix, self.cmdPostfixColor ) + output += cmdColor + print '%s' % ( output ) diff --git a/asciiWidgets/MapView.py b/asciiWidgets/MapView.py new file mode 100644 index 0000000..f4ba4d1 --- /dev/null +++ b/asciiWidgets/MapView.py @@ -0,0 +1,61 @@ +#!/usr/bin/python +#*** encoding:utf-8 *** + +# This file is part of La Vida +# Copyright (C) 2011 Florian R. A. Angermeier +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +from AsciiWidget import AsciiWidget + +class MapView( AsciiWidget ): + def __init__( self, pos, world ): + self.cmdPrefix = '\033[' + self.cmdSeperator = ';' + self.cmdPostfixPosition = 'H' + self.cmdPostfixColor = 'm' + self.cmdTab = '\t' + self.pos = pos + self.world = world + self.asciiTiles = { 0: '%s33%s42%s"%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ), + 1: '%s30%s40%s:%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ), + 2: '%s31%s43%s#%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ), + 3: '%s30%s44%s~%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ), + 4: '%s30%s44%s+%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ) } + self.asciiObject = { 'Bed': '%s1%s37%s43%sH%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ), + 'Cooker': '%s1%s30%s47%s8%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ), + 'Refrigerator': '%s1%s30%s47%s*%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ), + 'Toilet': '%s1%s30%s47%sO%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ), + 'Shower': '%s1%s30%s47%s^%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ), + 'TvSet': '%s1%s30%s43%sY%s0%s' % ( self.cmdPrefix, self.cmdSeperator, self.cmdSeperator, self.cmdPostfixColor, self.cmdPrefix, self.cmdPostfixColor ) } + + def printWidget( self ): + cmdPosition = '%s%i%s%i%s' % ( self.cmdPrefix, self.pos[0], self.cmdSeperator, self.pos[1], self.cmdPostfixPosition ) + print '%sMap view' % ( cmdPosition ) + rowId = 0 + colId = 0 + for row in self.world.typeMap: + rowId += 1 + cmdPosition = '%s%i%s%i%s' % ( self.cmdPrefix, self.pos[0] + rowId, self.cmdSeperator, self.pos[1], self.cmdPostfixPosition ) + output = '%s' % ( cmdPosition ) + for col in row: + output += self.asciiTiles[ col ] + print '%s' % ( output ) + + for object in self.world.objects: + cmdPosition = '%s%i%s%i%s' % ( self.cmdPrefix, self.pos[0] + object.pos[0], self.cmdSeperator, self.pos[1] + object.pos[1], self.cmdPostfixPosition ) + output = '%s%s' % ( cmdPosition, self.asciiObject[ object.type ] ) + print output + + for character in self.world.characters: + cmdPosition = '%s%i%s%i%s' % ( self.cmdPrefix, self.pos[0] + character.pos[0], self.cmdSeperator, self.pos[1] + character.pos[1], self.cmdPostfixPosition ) + output = '%sC' % ( cmdPosition ) + print output diff --git a/asciiWidgets/NeedBar.py b/asciiWidgets/NeedBar.py new file mode 100644 index 0000000..44c04b0 --- /dev/null +++ b/asciiWidgets/NeedBar.py @@ -0,0 +1,51 @@ +#!/usr/bin/python +#*** encoding:utf-8 *** + +# This file is part of La Vida +# Copyright (C) 2011 Florian R. A. Angermeier +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +from AsciiWidget import AsciiWidget + +class NeedBar( AsciiWidget ): + def __init__( self, pos, label, character, need ): + self.cmdPrefix = '\033[' + self.cmdSeperator = ';' + self.cmdPostfixPosition = 'H' + self.cmdPostfixColor = 'm' + self.cmdTab = '\t' + self.pos = pos + self.label = label + self.character = character + self.need = need + + def printWidget( self ): + cmdPosition = '%s%i%s%i%s' % ( self.cmdPrefix, self.pos[0], self.cmdSeperator, self.pos[1], self.cmdPostfixPosition ) + + cmdColor = '%s40%s' % ( self.cmdPrefix, self.cmdPostfixColor ) + output = '%s%s%s ' % ( cmdPosition, self.label, cmdColor ) + cmdColor = '%s0%s' % ( self.cmdPrefix, self.cmdPostfixColor ) + output += cmdColor + print '%s' % ( output ) + + if( self.character.needs[ self.need ] >= 750 ): + cmdColor = '%s42%s' % ( self.cmdPrefix, self.cmdPostfixColor ) + elif( self.character.needs[ self.need ] >= 500 ): + cmdColor = '%s43%s' % ( self.cmdPrefix, self.cmdPostfixColor ) + else: + cmdColor = '%s41%s' % ( self.cmdPrefix, self.cmdPostfixColor ) + output = '%s%s%s' % ( cmdPosition, self.label, cmdColor ) + for i in range( int( self.character.needs[ self.need ] / 100 ) ): + output += ' ' + cmdColor = '%s0%s' % ( self.cmdPrefix, self.cmdPostfixColor ) + output += '%s' % ( cmdColor ) + print '%s' % ( output ) diff --git a/asciiWidgets/__init__.py b/asciiWidgets/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gameEngine/Character.py b/gameEngine/Character.py index 89a357b..70be91f 100644 --- a/gameEngine/Character.py +++ b/gameEngine/Character.py @@ -22,8 +22,8 @@ class Character: def __init__( self, id, world, gender ): self.world = world # The world a character belongs to. self.id = id # Unique integer number to identify a character. - self.pos = [ 0, 0, 0 ] # A characters current position. - self.destination = [ 0, 0, 0 ] # A characters destination for movement. + self.pos = [ 1, 1, 0 ] # A characters current position. + self.destination = [ 1, 1, 0 ] # A characters destination for movement. self.radii = { 'talk': 1 } if( gender.lower() == 'random' ): # A characters gender. @@ -43,31 +43,31 @@ def __init__( self, id, world, gender ): 'social': 500 } # def teleportTo( self, x, y, z ): - print 'DEBUG: Character %i teleports to X: %i Y: %i Z: %i.' % ( self.id, x, y, z ) + # print 'DEBUG: Character %i teleports to X: %i Y: %i Z: %i.' % ( self.id, x, y, z ) self.pos = [ x, y, z ] def goTo( self, x, y, z ): - print 'DEBUG: Character %i goes to X: Y: %i %i Z: %i.' % ( self.id, x, y, z ) + # print 'DEBUG: Character %i goes to X: Y: %i %i Z: %i.' % ( self.id, x, y, z ) self.destination = [ x, y, z ] def move( self ): # X axis if( self.pos[ 0 ] != self.destination[ 0 ] ): - print 'DEBUG: Character %i is on his/her way on the x axis.' + # print 'DEBUG: Character %i is on his/her way on the x axis.' if( self.pos[ 0 ] < self.destination[ 0 ] ): self.pos[ 0 ] += 1 elif( self.pos[ 0 ] > self.destination[ 0 ] ): self.pos[ 0 ] -= 1 # Y axis if( self.pos[ 1 ] != self.destination[ 1 ] ): - print 'DEBUG: Character %i is on his/her way on the y axis.' + # print 'DEBUG: Character %i is on his/her way on the y axis.' if( self.pos[ 1 ] < self.destination [ 1 ] ): self.pos[ 1 ] += 1 elif( self.pos[ 1 ] > self.destination[ 1 ] ): self.pos[ 1 ] -= 1 # Z axis if( self.pos[ 2 ] != self.destination[ 2 ] ): - print 'DEBUG: Character %i is on his/her way on the z axis.' + # print 'DEBUG: Character %i is on his/her way on the z axis.' if( self.pos[ 2 ] < self.destination [ 2 ] ): self.pos[ 2 ] += 1 elif( self.pos[ 2 ] > self.destination[ 2 ] ): @@ -96,7 +96,7 @@ def decreaseNeeds( self ): self.needs['hygiene'] -= 0.005787037 if( self.brain.activity != 'watch' ): self.needs['fun'] -= 0.034722222 - if( self.brain.activity != 'chat' ): + if( self.brain.activity != 'talk' ): self.needs['social'] -= 0.011574074 except: pass diff --git a/gameEngine/InputHandler.py b/gameEngine/InputHandler.py new file mode 100644 index 0000000..5857af4 --- /dev/null +++ b/gameEngine/InputHandler.py @@ -0,0 +1,37 @@ +#!/usr/bin/python +#*** encoding:utf-8 *** + +# This file is part of La Vida +# Copyright (C) 2011 Florian R. A. Angermeier +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +from twisted.internet import reactor + +class InputHandler: + # A basic input handler. + + def __init__( self, server ): + self.server = server + self.cmdPrefix = '\033[' + self.cmdSeperator = ';' + self.cmdPostfixPosition = 'H' + self.cmdPostfixColor = 'm' + self.cmdTab = '\t' + self.pos = ( 48, 1 ) + self.keyPressed = '' + + def run( self, threadPool ): + while( self.server.stop != True ): + cmdPosition = '%s%i%s%i%s' % ( self.cmdPrefix, self.pos[0], self.cmdSeperator, self.pos[1], self.cmdPostfixPosition ) + self.keyPressed = raw_input( '%sLa Vida (quit): ' % ( cmdPosition ) ) + if( self.keyPressed.lower() == 'quit' ): + self.server.stop = True diff --git a/gameEngine/World.py b/gameEngine/World.py index 17aa3e7..a611bcc 100644 --- a/gameEngine/World.py +++ b/gameEngine/World.py @@ -17,6 +17,7 @@ import os from time import sleep, time from ConfigParser import ConfigParser +from twisted.internet import reactor import gameEngine from gameEngine.Character import Character @@ -30,8 +31,9 @@ from objects.TvSet import TvSet class World: - def __init__( self, amountOfCharacters ): + def __init__( self, server, amountOfCharacters ): # Basic infrastructure + self.server = server self.configParser = ConfigParser() # Reading the game engine cinfiguration @@ -55,7 +57,7 @@ def __init__( self, amountOfCharacters ): self.ticksPerSecond = self.configParser.get( 'time', 'ticksPerSecond' ) # Ticks per second self.gameSecondsPerTick = self.configParser.get( 'time', 'gameSecondsPerTick' ) # The amount of game seconds passing each tick else: - self.ticksPerSecond = 1.50 + self.ticksPerSecond = 1 self.gameSecondsPerTick = 1 # Physics data @@ -72,12 +74,23 @@ def __init__( self, amountOfCharacters ): for i in range(amountOfCharacters): self.characters.insert( 0, Character( i, self, 'random' ) ) - self.objects.insert( 0, Bed( 0, -7, -7, 0 ) ) - self.objects.insert( 1, Cooker( 1, 1, 1, 0 ) ) - self.objects.insert( 2, Refrigerator( 2, 5, 5, 0 ) ) - self.objects.insert( 3, Toilet( 3, 10, 10, 0 ) ) - self.objects.insert( 4, Shower( 4, 7, 3, 0 ) ) - self.objects.insert( 5, TvSet( 5, 10, -2, 0 ) ) + self.typeMap.insert( 0, [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ) + self.typeMap.insert( 1, [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ) + self.typeMap.insert( 2, [ 0, 3, 3, 3, 3, 0, 0, 0, 0, 0 ] ) + self.typeMap.insert( 3, [ 0, 3, 3, 3, 3, 0, 0, 0, 0, 0 ] ) + self.typeMap.insert( 4, [ 0, 3, 3, 3, 3, 0, 0, 0, 0, 0 ] ) + self.typeMap.insert( 5, [ 0, 2, 2, 2, 2, 4, 4, 0, 0, 0 ] ) + self.typeMap.insert( 6, [ 0, 2, 2, 2, 2, 4, 4, 4, 0, 0 ] ) + self.typeMap.insert( 7, [ 0, 2, 2, 2, 2, 4, 4, 4, 0, 0 ] ) + self.typeMap.insert( 8, [ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 ] ) + self.typeMap.insert( 9, [ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 ] ) + + self.objects.insert( 0, Bed( 0, 3, 2, 0 ) ) + self.objects.insert( 1, Cooker( 1, 7, 2, 0 ) ) + self.objects.insert( 2, Refrigerator( 2, 6, 2, 0 ) ) + self.objects.insert( 3, Toilet( 3, 8, 8, 0 ) ) + self.objects.insert( 4, Shower( 4, 7, 7, 0 ) ) + self.objects.insert( 5, TvSet( 5, 6, 5, 0 ) ) def processTime( self ): # Process the game time. @@ -129,23 +142,22 @@ def processGravity( self ): else: object.pos[2] = 0 - def run( self ): - while( self.gameDay <= 7 ): - os.system('clear') + def run( self, treadPool ): + while( self.server.stop != True ): + # os.system('clear') self.processTime() # self.processGravity() - print '\033[32mInfo\033[0m World\tGame date: %i-%i-%i\tGame time: %i:%i:%i' % ( self.gameYear, self.gameMonth, self.gameDay, self.gameHour, self.gameMinute, self.gameSecond ) + # print '\033[32mInfo\033[0m World\tGame date: %i-%i-%i\tGame time: %i:%i:%i' % ( self.gameYear, self.gameMonth, self.gameDay, self.gameHour, self.gameMinute, self.gameSecond ) for character in self.characters: character.decreaseNeeds() character.processActivity() - print '\033[32mInfo\033[0m Character %i, %s:' % ( character.id, character.gender ) - print '\033[32mInfo\033[0m Pos: %i %i %i\tDestination: %i %i %i' % ( character.pos[ 0 ], character.pos[ 1 ], character.pos[ 2 ], character.destination[ 0 ], character.destination[ 1 ], character.destination[ 2 ] ) - print '\033[32mInfo\033[0m Sleep: %i\tFood: %i\tWater: %i\tUrination: %i' % ( character.needs[ 'sleep' ], character.needs[ 'food' ], character.needs[ 'water' ], character.needs[ 'urination' ] ) - print '\033[32mInfo\033[0m Hygiene: %i\tFun: %i\tSocial: %i' % ( character.needs[ 'hygiene' ], character.needs[ 'fun' ], character.needs[ 'social' ] ) - print '\033[32mInfo\033[0m Activity: %s (%i game seconds left)' % ( character.brain.activity, character.brain.activityTimer ) - try: - print '\033[32mInfo\033[0m Interactive: %i\tType: %s' % ( character.brain.activityInteractive.id, character.brain.activityInteractiveTypes[ character.brain.activity ] ) - except: - print '\033[31mError\033[0m Character %i: Interactive does not exist.' % ( character.id ) + # print '\033[32mInfo\033[0m Character %i, %s:' % ( character.id, character.gender ) + # print '\033[32mInfo\033[0m Pos: %i %i %i\tDestination: %i %i %i' % ( character.pos[ 0 ], character.pos[ 1 ], character.pos[ 2 ], character.destination[ 0 ], character.destination[ 1 ], character.destination[ 2 ] ) + # print '\033[32mInfo\033[0m Sleep: %i\tFood: %i\tWater: %i\tUrination: %i' % ( character.needs[ 'sleep' ], character.needs[ 'food' ], character.needs[ 'water' ], character.needs[ 'urination' ] ) + # print '\033[32mInfo\033[0m Hygiene: %i\tFun: %i\tSocial: %i' % ( character.needs[ 'hygiene' ], character.needs[ 'fun' ], character.needs[ 'social' ] ) + # print '\033[32mInfo\033[0m Activity: %s (%i game seconds left)' % ( character.brain.activity, character.brain.activityTimer ) + # try: + # print '\033[32mInfo\033[0m Interactive: %i\tType: %s' % ( character.brain.activityInteractive.id, character.brain.activityInteractiveTypes[ character.brain.activity ] ) + # except: + # print '\033[31mError\033[0m Character %i: Interactive does not exist.' % ( character.id ) sleep( 1 / self.ticksPerSecond ) -