]>
git.itanic.dy.fi Git - sdl-planets/log
Timo Kokkonen [Mon, 5 Apr 2010 13:14:40 +0000 (16:14 +0300)]
quadtree: Suppress compiler warnings
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 13:00:48 +0000 (16:00 +0300)]
quadtree: Only use the validator when debugging is enabled
Timo Kokkonen [Mon, 5 Apr 2010 13:04:13 +0000 (16:04 +0300)]
Merge branch 'master' into quadtree-dev
Timo Kokkonen [Mon, 5 Apr 2010 13:02:38 +0000 (16:02 +0300)]
Makefile: Enable DEBUG definition when debugging
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 12:38:32 +0000 (15:38 +0300)]
create_planets: Initialize also the first planet
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 12:43:43 +0000 (15:43 +0300)]
quadtree: Be more careful when deleting a node from the tree
Before attempting to move nodes back to the main tree, detach the
subtree completely from the main tree. When detaching individual nodes
from the tree, also ensure that each node has its old children
removed.
If these measures are not taken into account, loops will form in the
tree.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 12:43:14 +0000 (15:43 +0300)]
quadtree: Use the validator
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 12:41:39 +0000 (15:41 +0300)]
quadtree: Add a tree validator
This will find some typical erros in the tree and print error messages
when such erros are found.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 09:19:26 +0000 (12:19 +0300)]
quadtree: Implement node removing
Removing a node from a quadtree is a tricky process. The node might
have multiple children which all need to be repositioned in the
remainig tree, which propably requires a recursive recreation of the
entire (sub)tree. If the given node happens to be the root node of the
tree, a new root needs to be selected for the remaining tree.
This kind of tree manipulation might have significant impact on the
balance of the tree. On the contrary, as massive tree reorganization
might be required, this is a good opportunity to rebalance the
(sub)tree. The introduced implementation does not address any
balancing issues at all.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Apr 2010 08:42:15 +0000 (11:42 +0300)]
quadtree: Implement quadtree_find_parent
This helper function simply returns the highest parent of a given
node.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 4 Apr 2010 08:51:47 +0000 (11:51 +0300)]
quadtree: Add missing function definition to the header
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 4 Apr 2010 08:44:10 +0000 (11:44 +0300)]
main.c: Fix a typo in a comment
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Arto Heikkinen [Sun, 4 Apr 2010 07:44:15 +0000 (10:44 +0300)]
create_planets: Modify the for-loop to start from 0.
Timo Kokkonen [Sun, 4 Apr 2010 08:33:59 +0000 (11:33 +0300)]
main.c: Coding convention fixes
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 4 Apr 2010 07:37:42 +0000 (10:37 +0300)]
fade_buf: Allow fading with very small increments
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Esko Kokkonen [Sat, 3 Apr 2010 15:49:06 +0000 (18:49 +0300)]
poll_events: Add predefined time scales
Timo Kokkonen [Sat, 3 Apr 2010 11:17:39 +0000 (14:17 +0300)]
main.c: Fix typo
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 3 Apr 2010 11:12:24 +0000 (14:12 +0300)]
Makefie: Add debug target
This makes debugging with gdb easier, when there is no need to modify
the makefile in order to disable optimizations while debugging.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 3 Apr 2010 10:46:44 +0000 (13:46 +0300)]
Makefile: rename object variables
This used to be a test project..
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 3 Apr 2010 10:02:44 +0000 (13:02 +0300)]
fade_buf: Optimizations
Since most of the buffer is usually black, we can skip the fading
entirely on those words that are already null. Only when the buffer
contains something to fade, individual color values are being
substracted.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 2 Apr 2010 13:19:21 +0000 (16:19 +0300)]
main loop: Add support for tracers
Tracers are a fading trail of the planet's movement.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 2 Apr 2010 12:56:44 +0000 (15:56 +0300)]
Main loop: Suppress a compiler warning
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 2 Apr 2010 12:54:27 +0000 (15:54 +0300)]
Main loop: Collect simulation status variables into a structure
This eases passing of the variables between function since there is no
need to pass that many individual variables.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 2 Apr 2010 09:59:03 +0000 (12:59 +0300)]
setup_planet: Concentrate the mass mostly in the middle of the system
This will increase the stability of the created planetar system. Most
of the central planets collapse into one large object, which will keep
most of the system more stable.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 2 Apr 2010 09:03:37 +0000 (12:03 +0300)]
Makefile: Add missing lib
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Wed, 31 Mar 2010 19:44:23 +0000 (22:44 +0300)]
main loop: Modify debug prints
- Change the ordering of the fields
- Add the counter of the simulation steps
- Flush the stdout buffer out after each print.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Wed, 31 Mar 2010 16:54:29 +0000 (19:54 +0300)]
main loop: Separate simulation time from true time
This allows simulation and other actions, such as camera movements, to
use different time steps. Now camera will move the same speed
regardless of the simulation time (eg. very low fps scenarios).
Furthermore, the maximum time step value is always respected and won't
be exceeded even though user adjusts the simulation speed to higher.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Wed, 31 Mar 2010 16:44:43 +0000 (19:44 +0300)]
main loop: Limit to max 60FPS
Do not even try to draw more than 60FPS. If we have time left, do some
extra simulation steps.
As an extra bonus this patch fixes the timer usage which was broken
since we moved to higher clock resolution.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Wed, 31 Mar 2010 16:42:41 +0000 (19:42 +0300)]
gettime fixes
Return microseconds instead of nanoseconds. Also return value is now
delta from the first call to gettime instead of the absolute value of
the monotonic clock.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 30 Mar 2010 17:30:00 +0000 (20:30 +0300)]
poll_events: Quit when requested to quit
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Tue, 30 Mar 2010 17:24:45 +0000 (20:24 +0300)]
main.c: Switch to microsecond resolution time source
This is needed if the simulation step lenght is very short.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 27 Mar 2010 14:44:06 +0000 (16:44 +0200)]
quadtree: Add support to walk through the tree
An iterator structure can be used to walk only desired parts of the
tree, while the rest of the tree is left untouched.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 27 Mar 2010 08:47:47 +0000 (10:47 +0200)]
quadtree.c: Add a missing include
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 27 Mar 2010 08:30:47 +0000 (10:30 +0200)]
quadtree: Move quadtree_add function in quadtree.c
The function in question is higly recursive. It is not likely the compiler will
be able to optimize it if it is kept in the header file as an inline function.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 26 Mar 2010 21:24:44 +0000 (23:24 +0200)]
Quadtree: Initial commit
Add an initial and very basic form of the quadtree implementation. At
this point there is code only for the actual quadtree structure and a
function for adding nodes into the tree.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 20:36:35 +0000 (22:36 +0200)]
main.c: Make it possible to scale the time step at run time
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 20:13:47 +0000 (22:13 +0200)]
main.c: Add some alternative keys for zooming
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 20:10:12 +0000 (22:10 +0200)]
main.c: Set window caption
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 15:27:28 +0000 (17:27 +0200)]
planet.c: Fix minor style issue
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 15:25:15 +0000 (17:25 +0200)]
random.c: Remove unused label
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 15:15:20 +0000 (17:15 +0200)]
random.c: Close file handles, even on error conditions
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 15:09:59 +0000 (17:09 +0200)]
Fix some compiler warnings
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 15:07:59 +0000 (17:07 +0200)]
main.c: Adjust minimum time step
50fps might be better than 100fps
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 15:07:28 +0000 (17:07 +0200)]
create_planets: Remove unneeded debug print
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 13:29:12 +0000 (15:29 +0200)]
main.c: Define maximum time step
Set it intially to 10ms, which equals to 100fps
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 13:19:23 +0000 (15:19 +0200)]
main.c: Change the command line parameter usage
Allow total mass and the range of the system to be defined from the
command line.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 13:14:48 +0000 (15:14 +0200)]
Generate plantes in a "starsystem" like form
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 13:13:54 +0000 (15:13 +0200)]
random.c: Add support for generating floating point random numbers
This will generate numbers from range [0..1)
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 12:08:18 +0000 (14:08 +0200)]
gravitize_planets: Fix approximation from the gravity equation
This was needed when there was no collosions between the planets and
the planets could "explode" when they got too close to each others.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 11:51:40 +0000 (13:51 +0200)]
draw_planet: Draw circular planets
This looks better than square planets, doh...
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 11:15:18 +0000 (13:15 +0200)]
planet.c: Size of the planet is the planet radius
Thus, rename the 'size' variable to 'radius'.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 11:11:31 +0000 (13:11 +0200)]
main.c: Move event handling in a separate function
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 10:23:05 +0000 (12:23 +0200)]
Make planet initialization independent from the screen size
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 10:19:34 +0000 (12:19 +0200)]
camera: Make moving the camera relative to the zoom level
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 10:15:13 +0000 (12:15 +0200)]
Add support for zooming the camera
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 20 Mar 2010 09:44:49 +0000 (11:44 +0200)]
Move camera initialization in camera.c
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 16:28:11 +0000 (18:28 +0200)]
main.c: Fix minor style issue with the code
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 16:22:25 +0000 (18:22 +0200)]
Implement a moving camera
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 15:48:46 +0000 (17:48 +0200)]
main.c: Make the window resizable
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 15:25:17 +0000 (17:25 +0200)]
main.c: Simplify the list access a bit
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 12:36:47 +0000 (14:36 +0200)]
draw_planet: Use Better size for the drawing the planet
Now the outer dimensions of the planet match to the inner dimensions
of the rectangular. We still don't draw circle planets though..
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 12:35:40 +0000 (14:35 +0200)]
reshape_planet: Better size estimation for the planet
The size is now proprtional to the cubic root of the planet mass.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 12:14:58 +0000 (14:14 +0200)]
main.c: Read some parameters from the command line
The number of planets and screen resolution can be now changed from
the command line parameters.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 12:06:46 +0000 (14:06 +0200)]
merge_planets: Don't move the heavier planet when they are merged
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:59:32 +0000 (13:59 +0200)]
draw_planet: Minimum size for a planet should be one pixel
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:58:24 +0000 (13:58 +0200)]
main.c: Print some white space at the end of the status line
Without this, the status line looks bit odd due to the remaining
characters from the last line, at least when the line shrinks.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:57:59 +0000 (13:57 +0200)]
main.c: Merge two planets into one at collision point
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:56:29 +0000 (13:56 +0200)]
planets: Add function to merge two planets at one
This is used when two planets collide and other planet is merged in
the another one.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:55:02 +0000 (13:55 +0200)]
planet.c: Add function to reshape the size of the planet
This will be used when planets can be merged together at collision.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:18:19 +0000 (13:18 +0200)]
gravitize_planets: Return true in even of a collision
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:15:20 +0000 (13:15 +0200)]
Makefile: Re-enable optimizations
These were accidentally disabled at some point..
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:14:41 +0000 (13:14 +0200)]
Store the planets in a linked list
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:13:38 +0000 (13:13 +0200)]
print_planet: Also print the size of the planet
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:13:20 +0000 (13:13 +0200)]
Utilize lists correctly
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 7 Mar 2010 11:11:56 +0000 (13:11 +0200)]
list.h: Make it compile outside of the linux kernel tree
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Mar 2010 20:48:25 +0000 (22:48 +0200)]
Prepare for having planets in linked list
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Mar 2010 20:36:32 +0000 (22:36 +0200)]
Add list.h
This was taken directly from Linux kernel
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Mar 2010 18:41:49 +0000 (20:41 +0200)]
Draw rectangular planets
These look bit silly now, but it's easier to draw rectangular planets
instead of round ones..
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Mar 2010 18:41:06 +0000 (20:41 +0200)]
main.c: Clear the window instead of fading it
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Mar 2010 16:40:28 +0000 (18:40 +0200)]
Add utils.h
For random misc utils.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 21 Feb 2010 11:48:20 +0000 (13:48 +0200)]
Larger window is better
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 21 Feb 2010 11:47:07 +0000 (13:47 +0200)]
Merge branch 'master' of /home/git/sdl-planets
Conflicts:
Makefile
Timo Kokkonen [Sun, 21 Feb 2010 10:20:00 +0000 (12:20 +0200)]
Style fixes
No functional changes. These will silence checkpatch.pl warnings
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 21 Feb 2010 10:18:15 +0000 (12:18 +0200)]
Makefile: Add suport for sparse and checkpatch.pl
These utils can be used to statically evaluate both code syntax and
style.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 21 Feb 2010 09:56:38 +0000 (11:56 +0200)]
Makefile: Hide compiler commands
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 21 Feb 2010 09:54:04 +0000 (11:54 +0200)]
Makefile: Enable debug symbols
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Feb 2010 10:07:11 +0000 (12:07 +0200)]
Initialize last_fps variable before using it
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Feb 2010 10:05:29 +0000 (12:05 +0200)]
Merge branch 'remote'
Conflicts:
Makefile
main.c
Timo Kokkonen [Sat, 6 Feb 2010 09:06:39 +0000 (11:06 +0200)]
Only exit when esc key is pressed
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Feb 2010 09:06:13 +0000 (11:06 +0200)]
Add FPS counter
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Feb 2010 09:00:41 +0000 (11:00 +0200)]
Makefile: Also clean dependencies
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 6 Feb 2010 09:00:18 +0000 (11:00 +0200)]
Makefile: Prettify compiling messages
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 1 Feb 2010 20:06:04 +0000 (22:06 +0200)]
Moving colourful planets, whoo
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 31 Jan 2010 15:32:04 +0000 (17:32 +0200)]
Moving colorful planets, whoo!
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>