Browse Source

Themeless: added sections of walls + rocks as boxes.

master
Dejvino 7 years ago
parent
commit
a4f17f414e
4 changed files with 61 additions and 10 deletions
  1. +11
    -4
      README.md
  2. BIN
      screenshot.png
  3. +23
    -1
      src/roadtrip/model/ProceduralMapQuadBlock.java
  4. +27
    -5
      src/roadtrip/view/GameWorldView.java

+ 11
- 4
README.md View File

@@ -23,26 +23,30 @@ A game about a journey involving vehicles and obstacles.
* Car engine
* Wheel rolling
* Wheel slips
* Camera
* Graphics
* themeless
* 3rd person view (following the player)
* depth-of-field filter
* distance-based hiding of objects
* Input
* Keyboard
* Game menu

### TODO
#### Stage 0 :: Prototype
* done
* DONE

#### Stage 1 :: Core Game
* Joystick controls
* FPV camera
* Main Menu
* Winning condition (location)
* Loading screen
* Health indicator
* Persistent content on terrain blocks
* NPC AI
* Enemy objects - mines
* Enemy NPCs - punching, shooting
* Interacting with the environment
* Interacting with the environment - opening of gates

#### Stage 2 :: Filled Game
* Roadblocks
@@ -50,8 +54,11 @@ A game about a journey involving vehicles and obstacles.
* Car models
* Scenery models
* Intro, Outro
* Dialogs
* Fuel

#### Stage 3 :: Overflowing Game
* Stealth
* Clothing
* Car customization
* Destructable environment

BIN
screenshot.png View File

Before After
Width: 1026  |  Height: 795  |  Size: 901 KiB Width: 1026  |  Height: 795  |  Size: 416 KiB

+ 23
- 1
src/roadtrip/model/ProceduralMapQuadBlock.java View File

@@ -44,13 +44,35 @@ public class ProceduralMapQuadBlock extends AbstractProceduralBlock
float height = terrainQuad.getHeight(pos);
String type;
if (quadRand.nextInt(10) == 0) {
type = "house";
type = "rock";
} else {
type = "tree";
}
Vector3f location = new Vector3f(pos.x, height, pos.y);
mapObjects.add(new MapObjectInstance(type, location));
}
// walls
if (quadRand.nextInt(3) == 0) {
int dir = quadRand.nextInt(4);
for (int i = 0; i < quadRand.nextInt(terrainQuad.getPatchSize() * (10 + quadRand.nextInt(100))); i++) {
Vector2f pos;
if (prevPos == null || quadRand.nextFloat() < 0.1f) {
pos = new Vector2f((quadRand.nextFloat() - 0.5f) * cellSize, (quadRand.nextFloat() - 0.5f) * cellSize)
.addLocal(quadPos);
} else {
if (quadRand.nextInt(10) == 0) {
dir = (dir + quadRand.nextInt(2) * 2 - 1) % 4;
}
pos = new Vector2f(dir == 1 ? 1 : (dir == 3 ? -1 : 0), dir == 0 ? 1 : (dir == 2 ? -1 : 0)).addLocal(prevPos);
}
prevPos = pos;
float height = terrainQuad.getHeight(pos);
String type = "wall";
Vector3f location = new Vector3f(pos.x, height, pos.y);
mapObjects.add(new MapObjectInstance(type, location));
}
}
}
public Iterable<? extends MapObjectInstance> getMapObjects()


+ 27
- 5
src/roadtrip/view/GameWorldView.java View File

@@ -182,6 +182,7 @@ public class GameWorldView {
terrain.terrainGrid.addControl(lodControl);
final Node treeModel = createTree();
final Node blockModel = createBlock();
final Node rockModel = createRock();
final FineTerrainGrid terrainGrid = terrain.terrainGrid;
@@ -238,12 +239,19 @@ public class GameWorldView {
boxHalf = new Vector3f(s * 0.2f, s * 3f, s * 0.2f);
modelPhysics = new RigidBodyControl(new BoxCollisionShape(boxHalf), 0f);
break;
/*case "house":
modelInstance = houseModel.clone();
boxHalf = new Vector3f(2f + rand.nextFloat() * 10f, 2f + rand.nextFloat() * 10f, 2f + rand.nextFloat() * 10f);
scale = boxHalf;
case "rock":
modelInstance = blockModel.clone();
boxHalf = new Vector3f(0.5f, 0.5f, 0.5f);
pos.y += 0.2f;
modelPhysics = new RigidBodyControl(new BoxCollisionShape(boxHalf), 0f);
break;*/
break;
case "wall":
modelInstance = blockModel.clone();
scale = new Vector3f(1f, 2f, 1f);
boxHalf = new Vector3f(0.5f, 1f, 0.5f);
pos.y += 0.5f;
modelPhysics = new RigidBodyControl(new BoxCollisionShape(boxHalf), 0f);
break;
default:
throw new RuntimeException("Unhandled object type: " + mapObject.getType());
}
@@ -362,5 +370,19 @@ public class GameWorldView {
return rockModel;
}
private Node createBlock() {
Material rockMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
rockMat.setColor("Color", ColorRGBA.Gray);
rockMat.getAdditionalRenderState().setWireframe(true);
Geometry rockGeom = new Geometry("rock", new Box(0.5f, 0.5f, 0.5f));
rockGeom.setMaterial(rockMat);
Node rockModel = new Node("rockNode");
rockModel.attachChild(rockGeom);
return rockModel;
}
}

Loading…
Cancel
Save