Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to handle objects

Started by Torquai Oct 13, 2001 at 6:56 AM 5 replies 200+ views
Original Post
Torquai
Torquai
I am trying to write a small RGP type game and trying to figure how to handle all the objects, weapons, ammo, containers, clothing and just wondered how other people handle them, do you write objects (I am programming Delphi and very used to working with objects, but I feel that maybe unneccessary) or use text blocks or datablocks, or maybe there is an entirely other way to handle a lot of objects, since, ammo may be put in containers or weapons, weapons in containers a.s.o thanks for any help -Torquai tl@digitalteknikk.no
-Thomas LøvlieSemi-Pro Delphi Developer
tom76
tom76
I''d be interested in this one too. Mate if you solve it post a bit of code up as an example.

Observe everything, remember more!
if (witisism == !witty) return to_hole
tom76
tom76
oh you''re from Norway - Ha det! (can''t remember the ALT codes for the symbols lol)

Observe everything, remember more!
if (witisism == !witty) return to_hole
krez
krez
i would use objects, but that is because i like all of my items and weapons and stuff self-contained... with a lot of scripting and private members and whatnot... if you just use an array of some non-object data types, you will have a lot of code hanging around somewhere to handle all the details for them, and once your game gets to any decent size it will be very confusing. with objects, you can put it all in the objects, so when you have a problem with your potions, you know exactly where to look for the bug.

--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Torquai
Torquai
I am using objects but I get the problem copy copying objects, because I have for example Ammunition (object) in a weapon (another object) in a pocket (yet another object) that belongs to a jacket (4th object).

So my problem is when copying the objects, I hoped there would be a better way but I guess Ill have to traverse the object(s)

Thanks guys
-Torquai
tl@remove@digitalteknikk.no
-Thomas LøvlieSemi-Pro Delphi Developer
Peon
Peon
I''ve always used arrays to handle objects... Hmmm Hehe j/k. I''m a newbie, but that''s how I do it. Right now I''m programming a text based wargame (with ASCII character graphics, woohoo!) but I handle all the equipment and weapons with arrays. Then again, you can''t put things in any thing like a container, either. I was thinking though (without knowing a whole lot about them) that linked lists would be useful for what you''re doing?
Peon
krez
krez
quote:
Original post by Torquai
I am using objects but I get the problem copy copying objects, because I have for example Ammunition (object) in a weapon (another object) in a pocket (yet another object) that belongs to a jacket (4th object).

you can put a member in your classes such as "InMe" which is a collection. when you want to put something inside your pocket, just add it to this collection.
quote:
So my problem is when copying the objects, I hoped there would be a better way but I guess Ill have to traverse the object(s)

i don''t really undferstand what you are asking here... please clarify?

--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.