]>
git.itanic.dy.fi Git - sdl-planets/log
Timo Kokkonen [Mon, 7 Feb 2011 19:58:14 +0000 (21:58 +0200)]
Merge branch 'master' into dirty_work
Conflicts:
planet.c
quadtree.c
Timo Kokkonen [Mon, 7 Feb 2011 18:33:09 +0000 (20:33 +0200)]
Makefile: Better output beautifier
This is better code and makes prettier output
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Thu, 3 Feb 2011 20:10:15 +0000 (22:10 +0200)]
Makefile: More advanced dependency tracking
Inspired by: http://mad-scientist.net/make/autodep.html#norule
Ensure that dependency tracking does not get confused even if some
dependencies (header files for example) are renamed or deleted.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 24 Dec 2010 21:11:08 +0000 (23:11 +0200)]
planet.c: merge_planet: Keep quadtree spatially sorted
If we move planet in the quadtree, we must call quadtree_move() in
order to keep the tree sorted. As the tree ordering might change, the
merge planet must also return the possibly new parent node of the
tree.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 24 Dec 2010 21:03:46 +0000 (23:03 +0200)]
planet.c: Use the quadtree_move function from quadtree lib
This will remove the duplicate functionality from the planet.c
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 24 Dec 2010 20:27:35 +0000 (22:27 +0200)]
quadtree: Add quadtree_move() function
This function will do necessary steps to keep the tree in correct
spatial order when a node is moved.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 24 Dec 2010 20:23:23 +0000 (22:23 +0200)]
quadtree: Fix compiler warnings
quadtree.c:370: warning: unused variable ‘ret’
Trivial remove
quadtree.c: In function ‘quadtree_find_nearest’:
quadtree.c:369: warning: ‘distance’ may be used uninitialized in this function
This variable will not be used uninitialized, but the compiler warning
is trivial to fix with simply initializing the variable with zero.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 7 Dec 2010 20:13:46 +0000 (22:13 +0200)]
quadtree: Implement proper rebalancing
Select nodes in predetermined spatial order that will produce well
balanced tree.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 7 Dec 2010 20:07:55 +0000 (22:07 +0200)]
quadtree: validator: Catch missing leaf node
This patch will make the validator to catch error when a leaf node has
a pointer to a parent which does not have pointer back to the leaf
node.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 7 Dec 2010 20:06:17 +0000 (22:06 +0200)]
quadtree: tree validator: Add spatial validation
This will catch errors when the tree is not in spatial order.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 7 Dec 2010 19:57:00 +0000 (21:57 +0200)]
quadtree.c: Print line number when trap is caught
This helps debugging
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 7 Dec 2010 18:20:57 +0000 (20:20 +0200)]
quadtree.c: Compare vectors, not quadtrees
Factor out the vector comparison into a separate function. That way it
is more useful if plain vector comparison is needed.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 6 Dec 2010 09:09:36 +0000 (11:09 +0200)]
Makefile: Reduce wildcard usage
Having wildcards in the Makefile is error prone in situations where
there are unrelated files in the source tree that are not related to
the actual project. For example, if some source files have been
renamed and there are leftover .*.o.d files that still contain the old
source files. Then make will incorrectly determine that some old files
would still be needed even though they are not part of the project any
more.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Wed, 17 Nov 2010 20:36:11 +0000 (22:36 +0200)]
Make the tree gravitation calculation work better
Timo Kokkonen [Wed, 17 Nov 2010 16:45:55 +0000 (18:45 +0200)]
planet.c: Always remove the smallest planet
As we are not allowed to just move nodes in the quadtree (that might
lead crossing of branch boundaries), we will try to only remove the
smaller planet and add everything else to the larger planet.
Timo Kokkonen [Wed, 17 Nov 2010 16:45:00 +0000 (18:45 +0200)]
Remove explicit debug prints
Timo Kokkonen [Tue, 16 Nov 2010 20:52:48 +0000 (22:52 +0200)]
Does not appear to crash anymore
Timo Kokkonen [Tue, 16 Nov 2010 17:59:39 +0000 (19:59 +0200)]
Some different approach..
Timo Kokkonen [Sun, 14 Nov 2010 20:14:48 +0000 (22:14 +0200)]
Refactor and debug
Timo Kokkonen [Sun, 14 Nov 2010 17:34:01 +0000 (19:34 +0200)]
some more debug
Timo Kokkonen [Sat, 6 Nov 2010 15:36:03 +0000 (17:36 +0200)]
A lot of fixes here and there
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Wed, 3 Nov 2010 20:21:47 +0000 (22:21 +0200)]
Add debug and improve tree validation
Timo Kokkonen [Wed, 3 Nov 2010 16:23:55 +0000 (18:23 +0200)]
quadtree.c: Fix a lot of bugs
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 2 Nov 2010 16:59:07 +0000 (18:59 +0200)]
Optimized quadtree, non-working version
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 31 Oct 2010 09:18:19 +0000 (11:18 +0200)]
Merge branch 'master' into HEAD
Conflicts:
main.c
planet.c
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 31 Oct 2010 09:03:36 +0000 (11:03 +0200)]
Merge branch 'master' of git://itanic.dy.fi/sdl-planets
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 30 Oct 2010 18:56:59 +0000 (21:56 +0300)]
Move quadtree comparison code inside quadtree.c
The .compare function can also be removed now from the quadtree_ops
structure.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 30 Oct 2010 16:57:19 +0000 (19:57 +0300)]
Move position vector from planet to quadtree
Moving the position information inside the quadtree structure will
make it eventually much easier to do varios tree operations within the
quadtree code. Most of the quadtree callback functions can be moved
inside the quadtree code. This patch implements just the first part of
the change, moving the coordinates inside quadtree.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 28 Sep 2010 16:04:57 +0000 (19:04 +0300)]
quadtree: Suppress compiler warning
Use correct printf arguments
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 13 Jun 2010 16:07:14 +0000 (19:07 +0300)]
main.c: Use getopt_long() for reading cmd line arguments
This makes it easier to read various different command line arguments.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 13 Jun 2010 13:04:57 +0000 (16:04 +0300)]
main.c: Skip simulation when time step is zero
When user has set the simulation speed to zero, there is no need to
run the simulation at all, as it won't be changing anyway. This makes
it possible to run excessively large simulations and occassionally
freeze the simulation. Then, for example, inspecting the tree topology
(if draw_lines variable is enabled) becomes easier without need to
worry about slow camera movement.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 4 Jun 2010 06:46:11 +0000 (09:46 +0300)]
does not crash anymore
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 23 May 2010 15:16:34 +0000 (18:16 +0300)]
Continuing..
Timo Kokkonen [Tue, 18 May 2010 16:50:28 +0000 (19:50 +0300)]
Work in proggress, will crash and burn
Esko Kokkonen [Sat, 1 May 2010 14:23:23 +0000 (17:23 +0300)]
merge_planets: Calculate new color for the remaining planet
Timo Kokkonen [Sat, 24 Apr 2010 20:15:17 +0000 (23:15 +0300)]
Another optimization try..
Timo Kokkonen [Sat, 24 Apr 2010 13:35:28 +0000 (16:35 +0300)]
Merge branch 'master' into work
Conflicts:
planet.c
planet.h
quadtree.c
Timo Kokkonen [Sat, 24 Apr 2010 11:00:49 +0000 (14:00 +0300)]
quadtree: Try to keep the tree in better balance.
When a tree node is removed, we now attempt to add the detached
subtree in more optimized order to the new tree. This is done so that
we walk down the detached tree and add a new node to the main tree
always when the tree is one quarter'th smaller than the previous node
that was added.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 24 Apr 2010 10:59:14 +0000 (13:59 +0300)]
quadtree_add: Zero child pointers when a new node is added
Since we don't support adding an entire subtree, it is better to zero
out the child pointers to ensure there are no leftover child nodes
that might corrupt the tree integrity.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 24 Apr 2010 10:48:12 +0000 (13:48 +0300)]
quadtree.c: Improve debuggin capabilities
-Flush out prints immedeatly. This will ensure prints get out even
though execution is halted to a breakpoint.
-Add some extra debug messages
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 24 Apr 2010 10:34:08 +0000 (13:34 +0300)]
Better optimization perhaps
Timo Kokkonen [Mon, 19 Apr 2010 09:04:23 +0000 (12:04 +0300)]
continuing..
Timo Kokkonen [Sun, 18 Apr 2010 10:26:31 +0000 (13:26 +0300)]
poll_events: Add support for stopping the simulation
This makes it possible to for example inspect the tree structure in a
stopped simulation.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 18 Apr 2010 10:24:56 +0000 (13:24 +0300)]
move_planet: Optimize the tree topology change detection
This change avoids repositioning unnecessary the nodes within the
tree.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 18 Apr 2010 08:49:25 +0000 (11:49 +0300)]
planet.c: Add support for drawing the planet tree structure
A line will be drawn from a planet parent to the child node. Local
variable is used to enable line drawing at compile time.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 17 Apr 2010 15:28:56 +0000 (18:28 +0300)]
Optimization, work in proggress..
Timo Kokkonen [Sat, 17 Apr 2010 14:16:44 +0000 (17:16 +0300)]
draw_planet: Add support for drawing the tree area
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 17 Apr 2010 14:11:59 +0000 (17:11 +0300)]
planet.c: Make line drawing conditional
Timo Kokkonen [Sat, 17 Apr 2010 13:50:24 +0000 (16:50 +0300)]
When repositioning a subtree, move nodes in random order
Timo Kokkonen [Wed, 14 Apr 2010 17:15:05 +0000 (20:15 +0300)]
Revert "Revert "Revert "Try to optimze"""
This reverts commit
df41bc01e2d3ffd9be2bfba023c97c5aabcefc4e .
Timo Kokkonen [Wed, 14 Apr 2010 17:13:09 +0000 (20:13 +0300)]
Revert "Draw also the area planet tree affects"
This reverts commit
d2cff17ba1c765f580a23be9da2236648a0f6586 .
Timo Kokkonen [Wed, 14 Apr 2010 16:57:01 +0000 (19:57 +0300)]
oops, fix bug..
Timo Kokkonen [Tue, 13 Apr 2010 17:18:11 +0000 (20:18 +0300)]
draw_planet: Separate circle drawing into its own function
It is easier to draw circles elsewhere in the code if the circle
drawing is separated.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 12 Apr 2010 17:31:57 +0000 (20:31 +0300)]
quadtree: quadtree_del: Fix tree integrity bug
When a root node is deleted and new tree is built under the new root,
the new root node needs to have its parent set to null.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 11 Apr 2010 16:16:18 +0000 (19:16 +0300)]
planet: Add tree statistics
The total mass and area of the subtree tree is calculated.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 11 Apr 2010 16:14:57 +0000 (19:14 +0300)]
quadtree: Allow updating other than just quadtree stats
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 11 Apr 2010 15:05:13 +0000 (18:05 +0300)]
Introduce struct quadree_ops
Store all related function pointers (so far only the comparison) in
one structure. This will make it easier to add function pointers that
are needed in various quadtree operations.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 13 Apr 2010 17:26:31 +0000 (20:26 +0300)]
Draw also the area planet tree affects
Timo Kokkonen [Tue, 13 Apr 2010 17:18:11 +0000 (20:18 +0300)]
Separate circle drawing into its own function
Timo Kokkonen [Tue, 13 Apr 2010 17:00:48 +0000 (20:00 +0300)]
Revert "Revert "Try to optimze""
This reverts commit
1ae3efb2dde3e86ab4cfcbaea15222ab65389787 .
Timo Kokkonen [Tue, 13 Apr 2010 17:00:38 +0000 (20:00 +0300)]
Remove excess status prints
Timo Kokkonen [Tue, 13 Apr 2010 17:00:21 +0000 (20:00 +0300)]
Optimize tree handling
Timo Kokkonen [Mon, 12 Apr 2010 18:16:20 +0000 (21:16 +0300)]
Draw lines
Timo Kokkonen [Mon, 12 Apr 2010 17:33:33 +0000 (20:33 +0300)]
main.c: Prune planets correctly
Timo Kokkonen [Mon, 12 Apr 2010 17:32:39 +0000 (20:32 +0300)]
Print different stats
Timo Kokkonen [Mon, 12 Apr 2010 17:31:57 +0000 (20:31 +0300)]
quadtree: Fix bugs
Timo Kokkonen [Mon, 12 Apr 2010 15:54:08 +0000 (18:54 +0300)]
Revert "Try to optimze"
This reverts commit
66ec6620125badde86f08fabb0a99226da922ee6 .
Conflicts:
quadtree.c
Timo Kokkonen [Sun, 11 Apr 2010 18:27:44 +0000 (21:27 +0300)]
some more stuff
Timo Kokkonen [Sun, 11 Apr 2010 17:38:41 +0000 (20:38 +0300)]
Crash and burn
Timo Kokkonen [Sun, 11 Apr 2010 16:16:18 +0000 (19:16 +0300)]
planet: Add tree statistics
The total mass and area of the subtree tree is calculated.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 11 Apr 2010 16:14:57 +0000 (19:14 +0300)]
quadtree: Allow updating other than just quadtree stats
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 11 Apr 2010 15:05:13 +0000 (18:05 +0300)]
Introduce struct quadree_ops
Store all related function pointers (so far only the comparison) in
one structure. This will make it easier to add function pointers that
are needed in various quadtree operations.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 11 Apr 2010 09:32:20 +0000 (12:32 +0300)]
Try to optimze
Timo Kokkonen [Sun, 11 Apr 2010 09:20:18 +0000 (12:20 +0300)]
Merge branch 'master' into work
Timo Kokkonen [Sun, 11 Apr 2010 09:20:15 +0000 (12:20 +0300)]
sync with master
Timo Kokkonen [Sun, 11 Apr 2010 09:18:59 +0000 (12:18 +0300)]
quadtree: Fix minor coding convention issue
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 11 Apr 2010 09:13:55 +0000 (12:13 +0300)]
planet.c: Optimize moving of planets within thetree
If there is no changes in the tree topology when a planet is moved,
there is no need to do any tree operations. This will decrease tree
maintenance overhead especially with large trees.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 11 Apr 2010 09:12:29 +0000 (12:12 +0300)]
Seems to be working..
Timo Kokkonen [Sat, 10 Apr 2010 19:41:23 +0000 (22:41 +0300)]
move_planet: Remove debug code
This was not supposed to be there after debugging was finished.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 10 Apr 2010 19:40:53 +0000 (22:40 +0300)]
continuing..
Timo Kokkonen [Sat, 10 Apr 2010 18:36:19 +0000 (21:36 +0300)]
Crash and burn
Timo Kokkonen [Sat, 10 Apr 2010 14:42:19 +0000 (17:42 +0300)]
main.c: Print tree statistics
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 10 Apr 2010 14:39:07 +0000 (17:39 +0300)]
quadtree: Collect tree statistics
Tree depth and child count is collected and kept up to date.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 10 Apr 2010 14:38:31 +0000 (17:38 +0300)]
Merge branch 'master' into work
Timo Kokkonen [Sat, 10 Apr 2010 14:32:34 +0000 (17:32 +0300)]
Stats appear to be working
Timo Kokkonen [Sat, 10 Apr 2010 11:49:31 +0000 (14:49 +0300)]
main.c: Do not allow creating zero planets
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Thu, 8 Apr 2010 19:37:06 +0000 (22:37 +0300)]
add stats, incomplete..
Timo Kokkonen [Thu, 8 Apr 2010 19:36:06 +0000 (22:36 +0300)]
Makefile: Enable DEBUG definition in debug build
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Thu, 8 Apr 2010 16:50:24 +0000 (19:50 +0300)]
quadtree: Fix style issues
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Thu, 8 Apr 2010 16:46:44 +0000 (19:46 +0300)]
main.c: Use quadtrees to draw only visible planets
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Thu, 8 Apr 2010 16:45:12 +0000 (19:45 +0300)]
planets: Add support for spatial search from quadtree
This can be used to for example draw only visible planets on the
screen.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Thu, 8 Apr 2010 16:43:01 +0000 (19:43 +0300)]
planets: Add quadtrees in use
The tree is used and kept sorted, but it is not used for anything
useful yet.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Thu, 8 Apr 2010 16:34:41 +0000 (19:34 +0300)]
Merge branch 'master' into quadtree
Timo Kokkonen [Thu, 8 Apr 2010 16:23:24 +0000 (19:23 +0300)]
quadtree: Pass quadtree iterator structure to the callback functions
This is better than plain void pointer, since now the iterator can be
embedded as part of some other struct. This simplifies the design.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 16:43:42 +0000 (19:43 +0300)]
.gitignore: Add debug-planet
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 16:43:24 +0000 (19:43 +0300)]
Makefile: Add debug-planet to the clean target
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 16:41:40 +0000 (19:41 +0300)]
Makefile: rename debug target to obey naming convention
The main target is called sdl-planet, so the debug target should be
called then as debug-planet.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 16:36:45 +0000 (19:36 +0300)]
Merge branch 'master' of git://itanic.dy.fi/sdl-planets
Timo Kokkonen [Mon, 5 Apr 2010 16:33:53 +0000 (19:33 +0300)]
main loop: Fade correctly when simulation runs fast
There was a bug that buffer fade amount was relative to the time it
took to run one simulation step, not relatively to the time interval
between two drawn frame. This patch fixes the issue.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 13:14:57 +0000 (16:14 +0300)]
quadtree: Obey naming conventions
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>