Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

UNIT MANIPULATION IN 3D GAME LIKE STARCRAFT

Posted on 2003-11-20
5
217 Views
Last Modified: 2013-12-04
Greetings!

I would like to deliver this question to all game coders.

I would like to ask about:

* How those unit like "marines" or "zealot" being process by the program?
* How are they being multiplied in the game?
* How is the game engine related to this kind of game?
0
Comment
Question by:oblivioncode
5 Comments
 
LVL 1

Accepted Solution

by:
aligma earned 50 total points
ID: 9792511
oblivioncode,

I can't give a definitive answer as to how these units are created, but I can tell you how I would do it...

All units have common propreties, such as health, attack damage, range, and movement speed.

I would create a base class which defined all of these properties and provided the basic unit interface.. an example of one method would be IsDead(), if IsDead returned true, then the unit would explode in the shower of blood or explode or whatever it is that unit does.

Then for each unit, for example marines, I would _inherit_ the properties of the base class, and add new properties and methods such as UseStimPack().

Inheritance is an object oriented concept which you can read about on many object oriented tutorials..
"inheritance - the process whereby a derived class inherits members from a base class. A derived class will also add its own members to those of the base class. "
-http://www.glenmccl.com/glos.htm#tag114

When I had created an individual unit, I would store it in a unit Vector. A vector is basically a list which you can store objects in. Then when I was, for example, checking the health of my units, I could just iterate through the vector and check each one's health individually.

I hope this helps.
0
 

Author Comment

by:oblivioncode
ID: 9796037
Thanks aligma,

Great help from you... what im afraid of is the congestion of the program.... im afraid of the infiniteloop.... but i guess that doesnt matter.. but is it ok to use that infinite loop... coz im totaly curious why it doesnt have any delay at all... but great help.. i really appreciate it.. anyone who had somethin else in mind that can help me through this problem..
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This is about my first experience with programming Arduino.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question