FPS Engine

Hi! :slight_smile:
About a month or so ago I started working on another 3d java game-engine. I wanted to release it here to see how it works on your guys computers!

At the moment it’s a pretty simple fps engine, and as such you cannot do much in the demo.

Download:
Link!

Here’s some screenshots:

Controls:
~ or F12 Console
E throw crate
Q throw barrel (first one is slow [loads model/tex])
1 gun animation
WSAD move
T put a test decal on the scene.

Console variables:
http://pastebin.com/6FV3DmRR
Please note that any variable with r_ or post_ requires that you type the command “r_update” to load it. However, use r_update sparingly; it has a memory leak.

Console commands:
quit quits game
r_update updates rendering engine. This also clears all lights from the scene!
testlight spawns a point light at the camera
testsun spawns a directional light in the scene
clear clears console
memstat prints RAM info
gpustat prints GPU info
noclip allows you to fly
clearlights clears all active lights in the scene
map loads a map at the specified location. ROOT is ./maps/
respawn If you fall off the map :slight_smile:

Credit:
Adam Pasek: Art
Roland La Goy: Sound
TheAgentD: Lighting engine

Requirements:
OpenGL 3.2
Java 8

1000 points if you know where the van model is from!

On my mighty work PC with an AMD Radeon HD5450 and Windows7/64bit, all it renders is the sky and the arm/weapon. It also says this:



Starting up SoundSystem...
Initializing LWJGL OpenAL
    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.or
g)
OpenAL initialized.

Error occured: An OpenGL error was already present when the new LightingEngine o
bject was created.: Invalid enum
Error occured: An OpenGL error occured while creating the new LightingEngine obj
ect.: Invalid enum

Really cool work, orange!

You may want to implement anti-aliasing now.

Also check depth range, you can see triangles glitches on the arm. Sometimes it is enough to push forward a little the near plane :wink:

open console:

post_fxaa 1
r_update
testsun

:wink:

Darn :frowning: I will look into this!

Then why don’t you chose your best looking screeshots therefore? :slight_smile:

It looks awesome :smiley:

But it runs at 18 FPS. That’s because of the lighting, because there was a significant performance boost when I did r_update and removed all of the lights. Maybe it’s the shadow calculations? Or the ambient occlusion? It’s either one of them. There are a couple of lighting bugs too.

But overall, it’s awesome! Of course, right now it isn’t much of a game engine, but seriously, that’s almost AAA standard graphics. Also, isn’t MSAA easier to implement than FXAA? Is FXAA faster or something?

Runs at a solid 100+ FPS for me. What is the TPS value? By the way, I have found a small glitch, why is there a light in the corner?

Pretty cool looking of course. This will be a big hit if made into a complete game.

I don’t think he intends to turn it into a game, I think he’s making an engine.

Also, about the FPS, I think it’s just because of my computer. I’ve got 4GB of RAM and an Intel HD Graphics 2500 graphics card. SHC was really alarmed when he heard that. He asked me to change my graphics card :stuck_out_tongue:

Standing on the wall. I guess TPS is Ticks Per Second, am I right? The rendering is still pretty smooth but the movement is not.

A log by the way, just an exception, but not fatal.


Starting up SoundSystem...
Initializing LWJGL OpenAL
    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
OpenAL initialized.

Exception in thread "Thread-1" java.lang.IllegalStateException: Keyboard must be created before you can query key state
        at org.lwjgl.input.Keyboard.isKeyDown(Keyboard.java:406)
        at engine.game.client.io.GameKeyboard.mapKeys(GameKeyboard.java:67)
        at engine.game.client.io.GameKeyboard.tick(GameKeyboard.java:77)
        at engine.game.GameEngine.gameLogic(GameEngine.java:151)
        at engine.game.GameEngine.run(GameEngine.java:139)
        at java.lang.Thread.run(Unknown Source)

org.lwjgl.LWJGLException: Pixel format not accelerated
        at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
        at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(WindowsPeerInfo.java:52)
        at org.lwjgl.opengl.WindowsDisplay.createWindow(WindowsDisplay.java:247)
        at org.lwjgl.opengl.Display.createWindow(Display.java:306)
        at org.lwjgl.opengl.Display.create(Display.java:848)
        at org.lwjgl.opengl.Display.create(Display.java:797)
        at engine.rendering.util.DisplayHelper.initDisplay(DisplayHelper.java:30)
        at engine.rendering.RenderingPipeline.initialize(RenderingPipeline.java:128)
        at engine.rendering.RenderingPipeline.initialize(RenderingPipeline.java:121)
        at tests.fps.TestPhysicsExample.main(TestPhysicsExample.java:120)
Failed to create OpenGL Context.

