开发者

How to make RTS units

I want to make units fight in space just to try out some stuff it woul开发者_开发百科d need to print whats going on and results. I'm planing on loading each unit from a separate file or similar (units will be modifiable so i think it should be better this way, no need to keep each unit stats for instancing). I'm not sure how i would load the units. Is the question too broad? A link to something similar would be helpfull i couldn't find anything


There are a bunch of different ways of handling this, depending on exactly what you are trying to save and how you want to use it.

If you want to save basic unit-type stats so they can be easily modified, a plain-text file or csv file would work nicely. (If you have a copy of the game Alpha Centauri, look at the faction definition files - should give you lots of ideas!).

For the ultimate in flexibility, you could save your units as Python source-files and import as needed. But too much "flexibility" can also make debugging nasty. A half-way step would be to definite your own 'unit definition language'

You could use cPickle if you just want to save and reload units, not edit them; this might be useful for savegames.

For graphics or 3d models, a lot of game engines (Panda, pyOgre, etc) have binary-format support built in.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