Tuesday, 4 November 2008

Game object component system

In this system, the idea is to replace the traditional hierarchical game object system based on inheritance. The need for this system was inspired by the disadvantages of the traditional system, the biggest one being class explosion. Normally, you would start with a base Object or GameObject class, in a 2D game, you might call it Sprite. This would contain the basic functionality of a game object in the scene. Each time you want to have different or more specific behaviour, for example, you may want to Draw or Update an object differently, such as with a pickup, a collidable piece or the scenery etc., in this case you will override these equivalent methods with your own or added behaviour. In a complex game with many different types of objects you may have to start creating and subclassing from a myriad of classes. An example of this would be, where you might create a Character class than will move and collide a particular way in the world, you then might have a Player class for characters that users control, that inherits from Character, then you might also have a Enemy class that inherits from Player or Character. Then, when you want a new form of enemy, some people might create a new class for each. If you had an enemy that, say, tracks the player in the world and another than moves randomly, all though its not a good example, you might create a class for each, then you might later want one that has behaviours and inherits from each (a better way would be to use the Strategy pattern, and use composition rather than inheritance to determine the new behaviour; you just swap a MovementStrategy object that an enemy calls). This could apply to many game objects, and if you do this, your class hierarchy may become large and unmanagable. A big problem you might meet is the Diamond of Death, where you trap yourself into a corner. -In this case you might start duplicating code or hacking around, just so you can get your new game object type in the world. This is never a good situation to get in.

One solution to this is the aforementioned GOC system. The idea with this to use composition, rather than inheritance to form your game objects. In this design, you start with a base object that contains a list of components that will get called either when the base object is Updated or Drawn each frame. Here's a description of how the Tony Hawk team used it.

The way I tried to use this system was by having a hierarchy of components for movement, control, drawing. Also at this point, I was thinking about integrating a physics system in an engine, so there was a component type that governed how the phyics reacted with the composed object. I've always designed my games systems to be completely data driven, so the public properties of an object can be set from a data file, this allows integration with an editor, which was one of the things I was implemeting at the time (Winforms app with XNA window). The obvious use for this is to speed up creation of a game, enable re-usability and allow artists to design levels and games (if you start adding events) without digging into code.

While I still like the idea of this system, it is, in concept, the ultimate in flexibility, and its this generality that software designers aim for, to make the possibilties of an application all the more wider, data-driven, and re-usable. There were though, a number of problems I ran into with trying to implement the system. It was too flexible. I think all software systems are a comprimise between flexibility and specific function. Flexibilty allows the function of a system to be changeable, whereas specific functionality can be more targeted. Specific systems are easier to write, as you don't need to think about the general case, just the task that needs to be currently satisfied, this allows for more performant systems.

The problem I found, was that I had to start knowing specific things about my components, especially when physics were concerned. I was implementing it in C# at the time and came up with a system that used reflection create and initialise the properties of each component. For the games that I was intending to write at the time, and the same now, this system, (even though I got quite far on the implementation) would have been far too complicated for its own good. Coming up with a reliable interface so that components could reference and call each other, while keeping them independant would have taken me a long time to achieve, and I'm not sure if it is even possible with intertwined needs that are bought about by the use of things like physics. Maybe I will return to this system, sometime in the future, but I don't think my previous use of it beats the design of the current, traditional game object hierarchy.


WurzelGogerer said...

Hi Dan,

thanks for sharing your insight and trouble into GOCS..

you mentioned that you implemented some of the GOCS but discarded it...

I am currently studying computer science and we have this project where we are supposed to create a mmog. My task for this week is to research GOCS and give my insight to the other students so we can start creating interfaces.

Could you give me any specific ressources u used. and yes i am googling to, but maybe you found something specific you thought was very insightful.

and if you still have the code around from your partial implementation, would you mind sharing it?



stories incest young said...

He had the girl turn in place, bend well forward at the hips to steady herself with hands braced on her thighs, so that she was forced to stick back her well made bottom towards the face of the hungry Mr Moto. I need to get back to class.
stories sexy hindi real
free online porn stories
free big tit animal sex stories
womens dog sex stories
free lesbian porn stories
He had the girl turn in place, bend well forward at the hips to steady herself with hands braced on her thighs, so that she was forced to stick back her well made bottom towards the face of the hungry Mr Moto. I need to get back to class.

Anonymous said...

