dDrive - little car driving game

Hello all.
I play with jMonkeyEngine for some time. I am absolutely blown away. I think that the community are excellent. I decided to document the evolution of my own little game. I recorded a short video that shows the current progress.

[video]http://youtu.be/RswusnYlvds[/video]

9 Likes

Ha, very nice start!

Love the gears and had a giggle when you used the handbrake. Your car handling and sounds makes it seemingly quite fun to drive already.

Add a horn and you good to go :D.

Thank you. Engine sound is the hardest thing for me. This must be improved.

New update… =D

  • Added new personal PDA. It will support various functions and informations (so far world time, current car information, stopwatch)
  • Three camera types (First person, Third person, Orbit)
  • Fixed many bugs :-[

[video]http://youtu.be/i_Ke6WcIDyc[/video]

Ooouch! I forgot the horn… (nex time).

2 Likes

I really love the advance usage of nifty controls really good work! :slight_smile:

Thank you for kind comment. I have lot of experience with C# and XNA. But java and jme is really new to me. :wink:

Looks nice man, keep it up!

Hello all again :slight_smile:
I lately have not free time (because my job) for my little jME project. So development is slowed, but still there is small progress…

  • I tweaked little bit model of DA3 vehicle (still no interior)
  • Added some textures and tested basics of materials.
  • Using the console, you can set any color for any vehicle.
  • I started to play with effects for skidding tires (sound, smoke).
  • I fixed many little bugs.

Now I’m working on new vehicle configuration file, which allow user to change some vehicle parameters and set some scripting (like this object controls this function or another object and so on…) without building project… (more info next time :wink:

Here is video:
http://youtu.be/Vt-9ms2xNFk

THX :wink:

nice work i like the handbrake :slight_smile: keep it up

Hi guys.
I need help, or some explanation. I have some troubles with shadows. My first directional light (“sun”, or “moon”) works fine. But there is no shadows for my next two SpotLights. I’m using DirectionalLightShadowFilter for directional light and SpotLightShadowFilter for my two spot lights. As you can see on picture… Green mark shows correct shadows from directional light. But blue mark shows light from my two spot lights, which comes through corner (red mark) and cast NO shadows.

This is code in AbstractAppState initialize method.

// directional light
ColorRGBA suncolor = ColorRGBA.White.mult(0.1f);
DirectionalLight lightSun = new DirectionalLight();
lightSun.setDirection(new Vector3f(0.5f, -1.0f, 1.5f));
lightSun.setColor(suncolor);
localRootNode.addLight(lightSun);
        
// ambient light
AmbientLight lightAmbient = new AmbientLight();
lightAmbient.setColor(suncolor.mult(0.3f));
localRootNode.addLight(lightAmbient);

// postprocesor
filterPostProcesor = new FilterPostProcessor(getAssetManager());
getSimpleApp().getViewPort().addProcessor(filterPostProcesor);

// sun shadow
final int SHADOWMAP_SIZE=4096;
DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(getAssetManager(), SHADOWMAP_SIZE, 3);
dlsf.setLight(lightSun);
dlsf.setEnabled(true);
dlsf.setShadowIntensity(0.7f);
dlsf.setShadowCompareMode(CompareMode.Hardware);
dlsf.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
dlsf.setEnabledStabilization(true);
dlsf.setEdgesThickness(1);
filterPostProcesor.addFilter(dlsf);

and this is code in update method, when vehicle is added into the scene…

// spot light
light = new SpotLight();
light.setSpotRange(IniTools.getFloat(section, "range"));
light.setSpotInnerAngle(IniTools.getFloat(section, "innerAngle") * FastMath.DEG_TO_RAD);
light.setSpotOuterAngle(IniTools.getFloat(section, "outerAngle") * FastMath.DEG_TO_RAD);
light.setColor(IniTools.getColor(section, "color").mult(IniTools.getFloat(section, "intensity")));

// shadow filter
shadow = new SpotLightShadowFilter(vehicle.getGameState().getAssetManager(), SHADOWMAP_SIZE);
shadow.setLight(((SpotLight)light));
shadow.setEnabled(true);
shadow.setShadowIntensity(0.7f);
shadow.setShadowCompareMode(CompareMode.Hardware);
shadow.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
shadow.setEdgesThickness(1);

// adding to scene
vehicle.getGameState().getRootNode().addLight(light);
vehicle.getGameState().getFilterPostProcessor().addFilter(shadow);

Some tips, what I’m doing wrong?
Thank you very much.

dDrive - ShadowProblem

Hello all.

  • I have some progress with my little driving project. So here is some news.
    The major changed thing, which is not obvious at first sight, is a reworking of the vehicle configuration file, which now allows me to add and configure various components of the vehicle without having to re-edit and translate the entire program. At the same time allows me to script a variety of functionality, which will be later on used for e.g. interactive interior.
  • I have added a basic daily cycle (changing of day and night). Time speed can be controlled by commands from the console. But still want to fine-tune a few basic things. For example sky color is changed for whole sky. So when sky turns orange around the sun during sunset, sky is also orange on the other side, where moon is comming.
  • I’ve added the ability to add vehicle lights.
  • I’m working on shadows glitches, but basically works fine.

Here is video:
YouTube
THX :slight_smile:

3 Likes

Looks nice :smiley: Have you fixed your issue from 3 days ago with the lights?

Not really. I’m still working on it…

@dawnmichal said: Not really. I'm still working on it...

http://hub.jmonkeyengine.org/javadoc/com/jme3/shadow/AbstractShadowFilter.html#setFlushQueues(boolean)

@pspeed said: http://hub.jmonkeyengine.org/javadoc/com/jme3/shadow/AbstractShadowFilter.html#setFlushQueues(boolean)

Nice tip! Thank you!. As soon as I have time, I’ll definitely try it.

Oh, you added a horn :D!!! Uber!!

May I ask how you did the lights (that light when you brake, for example) on the vehicle please? I’m doing a lil vehicle game myself (driving inside some tubes and stuff) and not sure how to tackle that.

If i would have to guess, glow filter, custom shader that takes a boolean for each light (on/off) and a texture where the alpha channel is used to index the lights.

1 Like
@loopies said: May I ask how you did the lights (that light when you brake, for example) on the vehicle please? I'm doing a lil vehicle game myself (driving inside some tubes and stuff) and not sure how to tackle that.

Shaders are one big mystery for me :smiley: So I used maybe less effective way. But it’s simple. I have two materials. First only with diffuse map and second with diffuse and glow map (https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:bloom_and_glow). Then I only change material when light is on.

1 Like

Ok…
I have weird problem with physics debug. When I enable debug by space.enableDebug() method I realise that physics world seems to be shifted compared to 3D rendered world (see screenshot). All objects are shifted. Some tips? It must be some noob beginner mistake, but I can’t figure it out…

PhysicsDebug

show (ukaž) us (nám) your (tvůj) way (způsob) of creating (vytváření) an world (světa) :slight_smile: ( :slight_smile: )