From: <ob...@us...> - 2007-01-15 19:32:26
|
Revision: 40 http://eos-game.svn.sourceforge.net/eos-game/?rev=40&view=rev Author: oberon7 Date: 2007-01-15 11:32:23 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Fixed circular module dependencies by moving sprite imports inside of game.init() Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-01-15 18:44:32 UTC (rev 39) +++ game.py 2007-01-15 19:32:23 UTC (rev 40) @@ -10,11 +10,6 @@ import ode import pygame from pygame.locals import * -from ai import AI -from player import Player -from stars import StarField -from staticbody import Planet -from sprite import RenderedGroup fps = 32 # Desired fps avg_fps = fps # Running average of actual fps @@ -33,6 +28,11 @@ ai = None def init(fullscreen=True): + from sprite import RenderedGroup + from ai import AI + from player import Player + from stars import StarField + from staticbody import Planet global universe, screen, background, sprites global fps, avg_fps, clock, time, player, camera, ai # Initialize pygame and setup main screen @@ -61,7 +61,7 @@ camera = player = Player() camera.rect.center = screen.get_rect().center camera.zoom = 1 - ai = [AI(player) for i in xrange(random.randint(3,9))] + ai = [AI(player) for i in xrange(random.randint(5,9))] def handle_events(): for event in pygame.event.get(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-01-16 09:46:31
|
Revision: 48 http://eos-game.svn.sourceforge.net/eos-game/?rev=48&view=rev Author: cduncan Date: 2007-01-16 01:46:30 -0800 (Tue, 16 Jan 2007) Log Message: ----------- Remove unused declarations Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-01-16 09:20:56 UTC (rev 47) +++ game.py 2007-01-16 09:46:30 UTC (rev 48) @@ -21,11 +21,6 @@ # Sprite groups sprites = None # All sprites -# Collision spaces -friend_space = None # Player and friends -neutral_space = None # For and against no one -foe_space = None # You looking at me? - # Other globally accessible things clock = None time = 0 # milliseconds since game began This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-02-06 10:41:26
|
Revision: 76 http://eos-game.svn.sourceforge.net/eos-game/?rev=76&view=rev Author: cduncan Date: 2007-02-06 02:41:23 -0800 (Tue, 06 Feb 2007) Log Message: ----------- In fullscreen mode, pick a resolution between 700 and 800 pixels tall and landscape if possible. Also explicitly request 16bpp. Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-02-06 03:47:26 UTC (rev 75) +++ game.py 2007-02-06 10:41:23 UTC (rev 76) @@ -17,6 +17,7 @@ universe = None # ode world collision_space = None # ode collision space screen = None # pygame screen +screen_rect = None # screen rectangle background = None # background surface # Sprite groups @@ -37,16 +38,24 @@ from staticbody import Planet from vessel import Vessel, KeyboardControl from ai import AIVessel - global universe, collision_space, screen, background, sprites - global fps, avg_fps, clock, time, player, camera, ai + global universe, collision_space, screen, screen_rect, background + global sprites, fps, avg_fps, clock, time, player, camera, ai # Initialize pygame and setup main screen pygame.init() # Get the available display modes and use the best one if fullscreen: modes = pygame.display.list_modes() - screen = pygame.display.set_mode(modes[0], FULLSCREEN) + # Choose the first mode with a height between 700 and 800 px + for mode in modes: + if 700 <= mode[1] <= 800 and mode[0] > mode[1]: + break + else: + mode = modes[1] + print "Could not find ideal display mode, using", mode + screen = pygame.display.set_mode(mode, FULLSCREEN, 16) else: screen = pygame.display.set_mode((1024, 768)) + screen_rect = screen.get_rect() pygame.display.set_caption('Eos') background = pygame.Surface(screen.get_size()) background.fill((0,0,0)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-02-09 08:29:52
|
Revision: 89 http://eos-game.svn.sourceforge.net/eos-game/?rev=89&view=rev Author: cduncan Date: 2007-02-09 00:29:49 -0800 (Fri, 09 Feb 2007) Log Message: ----------- Randomize initial locations, make the number of each ai ship deterministic Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-02-09 07:58:08 UTC (rev 88) +++ game.py 2007-02-09 08:29:49 UTC (rev 89) @@ -77,13 +77,15 @@ camera.zoom = 1 # Create AI - for i in range(5): - ship = netsync.choice(['vessels/naree/cress', 'vessels/naree/lotus']) - ai = AIVessel.load(ship, target=player) - ai.position.x, ai.position.y = netsync.randint(-1000*i, 1000*i), netsync.randint(-1000*i,1000*i) + for i in range(3): + ai = AIVessel.load('vessels/naree/cress', target=player) + ai.position.x, ai.position.y = netsync.randint(-1000, 1000), netsync.randint(-1000,1000) + for i in range(2): + ai = AIVessel.load('vessels/naree/lotus', target=player) + ai.position.x, ai.position.y = netsync.randint(-1000, 1000), netsync.randint(-1000,1000) for i in range(8): ai = AIVessel.load('vessels/naree/gnat', target=player) - ai.position.x, ai.position.y = netsync.randint(-1000*i, 1000*i), netsync.randint(-1000*i,1000*i) + ai.position.x, ai.position.y = netsync.randint(-1000, 1000), netsync.randint(-1000,1000) # Establish networking server = netsync.Server() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-02-11 19:42:02
|
Revision: 103 http://eos-game.svn.sourceforge.net/eos-game/?rev=103&view=rev Author: cduncan Date: 2007-02-11 11:41:58 -0800 (Sun, 11 Feb 2007) Log Message: ----------- Hide mouse cursor in fullscreen mode Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-02-11 02:50:11 UTC (rev 102) +++ game.py 2007-02-11 19:41:58 UTC (rev 103) @@ -78,6 +78,9 @@ camera.rect.center = screen.get_rect().center camera.zoom = 1 + if fullscreen: + pygame.mouse.set_visible(False) + # Create AI for i in range(3): ai = AIVessel.load('vessels/naree/cress', target=players[i % len(players)]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ob...@us...> - 2007-02-13 08:49:46
|
Revision: 109 http://eos-game.svn.sourceforge.net/eos-game/?rev=109&view=rev Author: oberon7 Date: 2007-02-13 00:49:45 -0800 (Tue, 13 Feb 2007) Log Message: ----------- AI is released in escalating waves. Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-02-13 08:11:00 UTC (rev 108) +++ game.py 2007-02-13 08:49:45 UTC (rev 109) @@ -13,6 +13,7 @@ fps = 32 # Desired fps avg_fps = fps # Running average of actual fps +ai_interval = 60 # Release AI every N seconds universe = None # ode world collision_space = None # ode collision space screen = None # pygame screen @@ -28,7 +29,6 @@ frame_no = 0 # current frame number players = None camera = None -ai = None def init(run_server=False, game_id=None, host='127.0.0.1', port='11211', player_count=1, fullscreen=False): import body @@ -36,7 +36,6 @@ from stars import StarField from staticbody import Planet from vessel import Vessel, KeyboardControl - from ai import AIVessel from media import load_image global universe, collision_space, screen, screen_rect, background global sprites, fps, avg_fps, clock, time, players, camera, ai @@ -83,17 +82,6 @@ if fullscreen: pygame.mouse.set_visible(False) - # Create AI - for i in range(3): - ai = AIVessel.load('vessels/naree/cress', target=players[i % len(players)]) - ai.position.x, ai.position.y = netsync.random.randint(-1000, 1000), netsync.random.randint(-1000,1000) - for i in range(2): - ai = AIVessel.load('vessels/naree/lotus', target=players[i % len(players)]) - ai.position.x, ai.position.y = netsync.random.randint(-1000, 1000), netsync.random.randint(-1000,1000) - for i in range(8): - ai = AIVessel.load('vessels/naree/gnat', target=players[i % len(players)]) - ai.position.x, ai.position.y = netsync.random.randint(-1000, 1000), netsync.random.randint(-1000,1000) - def handle_events(): for event in pygame.event.get(): if event.type == QUIT or ( @@ -133,8 +121,10 @@ raise def play(): + from ai import AIVessel global universe, collision_space, screen, background global sprites, fps, avg_fps, clock, time, frame_no + global ai_interval while handle_events(): netsync.send_keystate(frame_no, pygame.key.get_pressed()) # send early collision_space.collide(None, check_collision) @@ -143,9 +133,22 @@ dirty = sprites.draw(screen) pygame.display.update(dirty) pygame.display.flip() - #universe.quickStep(1.0 / avg_fps) # actual FPS universe.quickStep(1.0 / fps) # target FPS time += clock.tick(fps) avg_fps = clock.get_fps() or fps netsync.step(frame_no) # retrieve late, after clock.tick throttle + if (frame_no % (fps * ai_interval)) == 0: + target = netsync.random.choice(players) + x = target.position.x + netsync.random.randint(-1000, 1000) + y = target.position.y + netsync.random.randint(-1000, 1000) + for i in xrange(1): + ai = AIVessel.load('vessels/naree/lotus', target=target) + ai.position.x, ai.position.y = x, y + for i in xrange(2): + ai = AIVessel.load('vessels/naree/cress', target=target) + ai.position.x, ai.position.y = x, y + for i in xrange(4): + ai = AIVessel.load('vessels/naree/gnat', target=target) + ai.position.x, ai.position.y = x, y + ai_interval = max(ai_interval * .9, 5) frame_no += 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-03-21 00:12:28
|
Revision: 144 http://eos-game.svn.sourceforge.net/eos-game/?rev=144&view=rev Author: cduncan Date: 2007-03-20 15:45:39 -0700 (Tue, 20 Mar 2007) Log Message: ----------- Spawn warships less often. Builds the battle up more slowly Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-03-20 22:35:56 UTC (rev 143) +++ game.py 2007-03-20 22:45:39 UTC (rev 144) @@ -151,7 +151,7 @@ position = vector.Vector2D.unit(netsync.random.random() * vector.fullcircle) * 1000 x = target.position.x + position.x y = target.position.y + position.y - warship = netsync.random.random() * frame_no > 400 + warship = netsync.random.random() * frame_no > 800 if warship: ai = AIVessel.load('vessels/naree/lotus') ai.position.x, ai.position.y = x, y @@ -159,7 +159,7 @@ barrier = 300 friendly = warship while friendly or netsync.random.random() * frame_no > barrier: - if netsync.random.random() * frame_no < barrier * 4: + if netsync.random.random() * frame_no < barrier * 6: ship = 'vessels/rone/drach' else: ship = 'vessels/rone/draken' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-04-25 05:46:20
|
Revision: 188 http://eos-game.svn.sourceforge.net/eos-game/?rev=188&view=rev Author: cduncan Date: 2007-04-24 22:46:19 -0700 (Tue, 24 Apr 2007) Log Message: ----------- oops, set initial frame_no back to zero Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-04-25 05:21:43 UTC (rev 187) +++ game.py 2007-04-25 05:46:19 UTC (rev 188) @@ -31,7 +31,7 @@ # Other globally accessible things clock = None time = 0 # milliseconds since game began -frame_no = 5000 # current frame number +frame_no = 0 # current frame number frame_lag = 0 # expected number of lag frames players = None local_player = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-05-05 17:32:08
|
Revision: 217 http://eos-game.svn.sourceforge.net/eos-game/?rev=217&view=rev Author: cduncan Date: 2007-05-05 10:32:03 -0700 (Sat, 05 May 2007) Log Message: ----------- Fix typoo Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-05-05 17:29:29 UTC (rev 216) +++ game.py 2007-05-05 17:32:03 UTC (rev 217) @@ -171,7 +171,7 @@ stars.kill() for ship_choice in ships: ship_choice.kill() - timw = 0 + time = 0 # Establish networking players, local_player = netsync.init( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-06-10 07:42:53
|
Revision: 230 http://eos-game.svn.sourceforge.net/eos-game/?rev=230&view=rev Author: cduncan Date: 2007-06-10 00:42:50 -0700 (Sun, 10 Jun 2007) Log Message: ----------- Make waves a bit more fair, fix bug where friendly fleet could grow larger than max fleet size Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-05-27 18:18:40 UTC (rev 229) +++ game.py 2007-06-10 07:42:50 UTC (rev 230) @@ -271,9 +271,11 @@ ai = AIVessel.load('vessels/naree/lotus') ai.set_position(target.position + position) enemies.add(ai) + else: + warship = False barrier = 300 friendly = warship - while (friendly or netsync.random.random() * frame_no > barrier + while ((friendly or netsync.random.random() * frame_no > barrier) and len(friends) < max_fleet_size): if netsync.random.random() * frame_no < barrier * 6: if target_race == 'rone': @@ -290,7 +292,7 @@ friends.add(friend) barrier *= 2 friendly = False - barrier = 200 + barrier = 300 while len(enemies) < max_fleet_size: if warship and netsync.random.random() * frame_no < barrier: break This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-10-03 08:03:39
|
Revision: 277 http://eos-game.svn.sourceforge.net/eos-game/?rev=277&view=rev Author: cduncan Date: 2007-10-03 01:03:36 -0700 (Wed, 03 Oct 2007) Log Message: ----------- Fill the entire screen black before each frame rather than clearing the sprites. This makes things smoother especially with lots of particles on the screen, since it always takes the same amount of time regardless of the number of sprites. Since particles are sprites this helps a lot when there are lots of particles on screen. Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-10-02 03:39:52 UTC (rev 276) +++ game.py 2007-10-03 08:03:36 UTC (rev 277) @@ -18,6 +18,7 @@ import vector import vessel import message +import particle fps = 40 # Framerate, averaged over time ai_interval = 70 # Release AI every N seconds @@ -265,13 +266,12 @@ # sprites group and draw them from here on out sprites.add(new_sprites) new_sprites.empty() - sprites.clear(screen, background) + screen.fill((0, 0, 0)) ui_sprites.update() sprites.update() camera.update() dirty = sprites.draw(screen) ui_sprites.draw(screen) - #pygame.display.update(dirty) pygame.display.flip() universe.quickStep(this_frame_time / 1000.0) if server: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ob...@us...> - 2007-10-18 05:44:49
|
Revision: 298 http://eos-game.svn.sourceforge.net/eos-game/?rev=298&view=rev Author: oberon7 Date: 2007-10-17 22:44:47 -0700 (Wed, 17 Oct 2007) Log Message: ----------- Multiplayer now "works" with waves of AI. Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-10-18 05:30:39 UTC (rev 297) +++ game.py 2007-10-18 05:44:47 UTC (rev 298) @@ -245,8 +245,7 @@ print body.body_count, len(sprite.layers), len(media._scaled_image_cache), fps ## Temporary wave-based game play ## - if not server and not client: - # FIXME: multiplayer doesn't work with non-players yet + if not client: if time > next_wave: target = local_player target_race = target.race This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-10-21 18:35:49
|
Revision: 308 http://eos-game.svn.sourceforge.net/eos-game/?rev=308&view=rev Author: cduncan Date: 2007-10-21 11:35:47 -0700 (Sun, 21 Oct 2007) Log Message: ----------- Add a fixed sleep interval per frame (more if in windowed mode) to even out the framerate especially when other processes are burning lots of cpu (*cough* pandora *cough*). Even though this reduces the maximum framerate possible, it makes things noticably smoother to me overall. Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-10-21 08:57:23 UTC (rev 307) +++ game.py 2007-10-21 18:35:47 UTC (rev 308) @@ -226,6 +226,10 @@ next_wave = 0 this_frame_time = last_frame_time = 1000 / fps event_handler = event.MainHandler([panel.handler]) + if windowed: + sleep_time = 0.01 + else: + sleep_time = 0.0015 while 1: event_handler.handle_events() keystate = pygame.key.get_pressed() @@ -243,8 +247,7 @@ server.step() last_time = time time += clock.tick() - if windowed and time - last_time < 33: - sleep(0.02) + sleep(sleep_time) last_frame_time = this_frame_time this_frame_time = min(time - last_time, last_frame_time * 3) fps = clock.get_fps() or fps This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-12-11 08:40:52
|
Revision: 330 http://eos-game.svn.sourceforge.net/eos-game/?rev=330&view=rev Author: cduncan Date: 2007-12-11 00:40:40 -0800 (Tue, 11 Dec 2007) Log Message: ----------- Set lower-limit of physics speed to 20fps, if the actual frame rate drops below this then the physics will slow, but this is avoids big jumps when an occasional single frame is very slow and generally makes the game less jerky when the framerate varies. Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-11-24 08:18:22 UTC (rev 329) +++ game.py 2007-12-11 08:40:40 UTC (rev 330) @@ -242,7 +242,7 @@ camera.update() sprite.layers.draw(display.surface) pygame.display.flip() - universe.quickStep(clock.get_time() / 1000.0) + universe.quickStep(min(clock.get_time() / 1000.0, 0.05)) if server: server.step() time += clock.tick() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ob...@us...> - 2007-04-29 01:04:34
|
Revision: 198 http://eos-game.svn.sourceforge.net/eos-game/?rev=198&view=rev Author: oberon7 Date: 2007-04-28 18:04:32 -0700 (Sat, 28 Apr 2007) Log Message: ----------- Slightly less tacky (but still tacky) race-based wave releasing. Modified Paths: -------------- game.py Modified: game.py =================================================================== --- game.py 2007-04-29 00:50:10 UTC (rev 197) +++ game.py 2007-04-29 01:04:32 UTC (rev 198) @@ -177,15 +177,17 @@ netsync.step(frame_no - frame_lag) # retrieve late, after clock.tick throttle if time > next_wave: target = netsync.random.choice(players) + target_race = target.race + wave_race = netsync.random.choice([r for r in ['naree', 'rone'] if r != target_race]) if not target.alive(): target = netsync.random.choice(map.planets) position = vector.unit(netsync.random.random() * vector.fullcircle) * 1000 warship = netsync.random.random() * frame_no > 800 if warship and len(enemies) < max_fleet_size: - if local_player.race == 'rone': + if wave_race == 'rone': + ai = AIVessel.load('vessels/rone/draken') + elif wave_race == 'naree': ai = AIVessel.load('vessels/naree/lotus') - else: - ai = AIVessel.load('vessels/rone/draken') ai.set_position(target.position + position) enemies.add(ai) barrier = 300 @@ -193,14 +195,14 @@ while (friendly or netsync.random.random() * frame_no > barrier and len(friends) < max_fleet_size): if netsync.random.random() * frame_no < barrier * 6: - if local_player.race == 'rone': + if target_race == 'rone': ship = 'vessels/rone/drach' - else: + elif target_race == 'naree': ship = 'vessels/naree/cress' else: - if local_player.race == 'rone': + if target_race == 'rone': ship = 'vessels/rone/draken' - else: + elif target_race == 'naree': ship = 'vessels/naree/lotus' friend = AIVessel.load(ship, mothership=target, category=body.friend) friend.set_position(target.position - position) @@ -211,10 +213,10 @@ while len(enemies) < max_fleet_size: if warship and netsync.random.random() * frame_no < barrier: break - if local_player.race == 'rone': + if wave_race == 'rone': + ai = AIVessel.load('vessels/rone/drach') + elif wave_race == 'naree': ai = AIVessel.load('vessels/naree/cress') - else: - ai = AIVessel.load('vessels/rone/drach') ai.set_position(target.position + position) enemies.add(ai) warship = True This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |