creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
ENUM/ETCH/ESEE   
Geek2Nurse

Geek2Nurse
United States  

 visit Geek2Nurse's website: Adventures in Nornia
  5/4/2012

Is there a way to break out of these loops, or you you just have to let them loop to completion? For example, if I just want to know if there are X number of a particular sort of agent, but don't care how many more than that there actually are, do I have to let the loop finish once it's found that many, or can I tell it to stop and move on to the next line of code?

---
Optimist: the glass is half full.
Pessimist: the glass is half empty.
Engineer: the glass is twice as big as it needs to be.

 
Moe

Moe


 visit Moe's website: Creatures 2 to Docking Station
  5/5/2012

Unfortunately, to my knowledge, there's no simple way to have it stop mid enum/etch/esse. There *are* ways around it, but nothing practical to implement.

Although enums and such should be used sparingly, they don't, in isolated uses, cause much of a hit in performance, so there's no reason to not let them run.

Just make the command inside the enum/etch/esee stop counting after a certain number.

*where X is the amount you're looking for
setv va00 0
enum [fmly] [gnus] [spcs]
doif targ ne null and va00 lt X
addv va00 1
endi
next


The loop runs it's course, but it doesn't record what you don't need to know, and for every agent it calls after the X requirement is satisfied, it basically does nothing, which is performance friendly.

 
Geek2Nurse

Geek2Nurse


 visit Geek2Nurse's website: Adventures in Nornia
  5/5/2012

Okay, thanks! While we're on performance, what about the mira command? I'm guessing it's probably cheaper performance-wise to have mirrored sprite sets in the image files rather than mirroring on the fly, but I don't know for sure. Any idea?

---
Optimist: the glass is half full.
Pessimist: the glass is half empty.
Engineer: the glass is twice as big as it needs to be.

 
Liam

Liam


 visit Liam's website: Spellhold Studios
  5/5/2012

You're completely right, it's much cheaper to do it in the file than to use MIRA (which can get pretty expensive, as can TINT.)

- Liam / K'aeloree

Spellhold Studios, a Baldur's Gate II, Neverwinter Nights and Oblivion Modding Community

 
Geek2Nurse

Geek2Nurse


 visit Geek2Nurse's website: Adventures in Nornia
  5/5/2012

Thanks, Liam! It's good to know I didn't waste all that time in PhotoShop tinkering with the starflowers! ;)

---
Optimist: the glass is half full.
Pessimist: the glass is half empty.
Engineer: the glass is twice as big as it needs to be.

 
Horstj

Horstj



  5/5/2012

What about something like this:

setv va00 0
enum 1 2 3
addv va00 1
doif va00 eq 42
stop
endi
next
outs "There are less than 42 of 1 2 3"

 
Liam

Liam


 visit Liam's website: Spellhold Studios
  5/5/2012

STOP exits the script entirely, so it wouldn't work in this instance because VAxx variables only exist within a particular instance of a script (and thus by exiting said script any data saved to any VAxx variable is deleted).

In addition, you probably don't want to exit out of the script, because chances are you'll actually be in the middle of something important if you're running something like this. :)


- Liam / K'aeloree

Spellhold Studios, a Baldur's Gate II, Neverwinter Nights and Oblivion Modding Community

 
Ghosthande
Prodigal Sock

Ghosthande


 visit Ghosthande's website: Breeders Beware
  5/5/2012

AFAIK, mirrored objects don't show up in cameras anyways? So that's another concern about using them, especially for worlds like C2toDS that use cameras a lot...


 
Moe

Moe


 visit Moe's website: Creatures 2 to Docking Station
  5/5/2012

You know I heard the same thing about Mira'd objects...

So I just did a really quick test in DS using the default remote floating cameras, I MIRA'd the toy robot and then put the camera near him, then went to the Comms room and he showed up just fine. Also tested on a yarn fruit.

You can't alpha them, but you can tint them, and they always show up on camera.

Any thoughts on this test?

In case anyone's wondering, I think the reason MIRA'd sprites hit performance, is because when you MIRA an object, the engine copy's it's sprites and puts them in RAM, flipped. Same with TINT'ed objects. In my opinion, this doesn't make a difference performance-wise if you need every frame in your sprite file flipped anyway, because you might as well just MIRA it, because you'd double the file-size anyway by replicating all it's sprites flipped. The only problem you have is that the engine has to take a [micro]second to shunt the flipped sprites to RAM. But that's hardly noticeable. I'm not positive this is how it works, but it's probably something similar.

Anyone have any thoughts?

 
AquaShee

AquaShee



  5/5/2012

The biggest performance hit when using tinted objects comes from the increased amount of unique sprites that have to be rendered.

It's a lot easier for the engine to render the same sprite a hundred times (even if they're all in a different part of their animation, I'm pretty sure the engine turns sprite files into a virtual 'sprite sheet' using the numbers supplied with the new: command) than it is to render a hundred different sprites. And since a lot of tinted objects also like to have random variations in their tint it can add up quickly.

I'm not sure if the engine even groups identical sprites with identical tints together.

I remember Ghosthande's portal-shooting thingamajig not showing up in its own portals when MIRA'd, I'd also heard the MIRA-not-on-cam thing and blamed it on that, but the CAOS docs don't reference it anywhere. Maybe it was a pre-DS thing?

I'm not sure if MIRA'd objects get their own gallery though. I think they're literally mirrored, as in telling the engine to just start drawing the pixels in reverse order. It would be the quickest and least resource-intensive solution to mirror a sprite. The same technique wouldn't work for tinting so they get their own new sprite file which gets saved with the world. So tinted objects also increase save size.

We should do a stress-test; actually. Render a 1000+ bouncy animated balls in a new DS world, check the framerate, and repeat the process for all variations of tints, mira and alpha.


The Community Scribble: make (y)our own metaroom!
 
Moe

Moe


 visit Moe's website: Creatures 2 to Docking Station
  5/5/2012

I can vouch for TINTed objects being horrific on performance. My Christmas 09 pack uses tints, and if you open too many presents at once, the shreds will kill the FPS. lol Only on creation though. Must be the engine loading tinted sprite sheets.
 
ylukyun
Patient Pirate

ylukyun

Manager



  5/5/2012

Do pigmented creatures' sprites work in a similar way to those of tinted objects?
 
AquaShee

AquaShee



  5/5/2012

Yup, pretty much. If you explore the folders where your worlds are saved a bit, you'll stumble upon sprite files with tinted Norn sprites. Every world has these though, so the slowdown of these is not really a bother.

The Community Scribble: make (y)our own metaroom!
 
mfb

mfb


 visit mfb's website: Shee Tea Shop
  5/5/2012

AquaShee wrote:
If you explore the folders where your worlds are saved a bit, you'll stumble upon sprite files with tinted Norn sprites.


Whoa, seriously? That explains where some of my worlds were getting size bloat from :x I guess it's better than chewing CPU to tint them in real time but dang!


Shee Tea Shop
 


downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
0 online
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki