Skip to content

Commit

Permalink
Refactored client more towards a service oriented architecture.
Browse files Browse the repository at this point in the history
Implemented message handling service that delegates messages to other services.
Created Engine service for 3D engine related things, moved most code from ClipmapTerrainSpike to it for now.
Some initial Entity classes.
  • Loading branch information
zzorn committed Jul 31, 2012
1 parent a1a1964 commit d4c6280
Show file tree
Hide file tree
Showing 33 changed files with 522 additions and 389 deletions.
19 changes: 12 additions & 7 deletions build.sbt
Expand Up @@ -34,15 +34,20 @@ libraryDependencies += "com.dyuproject.protostuff" % "protostuff-collectionschem

libraryDependencies += "org.yaml" % "snakeyaml" % "1.11-SNAPSHOT"

libraryDependencies += "org.scalastuff" % "scalabeans" % "0.3"

libraryDependencies += "com.thoughtworks.paranamer" % "paranamer" % "0.3"


// Akka for parallel signals and messaging
libraryDependencies ++= Seq(
"se.scalablesolutions.akka" % "akka-actor" % "1.1.3",
"se.scalablesolutions.akka" % "akka-slf4j" % "1.1.3",
"se.scalablesolutions.akka" % "akka-typed-actor" % "1.1.3",
"se.scalablesolutions.akka" % "akka-amqp" % "1.1.3",
"se.scalablesolutions.akka" % "akka-testkit" % "1.1.3"
)
//libraryDependencies ++= Seq(
// "se.scalablesolutions.akka" % "akka-actor" % "1.1.3",
// "se.scalablesolutions.akka" % "akka-slf4j" % "1.1.3",
// "se.scalablesolutions.akka" % "akka-typed-actor" % "1.1.3",
// "se.scalablesolutions.akka" % "akka-amqp" % "1.1.3",
// "se.scalablesolutions.akka" % "akka-testkit" % "1.1.3"
//)


// JMonkey Engine 3.0 for 3D gfx
libraryDependencies ++= Seq( // Core lib
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/skycastle/client/ActionMethod.java
@@ -0,0 +1,14 @@
package org.skycastle.client;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Indicates that a method handles some types of messages from the server.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ActionMethod {
}
8 changes: 6 additions & 2 deletions src/main/scala/org/skycastle/client/ClientServices.scala
@@ -1,9 +1,11 @@
package org.skycastle.client

import engine.Engine
import entity.EntityService
import messaging.MessageHandler
import network.ClientNetworking
import org.skycastle.utils.Services
import terrain.TerrainService
import region.RegionService

/**
* The services that the client is composed of.
Expand All @@ -14,8 +16,10 @@ trait ClientServices extends Services {

def messageHandler: MessageHandler

def terrain: TerrainService
def entityService: EntityService

def regionService: RegionService

def engine: Engine

}
10 changes: 8 additions & 2 deletions src/main/scala/org/skycastle/client/ClientServicesImpl.scala
@@ -1,8 +1,10 @@
package org.skycastle.client

import engine.EngineImpl
import entity.EntityServiceImpl
import messaging.MessageHandlerImpl
import network.ClientNetworkingImpl
import terrain.TerrainServiceImpl
import region.RegionServiceImpl

/**
*
Expand All @@ -13,5 +15,9 @@ class ClientServicesImpl extends ClientServices {

val networking = addService(new ClientNetworkingImpl(messageHandler))

val terrain = addService(new TerrainServiceImpl())
val entityService = addService(new EntityServiceImpl())

val regionService = addService(new RegionServiceImpl(this))

val engine = addService(new EngineImpl())
}
218 changes: 0 additions & 218 deletions src/main/scala/org/skycastle/client/TerrainSpike.scala

This file was deleted.

13 changes: 13 additions & 0 deletions src/main/scala/org/skycastle/client/engine/Engine.scala
@@ -0,0 +1,13 @@
package org.skycastle.client.engine

import com.jme3.asset.AssetManager
import org.skycastle.utils.Service

/**
* The 3D display engine.
*/
trait Engine extends Service {

def getAssetManager: AssetManager

}

0 comments on commit d4c6280

Please sign in to comment.