New Waypoint System |
Sun, 29 April 2012 18:29 |
|
Aeglos | | | Messages: 142
Registered: May 2011 Location: Chile | |
|
Yet another semi-big system change, so a new thread for reference.
Waypoints are now grouped into:
Common/Waypoints
Contains the classic Waypoint definition with a few modifications, and the new IWaypointTask interface and it's implementations. These implementations (ColoniseTask, LoadTask, etc) are plain data containing objects used by the client to set waypoint orders (Task name, amounts, time, etc). Still lacks in depth implementations as they are a bare port of the old waypoint Enum.
Server/Waypoints
Contains the WaypointExtension class, which adds a server specific operation for the Waypoint class to load a proper IWaypointTaskWorker implementation (all located here) to actually carry out the tasks. These worker classes are an extended port of the previous WaypointTasks class, and now contain validation and full execution, including Star ownership exchange and fleet cleanup when appropiate, in favour of grouping such things logically instead of the server handling them all "blind" (like fleet cleanup).
So, to create a new waypioint task:
1. Create a NamehereTask that implements IWaypointTask in Common/Waypoints with order/client data.
2. Add it to the SetTask() method in Common/Waypoints/Waypoint.cs
3. Create a NamehereTaskWorker that implements IWaypoinTaskWorker in Server/Waypoints to carry out the procedure.
4. Add it to the LoadWorker() method in Server/Waypoints/Waypoint.cs
That's it, it should be auto loaded and executed when appropiate.
Report message to a moderator
|
|
|
|
|
|
Re: New Waypoint System |
Fri, 04 May 2012 23:34 |
|
Aeglos | | | Messages: 142
Registered: May 2011 Location: Chile | |
|
I have them partially working on my local copy... but i'm not entierely happy with the cleanliness of the system.
The thing is this:
Most Tasks need access to ServerData because they modify several things from several collections, and cosider data from several empires (Like invasions for example; need both Races). Hence the TaskWorkers which can't exist on Nova/Common because it can't reference Nova/Server where ServerData exists.
Now, in the case of manual cargo via xfer dialog, the waypoint is properly created, but we are working with Tasks, not TaskWorkers so there is no "clean" way of applying the task to the client state to immediatly display the results of the manual cargo modification. I had to drop in a piece of code that is pretty out of place to do so and defeats the purpose of havint that code contained in the TaskWorkers.
What i'm thinking is merging the TaskWorkers from Nova/Server into the Tasks in Nova/Common, and change the interface to use two EmpireDatas instead of a ServerData. That way they can work in both Client & Server without resorting to the tricks I placed there.
Unless some task needs to take into account more than 2 empires, which I can't think of any at the moment (Since there is always one instigator and one target).
EDIT:
Yes, that approach was much more cleaner and better, and I'm pretty happy with it. I plan to make some refactorings and comments here and there, but I've commited it in the meanwhile if you want to play with it. Cargo Transfer dialog is working now too.
Things that need improvement:
* Cargo transfer dialog creates waypoint commands that appear on the waypoint list. Have to somehow omit them from there (or perhaps not?)
* Waypoint 1 and 0 load cargo controls need to be done.
* Test some more
[Updated on: Sat, 05 May 2012 00:45] Report message to a moderator
|
|
|
|
|
Re: New Waypoint System |
Tue, 08 May 2012 00:21 |
|
Aeglos | | | Messages: 142
Registered: May 2011 Location: Chile | |
|
Alright, Split/Merge fleets is done via Manual dialogs. Waypoint UI is pending for it, but the commands are done and work.
Some bugs that need fixing: When splitting and giving waypoints to the newly split fleets, they won't go through as the fleet does not yet exist when the commands are parsed.
Waypoint list is still getting full of repeated "temporary" waypoints. Need to devise a way to fix that. (Probably allowing for more than one task per waypoint).
I think only manual cargo transfer remains. Since the CargoTask is done it shouldn't pose much trouble to implement, I'll prolly get to it this weekend, as I'll be away till Friday.
Cheers!
EDIT: Another bug I just recalled, when merging fleets the fuel/cargo distribution is funky.
[Updated on: Tue, 08 May 2012 00:33] Report message to a moderator
|
|
|