Slick Forums

Discuss the Slick 2D Library
It is currently Sun May 19, 2013 12:41 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sun Dec 11, 2011 5:04 pm 
Offline

Joined: Thu Sep 01, 2011 10:15 pm
Posts: 31
Location: United States
I figured I should start posting updates about the strategy game I'm working on here.
My goals are to create a real time 4X space strategy game.
Currently, I have a disk galaxy creation created, tactical zoom, fleets and star travel lanes.
Next I plan on finishing pathfinding for starfleets from one star to the next.


Update Feb. 23, 2012
Image


Older screenshots:
Short video of me showing off the zoom.
http://www.youtube.com/watch?v=3hnoL_B8T-4


Last edited by UAequals42 on Thu Feb 23, 2012 11:59 pm, edited 2 times in total.

Top
 Profile  
 
PostPosted: Tue Dec 13, 2011 11:17 am 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
hi!
Really good! I'm developing a similar game but with kind of zoom is really code, do you have some feedback how to achieve this kind of effect ?

Thanks!

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
PostPosted: Wed Dec 14, 2011 11:49 pm 
Offline

Joined: Thu Sep 01, 2011 10:15 pm
Posts: 31
Location: United States
Ok. How I did a supreme commander style zoom in my 4x space game.

Variables:
    * In my game engine, I have an absolute coordinate system for each planet and object.
    * I then have a camera object that has a variable that tells me which coordinate should be in the middle of the user's monitor.
    * I also have the zoom level as a variable.
    * And then there is the mouse's location on the screen.

When the user moves the mouse to the edge, the camera changes it's coordinates and all the objects move on screen according to that variable. aka
Absolute coordinate + Camera Location = Display location

They key is that when you zoom in, and zoom out the location of the mouse must stay the same in the absolute cordinate system not the display coordinates.
So that means you need logic like this each time the user zooms in and out.
    1. Calculate where the mouse is in the absolute coordinate system.
    2. zoom in/out.
    3. Move the camera so that the mouse will be over the location you calculated in step 1 again.

--------------------------------


If you are asking how I made the zoom rate steady, then.... To do that I used 1.03^(inverse of the zoom) for the zoom speed. aka
Code:
zoomspeed = (float) (1.5 * Math.pow(1.03, z));

And z is the inverse of the zoom. ex: If I was zoomed out where everything was half size, z=2.


Top
 Profile  
 
PostPosted: Thu Dec 15, 2011 3:32 am 
Offline

Joined: Sun Nov 27, 2011 1:22 am
Posts: 3
I am able to achieve something similar. Here is what I used:

Code:
int mousex = input.getAbsoluteMouseX();
int mousey = input.getAbsoluteMouseY();

camx = Math.round((((mousex + camx) * (newzoom/oldzoom)) - mousex));
camy = Math.round((((mousey + camy) * (newzoom/oldzoom)) - mousey));

newzoom is the target zoom and the oldzoom is the current zoom. I update the camera x and y positions in the update method as shown above. Then, during the render stage the following code is used:
Code:
g.translate(-camx, -camy);
g.scale(newzoom, newzoom);


Top
 Profile  
 
PostPosted: Thu Feb 23, 2012 11:56 pm 
Offline

Joined: Thu Sep 01, 2011 10:15 pm
Posts: 31
Location: United States
Image

I've been working on this for a while now and I've finally have:
* Fleets and ships
* Starlanes via a relative neighborhood graph http://en.wikipedia.org/wiki/Relative_neighborhood_graph
* Ship movement
* I can now tell I fleet to go to one system to another... but...

Things I plan to work on next:
* Have fleets find out a path through multiple stars/nodes.
* Construct ships :roll:
* Specialization of ships


Top
 Profile  
 
PostPosted: Mon Apr 09, 2012 9:17 pm 
Offline

Joined: Sun Nov 20, 2011 9:21 pm
Posts: 25
How is it going?


Top
 Profile  
 
PostPosted: Mon Jul 16, 2012 6:44 pm 
Offline

Joined: Thu Sep 01, 2011 10:15 pm
Posts: 31
Location: United States
kibertoad wrote:
How is it going?


I have decided to stop work on this project. I'm thinking of starting a new game project, maybe a turn based strategy, but definitively not an rts.

Maybe I'll re-purpose the engine into a space adventure (like privateer), but trying to create the fleet management while keeping the fps up made this project very hard to seriously complete.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group