Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Shadow and performance problem

Author
Message
Bren
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Belgium
Posted: 9th Nov 2003 22:39 Edited at: 9th Nov 2003 22:41
I'm using the DarkMatter2 models and I create my levels in cartography shop. To test I load 10 Darkmatter models seperatly + the player model, they walk, "attack" or are just idle. Models who are not on the screen are hidden. The level exists out of 2 textures en 2 cubes, floor and wall. My cpu is a athlon xp 1800+, 512ddr memory and a geforcefx, so it's not a hardware problem. The frames per second when I'm standing still and some enemies are attacking is 24 to 27. But when I start walking and/or the enemies start walking, the FPS drop to 14-19. Maybe it's my walking code? I moved the models with the idle animation and my fps stayed stable 24-27. If I use instance object and my model is not moving, but the enemies are I get +- 50 fps, when my main char does the walking animation and therefore I'm walking, it drops to 30. Why not use instance then? If I use instace, then all my enemies do the same animation at the same time, only the "root", original object can be animated. Does anyone else have this problem with the Darkmatter2 models? I also turned the collision code off, but that didn't make any difference.

Then there is the problem with the shadows, I uwe a shadow, white background, black shadow and the command
. As you can see on the screenshot, I get a yellow burned color where the white normaly is.



This is the shadow bitmap:


I'm hoping to get my game playable on at least a 500mhz computer. But the way things are gowing now, it's not going to happen

I hope someone can help.

Games don't kill ...
I do!
http://www.gamingzone.be the ultimate gaming community
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 9th Nov 2003 23:02
The FPS is still appalling regardless, something screwy is going on somewhere.

Put timer() commands either side of the sync command and tell us what result you get. It may be that something other than the rendering process is causing slowdown.

Megaton Cat
22
Years of Service
User Offline
Joined: 24th Aug 2003
Location: Toronto, Canada
Posted: 10th Nov 2003 00:20
err u mind if I borrow ur shadow bitmap?
thanks

good luck with ur game, hope u can get that issues resolved.

My philosophy:
LESS CHAT MORE SCREENIES.
ESC_
22
Years of Service
User Offline
Joined: 29th Aug 2003
Location: Mass.
Posted: 10th Nov 2003 00:33
yeah, it shouldn't run that slow. As for the shadow, try making the maximum gray 170 (in photoshop go to image adjust>levels>output color, and change 255 to 170)

''For nonconformity, the world whips you with its displeasure''---Ralph Waldo Emerson
Bren
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Belgium
Posted: 10th Nov 2003 02:54 Edited at: 10th Nov 2003 02:59
@ megaton
I don't mind

@esc_
I tried but I still get the burned yellow instead where the white was

@robK
This is the result with objects (20 trees in the sceen, not hidden when not in the screen. But it should be able to handle it, it was barely a speed loss when using instance object for the enemies):



This is the result with no extra objects:


And this is the main loop code:


Games don't kill ...
I do!
http://www.gamingzone.be the ultimate gaming community
Bren
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Belgium
Posted: 10th Nov 2003 04:43
I played arround with the code a bit and started changing the frames manualy instead of loop object or play object. Pneumaticdrill from banshee studios helped me out.

He gave me this code:

Normaly, he said, the value of speedOfAnim is about 0.001. After a lot of testing I came to the conclusion that the value I needed for the darkmatter animations was: 0.00001602.

What I'm getting at is, the idle animation and the attack animation don't get my FPS down. Why? I don't think it's a coincidence that these animations are the first animations of the model. The further you go, the slower it gets.

My conclusion: Maybe everything starts to slow down this much because my computer suddenly has to work with this extreme values. I do think he'll have less trouble when he only had to this:



The darkmatter models have about 104160. This was the convertion code I found on the forum:

(Total frames()/650)*Frame number needed



As you can see this are all big values, maybe this could be causing the problem?

Games don't kill ...
I do!
http://www.gamingzone.be the ultimate gaming community
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 10th Nov 2003 13:34
Nah the values are not causing a problem at all as you have a 32 bit processor.

This is what interests me though:

Quote: "The further you go, the slower it gets."


I've not used instance object as i'm using patch 4.1 until i've finished my current projects, however I suspect that the instance object command is working sequentially through the files - in other words - it is not able to refer to a previous keyframe with all rotational aspects in place.

This could be a bug in DBP, or it could be something more technical to do with animation data and how animation data is stored & held. I would email this particular aspect to [email protected] for resolution, because it's too technical and too within the DB engine for me to know the answer.


