ID:264941
 
Problem description:
Which is more efficient, Creating an image, Or creating an Obj to make an effect, For example

Code:
mob
verb
Test_Img()
var/image/I = image('Hitspark.dmi',usr,icon_state ="hit")
world << I
spawn(3)
del(I)

Test_Obj()
var/obj/Test/A = new
A.loc = locate(usr.x,usr.y,usr.z)
flick("Hit",A)
del(A)


Again my question would be which is more, efficient for an effect that will be used.. Frequently.

Or if there is a more efficient way to do either please inform. Thank you in advance.
It depends on who is going to see it. If you want the effect to be one person only, then an image is the only one you can use.
In response to Jotdaniel
var/image/I = image('Hitspark.dmi',usr,icon_state ="hit")
world << I

Would show it to everyone in the world at the moment.. Which is obviously what i want to do...
In response to Elric Brothers
Well, you have more control over an object, but an Image probably doesn't have as much overhead, its really up to you. As long as your not spawning thousands of objects for this one application it shouldn't really matter.
In response to Jotdaniel
Jotdaniel wrote:
Well, you have more control over an object, but an Image probably doesn't have as much overhead, its really up to you. As long as your not spawning thousands of objects for this one application it shouldn't really matter.


The Question im asking is very upfront if you don't have an accurate answer please don't respond.. I'm sorry if i sound rude but you are not helping in anyway your just expressing your opinion. Which is not exactly what i asked for. I asked for a fact on which is More efficient.. and you continue to respond is ways that don't answer this question. Please stop and let some one who actually knows give it a try? Thank you.. Again i apologies if i am being rude.
In response to Elric Brothers
Elric Brothers wrote:
Thank you.. Again i apologies if i am being rude.


You are actually. Your not explaining your issue very well, and efficiency is based solely on the needs of the program. If you need to do things other than just display the image and then make it go away, an object would be better suited to your needs. If you just need to display the image on one user, than an image may be better suited to your needs.

Efficiency is only relevant when you know what exactly your trying to do, and since you didn't actually tell us exactly what your trying to do, this is the best answer your going to get.
In response to Elric Brothers
He did tell you, and if you really wanted to know, why didn't you just test it yourself?

mob/verb
imageTest()
var
timeofday=world.timeofday
image/I
for(var/i=1 to 500)
I=image('Pow.dmi',usr)
world<<I
spawn(5)del I
world<<"Took: [(world.timeofday-timeofday)/10] seconds."
objectTest()
var
timeofday=world.timeofday
obj/O
for(var/i=1 to 500)
O=new(usr.loc)
flick('Pow.dmi',O)
spawn(5)del O
world<<"Took: [(world.timeofday-timeofday)/10] seconds."


EDIT: you could also check CPU usage/profile or jack up the numbers in the for loop.