Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 53 lines (39 sloc) 2.443 kb
43797aa2 »
2010-03-02 Initial commit
1 //
2 // ASISpaceTimeMap.h
3 // Part of ASIPathFinder --> http://allseeing-i.com/ASIPathFinder
4 //
5 // Created by Ben Copsey on 15/06/2009.
6 // Copyright 2009 All-Seeing Interactive. All rights reserved.
7 //
8 // An ASISpaceTimeMap records the predicted position of objects in the future
9 // When objects plan a route, they record where they think they're going to be at each time step
10 // This allows objects to co-operatively path find - they won't be able to travel to positions that other units have already reserved for that point in time
11 // As game time advances, incrementTime effectively throws away the most recent time step to make space for a future one
12 // In implementation, a space time map is an array of positions on the map, with a new array for each time step
13
14 #import "ASIObjectMap.h"
15
16 @interface ASISpaceTimeMap : ASIObjectMap {
17
1b3d56cd »
2010-03-20 Continue work merging in Space Harvest stuff
18 // Record our positions in the set of time steps we have
19 // When incrementTime is called, we increment this, or reset it to zero if we're at the end of the time span
20 // This allows us to perform path finding part way through the time span
21 unsigned char currentTimeStep;
43797aa2 »
2010-03-02 Initial commit
22
23 }
24
25 // Clears the whole space time map for all time steps
26 - (void)clear;
27
28 // The number of time steps this space time map will hold
29 - (int)timeSpan;
1b3d56cd »
2010-03-20 Continue work merging in Space Harvest stuff
30 - (void)setTimeSpan:(unsigned int)newTimeSpan;
43797aa2 »
2010-03-02 Initial commit
31
32 // Create a new space time map with a map size, and the number of time steps
1b3d56cd »
2010-03-20 Continue work merging in Space Harvest stuff
33 - (id)initWithSize:(CGSize)size timeSpan:(unsigned int)newTimeSpan;
34
35 // Set an object at a position for a certain amount of time
36 - (void)setObject:(id)object atPosition:(CGPoint)position fromTime:(unsigned int)time forTimeSteps:(unsigned int)timeSteps;
37
38 // Remove an object at a position for a certain amount of time
39 - (void)removeObject:(id)object atPosition:(CGPoint)position fromTime:(unsigned int)time forTimeSteps:(unsigned int)timeSteps;
43797aa2 »
2010-03-02 Initial commit
40
41 // Convenience method to set an object at a position for all time steps we're tracking
1b3d56cd »
2010-03-20 Continue work merging in Space Harvest stuff
42 - (void)setObject:(id)object atPositionIndefinitely:(CGPoint)position fromTime:(unsigned int)time;
43797aa2 »
2010-03-02 Initial commit
43
44 // Convenience method to remove an object from a position for all time steps we're tracking
1b3d56cd »
2010-03-20 Continue work merging in Space Harvest stuff
45 - (void)removeObject:(id)object atPositionIndefinitely:(CGPoint)position fromTime:(unsigned int)time;
43797aa2 »
2010-03-02 Initial commit
46
1b3d56cd »
2010-03-20 Continue work merging in Space Harvest stuff
47 // Increment currentTimeStep, and clear the whole map if we're on step 0
43797aa2 »
2010-03-02 Initial commit
48 - (void)incrementTime;
49
50
1b3d56cd »
2010-03-20 Continue work merging in Space Harvest stuff
51 @property (assign, nonatomic) unsigned char currentTimeStep;
43797aa2 »
2010-03-02 Initial commit
52 @property (assign, nonatomic) unsigned char timePointer;
53 @end
Something went wrong with that request. Please try again.