God created the world in 7 days, but we're still waiting for the patch.
Bren
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Belgium
Posted: 10th Nov 2003 15:30
I tried the frame code, not with instance but with individualy loaded objects. But I'll mail it to them. Ty.

Games don't kill ...
I do!
http://www.gamingzone.be the ultimate gaming community
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 10th Nov 2003 15:39
Hi Bren,

Looks as if something else is slowing your code down besides the SYNC command. You might want to do timechecks around the functions as well to see where the slowdown is.

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Nov 2003 15:51
Firstly, that shadow problem:
Always disable lighting and ambience on your shadows, those two will really mess with it. If after disabling ambience and lighting you still get that square outline, try using middle grey as the background instead, rgb(128,128,128) - I'm not too sure what else you can try, but I did make a function to setup my ghosted objects which I'll try and remember to post tonight.

The animation frames weird frame numbers could cause a problem, perhaps having such a long animation timeline is taking extra memory and therefore slowing your PC down to the extreme cases you mention. Could you totally disable the animation system and replace the player models with .X models with similar polycounts but no animation - if it runs better with no animation on the models then that's the problem. If it turns out that this is the problem, I'd be tempted to make my own animation system by rotating the limbs and storing keyframes. The way I figure, having a lot of models in memory with no animations and using an internal animation system is bound to be faster than having all those models with all the frames in memory.


Van-B


I laugh in the face of fate!
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 10th Nov 2003 17:05
The calculations for each limb angle will always use more CPU time up than just storing the keyframes. Using fractions for frame numbers does not effect the performance of my own models, it merely allows for far smoother animation.

It is possible I guess that an excessive animation length of 10,000+ frames in the model or some such could cause slowdown, mostly my own models tend to be 100, I do sometimes use the Panda exporter for Max and that creates 9,600 or so frames and I haven't noticed any slowdown there.

I suspect it is not the actual walk animation at fault, but rather the program code for walking in your game. To test this temporarily use the walk animation frames for a task which is currently OK such as the idle animation and use the idle animation frames for your walk code. You will then know if the objects are at fault or if it is your walking code.


God created the world in 7 days, but we're still waiting for the patch.
Bren
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Belgium
Posted: 10th Nov 2003 17:24
Setting off the lights didn't help, I'll try out the grey color when I get back this evening.

And Van B, surprise surprise, this is what happens if I leave out ONLY this line:

and for enemies:

So Andy was right, the large numbers a no problem at all, but like you said Van-B the large ammount of frames in the animation probably is.

In this scene every object is moving:



Now I have a constant fps no matter what I do, or what the enemies do 59-60 with the same models, but now they are not animating. So I guess it's the animations, any idea how to fix it? :/

Van-b will you release your in-game animation system for public?

Games don't kill ...
I do!
http://www.gamingzone.be the ultimate gaming community
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Nov 2003 17:35
Ahhh, you see I can tell now that your using Fullscreen Exclusive mode, which tops off at the top frame rate of the monitor, try that same code in windowed fullscreen instead, which should give you a fair bit extra FPS. I'll try and get that shadow prep function posted tonight.

I don't actually have any in-game animation code, but it's among a few things I have planned for next year. I have a massive project planned that I need a clever animation system for - like the ability to use the same animations on different models, I'm no great fan of animating, but if I only really have to do it once then I can grit my teeth .


Van-B


I laugh in the face of fate!
Bren
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Belgium
Posted: 10th Nov 2003 19:53
That does make a huge difference indeed, I get 117fps now. I also just read the "windowed - fullscreen?" post. Very interesting

Games don't kill ...
I do!
http://www.gamingzone.be the ultimate gaming community
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Nov 2003 21:24
Cool

Try this to fix your shadow problem:

Take your shadow image and decrease the brightness by 50%, if you can get it fade from rgb(8,8,8) to rgb(125,125,125) then that's perfect. Then fill the outside area with pure black. Then use this function to setup the object, just create and texture the shadow object then call this:



I just added shadows to my game and had the exact same problems with a similar shadow texture, managed to get it looking nice with this method.

HTH

Van-B


I laugh in the face of fate!
Bren
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Belgium
Posted: 10th Nov 2003 23:39 Edited at: 10th Nov 2003 23:43
Van-B rocks! thanks alot. Shadows work fine now.

About the models, they just contain way to much frames right? Can't they be reduced someway? And if the creator of the darkmatter2 models reads this by accident, can you create a low frame animation version?

