Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Google Map Race  (Read 3125 times)
0 Members and 1 Guest are viewing this topic.
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Posted 2010-07-12 11:56:40 »

Long time I didn't make something... to mush work and too big projects. To make a pause, I give a try to an idea that I had.

One of the annoying thing is to create maps, so I wanted to take map form google so I only have to define start point and end point for a racing game  Tongue (yes race all around the world !!!).

I manage to "stream" map but it was too slow (I only download 1 image at a time to not harm server) and maps from google are far too mush inacurrate. So I go for an editor that download map with a few tools to define road limite. Even so, the size of data is far too mush  Sad (6mo for a small part of a small town...)

So there is the result (a flew day of works  Wink), it is not polished but it is complet : Google Map Race
And the editor : Google Map Race Editor
The source code : User : guest , Password : guest0

For the game :
left : turn left
right : turn right
up : speed up
space : select

For the editor,  everything should be put in the "~/.bonbonchan/" folder. To add a race, you have to add a ".txt" file with 3 line :
1/ Name of the race
2/ Start point  : ix,dx,iy,dy,angle
3/ End point  : ix,dx,iy,dy,angle

ix,iy are integer of the coordinate of the image. dx,dy are double of the coordinate inside the image. angle is a double in radian.

To conclude, this game is not really good (or even legal), but I did't want to waste the code so  Grin.


Offline gouessej

« In padded room »



TUER


« Reply #1 - Posted 2010-07-12 12:02:54 »

Nice game  Grin I would have loved to be able to get out the car to shoot some people lol.

Offline DzzD
« Reply #2 - Posted 2010-07-12 12:22:19 »

hey very good idea, It would be nice to be able to see road "locked" also zoom in & out would be awesome.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Reply #3 - Posted 2010-07-12 12:48:28 »

Got the bread in 2:19:00

lots of sillystupid games: http://www.emaggame.com
Offline gouessej

« In padded room »



TUER


« Reply #4 - Posted 2010-07-12 13:19:42 »

To conclude, this game is not really good (or even legal), but I did't want to waste the code so  Grin.
Will you release the source code?

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 12


Game Engineer


« Reply #5 - Posted 2010-07-12 16:38:50 »

Cool. :-) I think the main thing this could benefit from (and is missing) is the ability to take any side road you want. I felt like I saw all these little roads that I would try to go down to save some time but I would just end up being cut off.

See my work:
OTC Software
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #6 - Posted 2010-07-13 12:17:24 »

Will you release the source code?

You miss the versionning link  Wink

https://free1.projectlocker.com/bonbonchan/GoogleMapRace/trac/browser
Login : guest
Password : guest0

Quote
Cool. :-) I think the main thing this could benefit from (and is missing) is the ability to take any side road you want. I felt like I saw all these little roads that I would try to go down to save some time but I would just end up being cut off.

There is several  possible paths but it takes a lots of time to edit all the roads.
Offline gouessej

« In padded room »



TUER


« Reply #7 - Posted 2010-07-13 13:28:55 »

You miss the versionning link  Wink

https://free1.projectlocker.com/bonbonchan/GoogleMapRace/trac/browser
Login : guest
Password : guest0
Thanks. I'm reading the whole source code now. Getting all files one by one is a bit painful. Do you have a GIT or SVN repository?

Maybe it would be easy to allow the car to move back by doing this:
1  
2  
3  
double acceleration = 0;
if(up) { acceleration = A; }
if(down) { acceleration = -A/10; }

instead of
1  
2  
double acceleration = 0;
if(up) { acceleration = A; }

Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #8 - Posted 2010-07-14 15:39:56 »

Thanks. I'm reading the whole source code now. Getting all files one by one is a bit painful. Do you have a GIT or SVN repository?
https://free1.projectlocker.com/bonbonchan/GoogleMapRace/svn
Same login/password

Maybe it would be easy to allow the car to move back by doing this:
1  
2  
3  
double acceleration = 0;
if(up) { acceleration = A; }
if(down) { acceleration = -A/10; }

instead of
1  
2  
double acceleration = 0;
if(up) { acceleration = A; }

Usually in racing game, I don't even think about slowing down or going backware  Tongue
Offline h3ckboy
« Reply #9 - Posted 2010-07-14 23:11:17 »

