ID:152831
 
I have thought alot of this question and thought some more and couldn't really come up with an answer: When coding a game, is it really necessary to do complicated lines of code to do a simple task? For example, lets say you were making a guided - (something). Could you not just use for(var/mob/M in oview(blah)) missile(blah,src,M) instead of typing in more code? I suppose I just wanted to know the advantages of doing things simply instead of more complicated.. Of course going about things with more code could simplify the process and make sure that if it doesn't work the game is not affected, so could someone give the advantages/disadvantages of doing something simply to doing something more advanced? [Edit] Sorry if this is confusing.. I really have to get off the pc soon..
Its kidna better to do more advanced things to have less bugs and such. In my eyes, the more complicated it is(the mroe checks involved) the smoother the ocde will be. Example :
mob
verb
Attack(mob/M in oview(1))//simple enuff, but will get error messages sometimes
M.hp -= usr.str


A more complicated code would probably check to see if the opponent is still within range or something like that..In the process of making this post, I pretty much forgot my thoughts..>_>
Mostly it's about doing what works. In your example, you could use missile(), but for most purposes it wouldn't work as well as creating your own projectiles because it's a purely graphical function--it doesn't actually tell you when the missile hits or where it hits. So, it only truly works when you want an attack that automatically hits with a set impact time and doesn't have to worry about hitting any barriers, and has a specific target selected ahead of time. Really, the only use I can think of it is if you had, say, a battle screen set up (such as, for example, something along the lines of a Final Fantasy game) and wanted to use it for spell/attack animations in turn-based combat--in any kind of realtime or even slightly action-based combat where everyone's running around at once, it just doesn't fit in right.

Of course, that's just one example, but the same principle applies elsewhere. Do things as simply as you can in order to get them to work right and work well, but don't just settle with what's simplest or easiest if it has any side effects you don't want.
In response to Mecha Destroyer JD
Hm.. I spose you're both right.. I dunno, I just get mad at times cause when I really think up something good to do with DM I can't code it right.. Then most people would say 'You just need more practaice.' Really, coding something IS practaice, isn't it? Then when you get it right it's just like a lesson you passed.. Or so my Computer Programming teacher said..
In response to Lotho
Me myself I prefer to do things not the complicated way but the most effecient way.If you've read anything about DM or if you've ever compared it to C or C++ you'll notice that DM is slower,so functions and other macros done in those languages have a bit more head room to do all the neccassary proccesing.SO I believe that in order to compensate for that I should make sure that Im not the one making my game slow.DM is(very unlikely).
To summarize really,Dont look for advice on which way to code things (when it comes to style) If you code dont try to make it Fun-to read or Easy on the eyes make it so that the compiler/Seeker will always have some room to 'fiddle with its fingers' after every tick.


Itanium