That would be the solution, right?

Games don't kill ...
I do!
http://www.gamingzone.be the ultimate gaming community
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 11th Nov 2003 02:20
Glad it worked - I just changed my shadows for 4 poly plains with a basic 5 vertice-bone setup, let's me mould the shadows to the ground much better - not as many glitches on bumpy terrain - it even sorta projects itself too, very nice (I'll probably upload it tommorow).

I reckon your best bet would be to animate the models yourself, then you can decide yourself what animations you need, nice optimised models.


Van-B


I laugh in the face of fate!
Bren
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Belgium
Posted: 11th Nov 2003 02:40 Edited at: 11th Nov 2003 02:45
@ Van B cool and even better that you are willing to share the code

And after some testing and the help of pneumatic drill I can only confirm that the models are the problem. Pneumatic drill made a simple 650 frame (instead of 104160) animation (rotating shield), same code, only now for 650 frames and as an extra I added 20 fully 3D trees and some extra objects. All characters the same simple model, all moving and I get the max. frames per second as you can see:



So animating them myself would solve the problem, but I have no experience with animation in any 3d modeling tool. That's why I bought the DarkMatter2 models, fully animated low poly models

I'll mail tgc and hope we can come to a solution. Thanks for helping out everyone. And I can't wait to see your shadow code Van B

Games don't kill ...
I do!
http://www.gamingzone.be the ultimate gaming community
Ian T
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 11th Nov 2003 19:38
DarkMatter and DarkMatter 2 both have really ridiculous frame values for their animations, although they do look good... perhaps it would be possible to make a program in Classic that read every 15th-or-so frame, then exported the object? Been a while since I used the old animation commands. I'll look into it .

--Mouse: Famous (Avatarless) Fighting Furball

A very nice %it, indeed.
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 11th Nov 2003 22:27
Here's that shadow code:

http://www.dannywartnaby.co.uk/rgt/attachments/lens-shadows.rar


Van-B


I laugh in the face of fate!
deX
22
Years of Service
User Offline
Joined: 12th Nov 2003
Location:
Posted: 12th Nov 2003 11:57 Edited at: 12th Nov 2003 12:01
hey..
i was reading my 3dsmax help file about IK... your slow character symptoms sound like they could be something to do with the ik solvers of the models. i read that max's HD (history dependent) ik chain is not recommended for long animations, and the higher number frame you are playing the slower it is. the HI (history independent) and Limb IK solvers are much faster, but they are only available in max 4+ (i think)

hope this might shed some light on your problem..

doesnt really solve your problem, but maybe the darkmatter models can be modifide...


-deX
Bren
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Belgium
Posted: 12th Nov 2003 13:06
Thanks alot for the info deX And that's probably what's going on then. Changing from HD to HI probably isn't easy, is it? I'm a total 3ds max newbie, so I probably wont be able to do it. TGC has answered this topic or my mail yet, I hope they can change it, after all I bought them so I could use them right away.

Do you perhaps know a good tutorial on converting the history dependency in max? Or a good newie tutorial that should give me a push in the right direction

Games don't kill ...
I do!
http://www.gamingzone.be the ultimate gaming community
deX
22
Years of Service
User Offline
Joined: 12th Nov 2003
Location:
Posted: 13th Nov 2003 06:16
well first of all im assuming that the models are essentially animated meshes (they look to0 complex not to be)...

if they are animated meshes you would expect to find a set of bones inside each model. the problem with this is that (from my experience) 3dsmax wont load any type of animated mesh file format other than its own (.3ds and .max). well i've never got it to open an animated .x file before. but pandasoft might have a .x importer as well as an exporter for max.... its panda's exporter i use for .x, its pretty good

theres 2 different ways that the bones' keyframe info can be stored. the first is PRS (position, rotation,scale) for each bone. this is time consuming to make models as. the other method is using IK chains. these make it a lot easier to position the character in the right position.

now, if a character had HD ik chains in it already, unfortunately i cant think of any way to replace the chains and keep all the animation. you would still have an animatable model, but you would have to re-animate him. and if you have long animations i guess this would be rather time consuming.

sorry i cant help too much about modifying a model... iv never had to do it before!!! but now i have learnt how to box model, UVW texture and skin in max, i just make my own models

btw, the more i think about it, the more i think that your model's bones could have PRS keys....


-deX

Login to post a reply

Server time is: 2026-07-26 14:30:59
Your offset time is: 2026-07-26 14:30:59