GENSOUND and Memory

Previous topic - Next topic

Moru

Yes, that is exactly what I meant. About the string check, depending on how you build your type, you can have all the data connected to the monster like what sprite ID, what sound ID, behaviour and whatever in the same type. That way you don't have to wonder what sound to play, just play the sound connected to the monster or object.

kanonet

#16
Ah hmm right, there is your comment. :D
At least I did mention BREAK so it wasnt a complete usless post. Of cause there is no point in storing the return value of LOADSOUND in the local variable ok%, if you never check/use it, you can just get rid of everything that stands before LOADSOUND.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Darmakwolf

Quote from: kanonet on 2013-Oct-11
You should call BREAK after you played the sound. I mean if you have 100 wavs loaded, call fplay and the sound that you want to play is number 3, there is no need to look the rest of the array and check the other 97 entrys.
Besides this, I would not like the string checks, strings are to slow and a waste of exection speed and memory space IMHO.

I noticed that after I posted it and fixed it :P I didn't get much sleep that day.  :D

Darmakwolf

Quote from: kanonet on 2013-Oct-11
You should call BREAK after you played the sound. I mean if you have 100 wavs loaded, call fplay and the sound that you want to play is number 3, there is no need to look the rest of the array and check the other 97 entrys.
Besides this, I would not like the string checks, strings are to slow and a waste of exection speed and memory space IMHO.

Well I was half awake when I typed the code, I realized it lacked return. In this case, I have no problem with sacrificing a negligible amount of performance for ease of programming and flexibility. My game uses no more than 45 MB total at any given time of RAM, and deals with the tiniest resolution (256x224...) I am not trying to squeeze ounces of speed out of a complex 3D game. In my case, it's very useful for a small sprite-based project. I'm pretty sure even my grandmother's computer has 4GB RAM.

spacefractal

im do the same thing with strings in Greedy Mouse, howover even more complex than those code for avoid numbered ids. So its should been no problem at all. Alternative most time the sound mightbeen the same, so you could do a STATIC lastsound as well, which might could reduce cpu time......

Im also never liked the numbered id of things. Alternative you could also do GENSOUND to variables and uses those as ID as well.

But thee is no problems with strings well sound as well images.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/