Original Post
I have an interesting design question for people to mull over. In my masters thesis I proposed a software architecture for use in electronic games (I just submitted it for review, so I'll publish it soon for people to read - and flame :) It's 90 pages + 250 pages of appendix so it should make good kindling) . At its highest level it is a data-centered architecture where game data is in a central data store, and technology component attach and operate on that data. A Simple example: Game Object Contains: - Position - Orientation. AI tech component Requires: - Object Position Graphics tech component requires: - Object Position - Object Orientation Both tech components will attach to the data component and request position data from an object. Now for the design question: The tech components are designed and developed independently from each other and the data component. One may be expecting position as x,y "int", while the other wants x,y,z as "double". A tech component might even want a "location" and not "position" (i.e. wording is different). How can the tech component get the data it wants from the object? Sol'n 1: Objects implement an interface for each tech component. E.g. the object implements a "getLocation()" function that returns 2 integers so that tech component can call that function to get the data it needs. Pros: - Fast execution. Data access is a function call (as opposed to an SQL-like query). Cons: - Lots of duplication. For each component that requires position data, the object must implement a seperate interface specific to that component. - Not easy to use, everytime you add a new component, new interfaces must be implemented. I'm looking for other possible design solutions that people can think of for a follow-up paper. Any ideas would be appreciated. -Thanks, Jeff