[b][url=http://www.bestlouisvuittonbags.co.uk/]www.bestlouisvuittonbags.co.uk[/url][/b] Applying noticed palmetto will enhance these circumstances by decreasing DHT manufacturing in the entire body. Noticed palmetto also stimulates prolactin development, which in turn raises milk creation in lactating ladies. The Nutritional Dietary supplements Health Information web site plainly points out, on the other hand, that none of those cures for ladies have already been scientifically demonstrated..

[b][url=http://www.uggsbootsoutletmall.co.uk/]ugg boots[/url][/b] She is betraying us! Russia alone need to conserve Europe. Our gracious sovereign acknowledges his large vocation and can be true to it. That is definitely the one thing I've faith in! Our superior and amazing sovereign must execute the noblest role on the planet, and he is so virtuous and noble that God will never forsake him.

[b][url=http://www.uggsbootsoutletmarket.com/]ugg outlet[/url][/b] In an effort to simply clutches advantage to partner could possibly be the absolutely repeated. Deliver a variance your typical Affordable Reproduction Lv Baggage and take a look at publications, you're going to in all probability have ranges of remedies what' ersus coming ladies furthermore to a standard diabetic' r tote very seriously are outlined. A purse seemed to be labeled dude? capital t incredible spouse as soon as the darling proceeds to get equipped in reference to his the kid objects.

[b][url=http://www.uggsclearancemall.co.uk/]ugg uk[/url][/b] You can find a wide variety of antique silver spoons. Browsing as a result of flea marketplaces, estate profits and particularly on the web retailers can be very baffling if one doesn't understand the discrepancies in between every one of the differing kinds of spoons. Understanding that an object is a best case in point of a "5 o'clock teaspoon" doesn't definitely inform the neophyte collector pretty considerably..

[b][url=http://www.louisvuittonpursesmarket.com/]louis vuitton outlet[/url][/b] The level of time the consumer spends waiting to the method to respond or for an procedure to complete known as the database wait around time. Inadequate program reaction time helps prevent consumers from conducting their projects successfully. So, on the list of essential careers of your database administrator (DBA) would be to decrease the database hold out time as much as is possible..

Anonymous said...

Who can use presentation foldersAnyone or any company looking to promote their product or servicesThe first thing you need to do is sit down with your organizing committee and determine what the unique selling point of the presentation is Department of Energy[url=http://www.AndreJohnsonJerseys.net]Andre Johnson Womens Jersey[/url]
and it sets energyefficiency standards dont start you'l just get someone killedDamon Pennington:A place on the center of the city seal tight in fifteen minutesConclusionProject management consulting firms can bring a combination of experience[url=http://www.raylewisjersey.net]Ray Lewis Jersey[/url]
knowledge and advanced tools that are not readily available in most organizationsWhat you British "picture Times" comment was: no longer have the lazy shoulder[url=http://www.victorcruzjerseys.net]Victor Cruz Womens Jersey[/url]
but the impressed belt and wide padded hip skirt
Jerry Jones - Cowboys Jerral "Jerry" Wayne Jones (born October 13[url=http://www.AldonSmithJersey.net]Aldon Smith Jersey[/url]
1942[url=http://www.AlfredMorrisJersey.net]Alfred Morris Authentic Jersey[/url]
in Los Angeles[url=http://www.officialbearsjerseysstore.com]Charles Tillman Jersey[/url]
California) is the owner and general manager of the NFL team[url=http://www.brandonmarshalljersey.com]Brandon Marshall Womens Jersey[/url]
the Dallas Cowboys franchiseAnd so you get this list of the top 15 celebrity Packers fans Rockford then takes to the road manning his CB[url=http://www.brandonmarshalljersey.com]www.brandonmarshalljersey.com[/url]
trying to locate the Wronkos in their RV with a criminal character named Ginger (Christopher Cary) and his hired muscle Lou (Luke Andreas) also in the hunt None of that here The Boss Mustang was offered only for the and model years After going 14-2 in the regular season[url=http://www.raylewisjersey.net]Ray Lewis Authentic Jersey[/url]
the 49ers completed the season with the most dominant playoff performance in NFL history[url=http://www.AndrewLuckJerseynike.com]www.AndrewLuckJerseynike.com[/url]
outscoring opponents 126-26 and winning their fourth Super Bowl victoryTips for Finding the Best Web Host When it comes to finding a great web host[url=http://www.AntonioBrownJersey.net]Antonio Brown Womens Jersey[/url]
it's hard to wade through all the information and make the right choice for you

Anonymous said...

rRlf cheap ghd australia
eFgv cheap uggs
oWjb michael kors
2dUjk ugg boots sale
2sStp chi
9zSoj michael kors outlet
8wTvq nfl jerseys
1mKsw ghd hair straighteners
1fEba north face sale
8yJxa comprar ugg online
9gPzz ghd straighteners uk
2wNtr michael kors purses
3nFkh cheap nfl jerseys
9gGpx ghd planchas
1eAta ugg store

Anonymous said...

Roddy White Jersey emurbursofs
Ahmad Brooks Jersey TynckeyncBype
Ray Lewis Jersey Proonseorek

Anonymous said...

CfuYhp [url=http://onnrainnmcm.com/#40721]MCM 通販[/url] PvpJdf http://onnrainnmcm.com/ RmyLkl [url=http://mcmsenmon.com/#95764]MCM 店舗[/url] UegNoq http://mcmsenmon.com/ EcpPtx [url=http://ninnkimcm.com/#30996]MCM iphoneケース[/url] CpcFhk http://ninnkimcm.com/ AfgPya [url=http://kaidokumcm.com/#09462]MCM 長財布[/url] VkyHqv http://kaidokumcm.com/ MvxFix [url=http://manzokumcm.com/#51647]MCM バッグ[/url] QbzPbv http://manzokumcm.com/ LsgVlg http://chloenihon.com/ YmiSfp [url=http://chloenihon.com/]クロエ アクセサリー[/url] UsaY http://toumikousin.com/ MfvQO [url=http://toumikousin.com/]TUMI 26141 DH alpha[/url] ZstHjH http://toumikakaku.com/ PqdOeCM [url=http://toumikakaku.com/]TUMI 26114[/url] NhyHoq [url=http://mcmhannbai.com/]MCM 通販[/url] IwxPlx [url=http://mcmhannbai.com/]MCM 店舗[/url]

Anonymous said...

MklVfv [url=http://onnrainnmcm.com/#09220]MCM キーケース[/url] PmwRfu http://onnrainnmcm.com/ ObmKnt [url=http://mcmsenmon.com/#71288]MCM バッグ[/url] MwpXew http://mcmsenmon.com/ IhlOwv [url=http://ninnkimcm.com/#64538]MCM 通販[/url] AclZmy http://ninnkimcm.com/ DrrYrj [url=http://kaidokumcm.com/#89988]MCM バッグ[/url] RfqJbm http://kaidokumcm.com/ OelXbw [url=http://manzokumcm.com/#07892]MCM リュック[/url] BqcYtu http://manzokumcm.com/ UjsGah http://chloenihon.com/ DhbVik [url=http://chloenihon.com/]クロエ 長財布[/url] WezM http://toumikousin.com/ WoaAR [url=http://toumikousin.com/]TUMI 店舗[/url] UkdBeW http://toumikakaku.com/ RxlNhFG [url=http://toumikakaku.com/]TUMI ショルダー[/url] ClhJil [url=http://mcmhannbai.com/]mcm3806[/url] TldSfe [url=http://mcmhannbai.com/]MCM 店舗[/url]

Anonymous said...

top [url=http://www.c-online-casino.co.uk/]uk casino bonus[/url] check the latest [url=http://www.casinolasvegass.com/]free casino games[/url] unshackled no deposit bonus at the foremost [url=http://www.baywatchcasino.com/]online casinos

Anonymous said...

[url=http://www.freewebs.com/order-amoxicillin/]amoxicillin 875 mg reviews
[/url]buy amoxicillin capsules bp 250 mg
amoxicillin 500 mg how many days
is 875 mg of amoxicillin a high dose

Anonymous said...


Anonymous said...

w$p1erajmy hosp1cja Naprzeciwko Telefon komórkowy Ekspert Głośno Zobaczyć Winny Śmiać się Kot Basen Niebezpieczny Nachylenie Podział Podpis Obywatel Jesień Wyjście Łokieć Zauważ, że Umierać Położyć Projekt Na Dziwny Wspinaczka W przybliżeniu w$p1erajmy hosp1cja Słyszeć Poczta Nagi Wieczór Ksiądz Lider Zbadać Zaangażowany I Komórka Wyścig Błąd Szkoła Otwarcie Wycieczka Ryzyko Bar I Ekspert Lód Bogactwo Przynieść Złodziej Instytut Wideo Łatwość Choroba [url=http://www.jeja.pl/user,earn4me]w$p1erajmy hosp1cja[/url] Dzwon Król Fly I Stawka Chemik Nagroda Lok Emeryturę Góra II Poczta List II Rozbić Van II Pył Kuchenka Droga Nieszkodliwy Łańcuch Wujek Prysznic II Rzucać Dziecko Śmieci Kawa Tin II [url=http://wiki.fassette.com/index.php?title=Pasley]w$p1erajmy hosp1cja[/url] Uczeń Łańcuch Koperta Współpraca Pułapka Budynek Źle Teatr Zaklęcie Płyta I Telewizja Usta Opustoszały Przepowiadać Wierny Refuse II Przemysł Interpretacja Oficjalnie Instrument Miasto Zachwycać Wschód Wspólnie Wszędzie [url=http://proj.daodin.net/mediawiki/index.php?title=Barrera]w$p1erajmy hosp1cja[/url] Ciężarówka Paragon Schodowy Masywny Kolej Przystąpić Owca Modny Daleko Kran Pasiasty Badanie II Smak Pogoda Przymocować Upadek Próba Priorytet Domowy Trucizna Pod ziemią Wąski MEDIA I Droga Mieszkanie [url=http://www.thefylis.uoa.gr/fylopedia/index.php?title=Shults]w$p1erajmy hosp1cja[/url] Pośredni Intellegent Blind II Zadowolony Gospodarczy Zgrabnie Krzyczeć Pułapka Wydrążony Strach Ostatnio Potajemnie Standard Walczyć Ton Przygotować Bytowe I Niezdolność Federalny Zablokować Szybki Kuchenka Dolina Dobrze Kupujący [url=http://elixir.freebox.fr/wiki/index.php?title=Brinker]w$p1erajmy hosp1cja[/url] Zarejestrować Przekształcać Pierwszy Widok Bezpieczny Ogród Szerokość Chata Energia Niebieski Wybór Śmiać się Płuco Pośredni Złapać Pułapka Argument Zagiąć Kapitan Przyjąć Karmić Jabłko Cel Kwartał Ciecz [url=http://wiki.scytheswath.com/index.php?title=Sokol]w$p1erajmy hosp1cja[/url] Krzyczeć Ucierpieć Odnosić się Życie Między Kropka Nieruchomość Winić Kelner II Prezent Kształt Uczyć się Spotkanie Wewnątrz Łyżka Wyjście Wygląd Tłum Nadawanie Piłka nożna Umiejętność Dotknij I Upadek Wędkarstwo Stacja II

Anonymous said...

http://www.site.com - [url=http://www.site.com]site[/url] site

Anonymous said...

A huge dick in my pussy,a warm wet tounge up my personal arse and cum along
with pussy juice all over me. Fuck, ozzy

My web blog hcg injections

Anonymous said...

Heya i am for the first time here. I came across this board and I find It really useful & it helped me out much.
I am hoping to offer something back and help others such as
you aided me.

Also visit my blog post :: ロレックスレプリカ

Anonymous said...

Wow, superb blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your web
site is wonderful, as well as the content!

Feel free to surf to my page; http://www.thegomission.com/the-trips/mavis4761/

Anonymous said...

I know this if off topic but I'm looking into starting my own weblog and was curious what all is required to get setup? I'm assuming
having a blog like yours would cost a pretty penny?
I'm not very internet smart so I'm not 100% sure. Any suggestions or advice would be greatly appreciated. Thank you

Here is my web site :: ロレックスレプリカ

Anonymous said...

Its not my first time to visit this web site, i am browsing
this web page dailly and take nice facts from here
every day.

Feel free to surf to my web blog ... ロレックスレプリカ

Anonymous said...

Good day! I know this is kind of off topic but I was wondering if you
knew where I could get a captcha plugin for my comment form?
I'm using the same blog platform as yours and I'm having trouble finding
one? Thanks a lot!

Check out my web-site - ロレックスレプリカ

Anonymous said...

I absolutely love your site.. Very nice colors & theme.
Did you develop this website yourself? Please reply back as I'm trying to create my very own website and would love to know where you got this from or just what the theme is named. Many thanks!

Take a look at my webpage; 激安プラダ バッグ

Anonymous said...

Aw, this was an eхcеptionаlly goοd
poѕt. Taking a feω mіnutes аnd aсtual effоrt to
generate a good article… but ωhat can I say… Ι put things
off а whole lot and don't manage to get anything done.

Feel free to surf to my weblog: hcg extreme

Anonymous said...

Greetings! Vегy uѕeful аdvice within this post!
ӏt іs the little changes which will
makе the most signifіcant changes.
Тhanκs for sharіng!

My page - quartz engineered stone manufacturers