Usually in racing game, I don't even think about slowing down or going backware  Tongue
if u get stuck in a corner?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Swattkidd7

Junior Member





« Reply #10 - Posted 2010-07-15 01:55:36 »

if u get stuck in a corner?
I usually just smash down the acceleration until some miracle happens and I am out of the corner haha...maybe thats just me though.
Offline h3ckboy
« Reply #11 - Posted 2010-07-15 18:13:21 »

hahahahahahaha
Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 6
Exp: 8 years



« Reply #12 - Posted 2010-07-17 18:11:04 »

This is quite funny, but I wish there was some hint on where is drivable and where is not  ... on the end of the track I spent hours trying to find where to enter the parking lot .
Good job anyway !

(ps: the link for the editor is not working )

Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #13 - Posted 2010-07-18 09:14:53 »

Quote from: teletubo link=topic=22710.msg187631#msg187631
(ps: the link for the editor is not working )
[/quote

Corrected  Smiley
Offline gouessej

« In padded room »



TUER


« Reply #14 - Posted 2010-08-27 16:04:09 »

When I replaced Timer and TimerTask by their JDK equivalent, the window stayed gray. As I did not want to keep these classes, I used something more simple:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
public void run() {
        long elapsedTimeInNano = 0, previousTimeInNano, timeInNano = System.nanoTime();
        state = new Title();

        try {
            while ((thread != null) && (thread.isAlive())) {
                time = System.currentTimeMillis();

                previousTimeInNano = timeInNano;
                timeInNano = System.nanoTime();
                elapsedTimeInNano += timeInNano - previousTimeInNano;

                int nb = (int) (elapsedTimeInNano / (1000000000 / FRAMERATE));

                if (nb > 0) {
                    elapsedTimeInNano -= nb * (1000000000 / FRAMERATE);
                }

                for (int i = 0; i < nb; i++) {
                    state.logic();
                }
               
                initDraw();
                state.draw();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }


Does my solution consume more CPU time?

Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #15 - Posted 2010-08-27 17:07:31 »

Without testing I will say yes, it consumes more CPU time. You have remove all wait so draw() will be invocaded as mush as possible. In my case, draw() is invocaded at most of 60 fps.

For the Timer / TimerTask, I have just copy the jdk code and made modification to have a better accuracy (you should check if I use a time in nanosecond while the original one is in milisecond, I don't remember how I have done it).
Offline gouessej

« In padded room »



TUER


« Reply #16 - Posted 2010-08-27 22:27:27 »

Without testing I will say yes, it consumes more CPU time. You have remove all wait so draw() will be invocaded as mush as possible. In my case, draw() is invocaded at most of 60 fps.
Ok that is what I feared.

For the Timer / TimerTask, I have just copy the jdk code and made modification to have a better accuracy (you should check if I use a time in nanosecond while the original one is in milisecond, I don't remember how I have done it).
I compared the both, I only found an attribute called "offset" in TimerTask and something different in the scheduling. The problem is that I was unable to explain your modifications to some students so I preferred using something more simple. Would it be dangerous to invoke Thread.sleep() in the method JMain.run()?

Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #17 - Posted 2010-08-30 09:04:28 »

Ok that is what I feared.
I compared the both, I only found an attribute called "offset" in TimerTask and something different in the scheduling. The problem is that I was unable to explain your modifications to some students so I preferred using something more simple. Would it be dangerous to invoke Thread.sleep() in the method JMain.run()?
I'm an example to students  Grin funny

In JMain.run(), if nb == 0, it's mean that you have time to do a Thread.wait(  ((1000000000 / FRAMERATE) -  elapsedTimeInNano)/1000 ) (or use the nano second method).

For TimeTask, it use System milisecond and there is "rounding" error while using a framerate of 60. So I use an "offset" to correct the error.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (62 views)
2014-04-15 18:08:23

BurntPizza (60 views)
2014-04-15 03:46:01

UprightPath (73 views)
2014-04-14 17:39:50

UprightPath (56 views)
2014-04-14 17:35:47

Porlus (73 views)
2014-04-14 15:48:38

tom_mai78101 (99 views)
2014-04-10 04:04:31

BurntPizza (159 views)
2014-04-08 23:06:04

tom_mai78101 (254 views)
2014-04-05 13:34:39

trollwarrior1 (208 views)
2014-04-04 12:06:45

CJLetsGame (215 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!