13. March 2015 21:03
I have been reading a bit about the Ash entity system, especially these two articles by Richard Lord
First time I read it I didn't quite grook it completely but it stayed there in the back of my mind as a good idea and I have slowly gotten around to thinking it is something I really want to implement. Unfortunately it turned out to be another form of Nerd sniping
for me. I am still working on pathfinding and mouse selection of units on the simple rts I am working on and I got to work trying to rewrite it into more of an entity way.
I am using Aron Granbergs pathfinding project
and it is great and very easy to work with. The base examples given and all the youtube tutorials suggests one adds a seeker component to game units and use that for individual units to find paths to targets. That doesn't quite match the entity way of doing things so I dug around until I realized I can just call the static method ABPath.Construct() to get paths instead. I put this into a unit manager class (which could be thought about as my movement system) and it works splendidly to create and assign paths to units.
The next step was to take out the movement logic from the gameobjects and put it into the unitmanager. Here I hit an obstacle, I really don't care for writing all the movement logic myself so I want to use as much as possible what is built into unity. That means using the Character Controller and preferably the simplemove method of the controller. But here the breakdown between system and data begins, there is no way to extract the character controller from the gameobject so either I have to write my own movement code or simply accept a "half entity" way of doing things.
Right now I am contemplating what I will do, but I will probably not fight with the Unity way to much. Going against the thought and idea behind the engine would probably in the long run involve as much work as simply making an engine out of an existing framework like Mono instead. The productivity gain from using Unity would be lost. I think I will take it as far as is simple to do and then accept that I wont get all the way. I can put all game logic I write into system like classes and accept that the entities will have some logic on their own that mostly consists of things that is included in Unity. One can probably see it as going halfway through Lords "What is an entity system" article and be satisfied with that.