Intel HDs opengl support is awesome yay. I’ll try it on my PC later this day.

I got this:

C:\Users\GBarbieri\Downloads\TestFPS\TestFPS>java -jar client.jar

Starting up SoundSystem...
Initializing LWJGL OpenAL
    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.or
g)
OpenAL initialized.

java.lang.NullPointerException
        at com.bulletphysics.collision.dispatch.UnionFind.find(UnionFind.java:12
3)
        at com.bulletphysics.collision.dispatch.SimulationIslandManager.storeIsl
andActivationState(SimulationIslandManager.java:97)
        at com.bulletphysics.dynamics.DiscreteDynamicsWorld.calculateSimulationI
slands(DiscreteDynamicsWorld.java:669)
        at com.bulletphysics.dynamics.DiscreteDynamicsWorld.internalSingleStepSi
mulation(DiscreteDynamicsWorld.java:374)
        at com.bulletphysics.dynamics.DiscreteDynamicsWorld.stepSimulation(Discr
eteDynamicsWorld.java:337)
        at com.bulletphysics.dynamics.DynamicsWorld.stepSimulation(DynamicsWorld
.java:58)
        at engine.game.physics.PhysicsWorld.tick(PhysicsWorld.java:89)
        at engine.game.World.tick(World.java:27)
        at engine.game.GameEngine.gameLogic(GameEngine.java:187)
        at engine.game.GameEngine.run(GameEngine.java:139)
        at java.lang.Thread.run(Unknown Source)
AL lib: (EE) alc_cleanup: 1 device not closed

C:\Users\GBarbieri\Downloads\TestFPS\TestFPS>pause
DrĂĽcken Sie eine beliebige Taste . . .

I have updated the engine a little bit today.

Added:
[list]

  • Physics objects make sounds when they collide with objects. At the moment they use the same sounds as your footsteps. This will be changed.
  • If the engine crashes on load it will pop up a simple error dialog.
  • I lowered the default settings slightly. No SSAO, and 60 fps
  • There shouldn’t be a UnionFind error in Bullet anymore
  • Fixed a problem with the barrel material file. The textures will load properly now

There are two things to note:
Firstly, to exit the game, go to console and type quit instead of ALT F4ing. @SHC when you alt f4 it prints that error! ;D
Secondly, you need OpenGL 3.2 to run the engine. I completely forgot to mention this in the OP!

@VaTTeRGeR does your intel chip have 3.2? o: If it does I need to fix some things! :stuck_out_tongue:

@EgonOlson I haven’t found anything that explains why you cannot see the world geometry on an AMD card. I will keep looking though! :([/list]

I get 144 fps and 200 ups if the world is sparsely populated, it breaks down from 200 ups to 140 ups from one moment to another after some amount of phys-objects.
This is on an Q9650 and GTX 960.

The Intel Chip has the first generation Intel HD built in (at the university :D).


I couldn’t get LibGDX to run with these kind of graphics processors.

Did a quick search, seems that chip only goes up to OpenGL 2.1.

btw I can’t open the console, tried ^ + ~ ´ ß < # and any other key.

Hmm it should just be the Grave key (~). The key right above Tab. Are you on a non qwerty keyboard?

EDIT:
Some google searches show that LWJGL 2 doesn’t always work correctly with the grave key. :(!

I’m on a qwertz keyboard ;D

I have this same problem but on a Intel Core m3. I’m running OpenGL 4.4. Will test on my tower when I get home.

I assume there must be a problem with the gbuffer vertex shader then. If you’re seeing the arm then the frag shader must working fine; the arm model uses the same frag shader as the world geometry.

But for the life of me, I have no idea how this doesn’t work on non NVidia cards:

#version 330

uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;
uniform mat3 normalMatrix;

uniform mat4 worldMatrix;
uniform mat3 normalWorldMatrix;
uniform vec4 modelColor;
uniform vec4 pipelineColor;

layout (location = 0) in vec3 in_Position;
layout (location = 1) in vec3 in_Normal;
layout (location = 2) in vec2 in_TexCoords;
layout (location = 3) in vec4 in_Color;


out vec3 vNormal;
out vec3 vViewSpacePos;
out vec2 vTexCoords;
out vec4 vColor;

void main(){
	vec4 viewPos = viewMatrix * worldMatrix * vec4(in_Position, 1.0);
	gl_Position = projectionMatrix * viewPos;
	vViewSpacePos = viewPos.xyz;
	
	vNormal = normalMatrix * normalWorldMatrix * in_Normal;
	vTexCoords = in_TexCoords;
	vColor = in_Color * modelColor * pipelineColor;
}

Perhaps the problem lies in the static model class…