1
0
mirror of https://github.com/Dejvino/roadtrip synced 2024-11-14 04:57:28 +00:00

Themeless: added sections of walls + rocks as boxes.

This commit is contained in:
Dejvino 2017-02-02 00:50:44 +01:00
parent 4a7b7f2484
commit a4f17f414e
4 changed files with 61 additions and 10 deletions

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 901 KiB

After

Width:  |  Height:  |  Size: 416 KiB

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()

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());
}
@ -363,4 +371,18 @@ 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;
}
}