|
Another entity question Displaying 1-20 of 54 total.
12 3
next
gungnir
|
Is there a way to manipulate an entity's frames directly? That is to say, could I replace one or more frames of an entity that is already loaded with a new image? I notice that there is an entity.frame[n] variable, but it appears to be just an indication of what frame is currently shown. Is there an (undocumented) entity variable (array, obviously) that points to the frame images themselves?
I would like to be able to represent what an entity is wearing for armor and such by changing the entity frames whenever they change armor. I know there is the ChangeCHR function, but that is not a practical solution considering the number of different combinations of armor you could have.
I also figure that if no other solution exists, I could just 'overlap' each entity with the correct image... that, or scrap my idea altogether :P
Thanks,
/g
Posted on 2004-09-19 21:52:59
|
vecna
|
No.
Best way is to use HookEntityRender. could blit your armor images on top of a base CHR eg paperdolling. Uses a lot of art resources, though.
Posted on 2004-09-19 22:02:56
|
gungnir
|
That's cool.
Thanks,
/g
Posted on 2004-09-19 22:16:26
|
Zip
|
Yes... another thing verge is not good with. Down to not having unique chrs for each entity, vec said previously. Like many things, it is workable roundable, and I have code for it, so say if you want it. Also, don't worry about resources... the main problem is the chr files are completely redundant, but you still have to use them because of the restrictive way verge is programmed.
Zip
Posted on 2004-09-19 23:58:15
|
mcgrue
|
Zip shutup mode activate!
Posted on 2004-09-20 00:38:04
|
Toen
|
Quote:Originally posted by mcgrue
Zip shutup mode activate!
Biter.
Posted on 2004-09-20 00:40:30
|
vecna
|
Shit, look. Most maps are going to have more entities than they will have CHRs. Thats why the CHR caching thing was put in.
But OK FINE. I'll take it out, and make every entity have its own COPY of the CHR regardless of if its some demo with 100 darins on a map, don't laugh, its been done. :D
Posted on 2004-09-20 00:41:54
|
mcgrue
|
Isn't the v3 creedo 'memory conservation is for pussies', anyways? :D
Posted on 2004-09-20 00:48:15
|
mcgrue
|
Quote:Originally posted by Toen
Quote:Originally posted by mcgrue
Zip shutup mode activate!
Biter.
What, nobody else can activate shutup mode? :(
Posted on 2004-09-20 00:52:54
|
Toen
|
Quote:Originally posted by mcgrue
Quote:Originally posted by Toen
Quote:Originally posted by mcgrue
Zip shutup mode activate!
Biter.
What, nobody else can activate shutup mode? :(
You CAN, but you have to pay royalties.
Posted on 2004-09-20 00:53:37
|
mcgrue
|
Oh, Great Capitalism, I have been a loyal follower... why hast thou forsaken me? ;_;
You shall get your 'Royalties', Toen. I will pay you one million. Is that acceptable?
Posted on 2004-09-20 01:00:18
|
vecna
|
Quote:Originally posted by mcgrue
Isn't the v3 creedo 'memory conservation is for pussies', anyways? :D
One would think so. I always thought so. But when we were doing VO, zeromus was ranting about how we need a separate thread for loading characters and their paperdoll crap. I naturally thought he was bat-shit insane. But when we ran some fairly reasonable numbers, I conceded that the volume of data and memory we were talking about was not to be taken lightly.
Its very, very possible for maps with large numbers of entities and chrs bigger than 16x32 or with large numbers of frames to use LOTS of memory in uncompressed 32bit when you don't have CHR caching.
But I wash my hands of it! You win! Odds are most people won't run into problems with it, so be it.
Posted on 2004-09-20 01:08:49
|
vecna
|
An example.
Lets imagine you want to use 48x48 CHRs. thats reasonable. Thats what VO CHRs were.
Lets say you have 50 frames. High, but reasonable, if you're including battle frames. VO had more than 50 frames. Closer to 100 frames, if I remember right.
Lets say you have only 100 entities on the map.
48x48x50x4x100 = 46 megs of RAM.
Thats totally not counting the occasional BIG chr for whatever reason. a 100x100 or larger CHR. And the hardcoded entity limit is 256, I've seen a handful of maps with >100 entities.
If there were only 10 unique CHRs on that map, then with CHR caching it'd have been 4.6 megs of runtime ram usage.
When you have CHR caching, on the assumption that you're probably not going to have a lot of UNIQUE chrs that size, you can have rediculously sized CHRs with as many frames as you like, and you'll basically never use a sizeable amount of ram.
46 megs of RAM is not a lot for me. I have a gig of ram. Thats not a worst-case scenario though, and thats only CHRs, not counting anything else that needs to be loaded. Any map with high number of entities, closer to the hard limit, will be using a lot of RAM, enough to make windows start paging stuff, even if you haven't run out of physical RAM free.
Posted on 2004-09-20 01:19:03
|
Toen
|
Quote:Originally posted by mcgrue
Oh, Great Capitalism, I have been a loyal follower... why hast thou forsaken me? ;_;
You shall get your 'Royalties', Toen. I will pay you one million. Is that acceptable?
Your negotiation tactics are EMBARASSINGLY PATHETIC
Posted on 2004-09-20 01:35:03
|
Zip
|
32bit? What, we have an alpha layer but not using it? Err... anyway, didn't wanna cause trouble. For the mean time, here's a little code.
Load from a plain text datafile: // Critter file for Darin
darin.png // Image file for Darin (image)
darin.chr // Chr file for Darin (loaded to ent)
6,5 // Rows by colums of frames in image (imx,imy)
16,32 // Width by height of frame (framex,framey)
1 // Frame padding (fpad)
// To come later: colour data Then instead of using: int hotx_on_screen = entity.x[critter[c].ent] - xwin;
int hoty_on_screen = entity.y[critter[c].ent] - ywin;
int frame = entity.frame[critter[c].ent];
BlitEntityFrame(hotx_on_screen, hoty_on_screen,
critter[c].ent, entity.frame[critter[c].ent], image); You use this (which is much less scary than it looks): int x_on_screen = entity.x[critter[c].ent] - xwin - entity.hotx[critter[c].ent];
int y_on_screen = entity.y[critter[c].ent] - ywin - entity.hoty[critter[c].ent];
int frame = entity.frame[critter[c].ent];
int startx = (frame % critter[c].imy) * (critter[c].framex + critter[c].fpad);
int starty = (frame / critter[c].imy) * (critter[c].framey + critter[c].fpad);
TGrabRegion(startx + critter[c].fpad, starty + critter[c].fpad,
startx + critter[c].framex, starty + critter[c].framey,
x_on_screen, y_on_screen, critter[c].image,image); Speed is fine.
Zip
Posted on 2004-09-20 01:37:35
|
mcgrue
|
Quote:Originally posted by Toen
Quote:Originally posted by mcgrue
Oh, Great Capitalism, I have been a loyal follower... why hast thou forsaken me? ;_;
You shall get your 'Royalties', Toen. I will pay you one million. Is that acceptable?
Your negotiation tactics are EMBARASSINGLY PATHETIC
Damn. Can't play a playa.
Posted on 2004-09-20 01:45:12
|
Zip
|
Damn... now I HAVE to make the converse argument to vec.
You know the best thing about Milk? The memory it saved from having all those identical darins.
But seriously... how many verge games have 48x48x50 chrs? How many vergers are good enough and have the time to draw a game full of art like that? And then lack the style to do anything other than spawn endless duplicates on a map? And run it on ovk's computer?
Compared to that, how many vergers would like to do a game where each entity DOESN'T look the same? Have a simple way of changing the an entities sprite if their equipment changes? Have a way colour shifting entites for a bit of varity? Or just have a run animation different to the walk one?
Added to all this the fact that Chrmak5 is not... the most graphically interfaced of programs, and you waste a lot of time, effort and fps coming up with soulutions to a memory saving issue that no verge game has ever run into. Hell, first time a verge game does, I'll help them make maps which only spawn the entites for one section at a time.
Zip
Posted on 2004-09-20 02:17:00
|
vecna
|
Quote:Originally posted by Zip
32bit? What, we have an alpha layer but not using it?
All graphics resources are converted once they're loaded to the native video bitdepth. So yes. All graphics are stored in either 16 or 32bpp. Its either that or do bitdepth conversions at blit time, and that's just silly. Wasting RAM is smarter than wasting cycles in this case.
24bpp is gross and crusty and evil. You're unable to treat a pixel as any basic data type; its 3 bytes, as opposed to a word or a quad.
Posted on 2004-09-20 02:22:49
|
vecna
|
Quote:Originally posted by Zip
But seriously... how many verge games have 48x48x50 chrs?
Not that many, but VO was actually a worse situation than that. We had 48x48 frames, ~100 frames, and each character was composed of on average 6 layers of equipment paperdolling.
(yeah, you get an idea why we eventually gave up)
RAM usage was through the roof without caching.
Most times I have said 'what VERGE game is going to yyy feature?' someone has asked me for it. Games aimed at 640x480 do typically not have 16x32 CHRs, thats why Grue insisted that >16x16 hotspots be part of V3's entity system.
Many people may use one template, and only have 50 drawn frames in their main characters, but other NPCs may be using a 50-frame template. With the existing system, this will not really adversely effect anything.
HookEntityRender is a much better solution than making slightly varied CHRs anyway. Gungnirs question was basically about paperdolling, and the best way to do paperdolling is with HookEntityRender.
Anyway, no point in arguing. As I said, I'll change it to work the way you guys want.
Posted on 2004-09-20 02:32:08
|
gungnir
|
Hehe... look what I started.
This is not much of a problem fore me anyways. For the hero and his/her buddies, they will have this 'paper-doll' effect going on, but other entities are much more static and so I'm not too upset about using a multitude of different CHR files for them. I wasn't even thinking that CHRs were being cached, and in light of that, I can accept things as they are.
Merp.
/g
Posted on 2004-09-20 02:32:23
|
Displaying 1-20 of 54 total.
12 3
next
|
|