• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
MohammadAhmed

Scene graph

12 posts in this topic

Hello game developers , I have in my game every thing , but all what I need right now is a fast way to create 100 model for example ( zombie )   can you post some code showing the data structures ... etc , say what you know about this smile.png , I have for each model modelAnimatorManager and physicsManager  , so if I want to create 100 zombie model I must create 100 modelAnimaorManager and 100 physicsManager !!!! that's too much right ?!?! 

I used List<model> zombie = new list<model>(); 

and iterate over the model 100 times !!!!!!!!!!!!!! bla bla bla the same goes for physicsManager and modelAnimatorMnager , I know this is not good strategy !!

Sorry game developers if my topic was not related , I have not enough information about these issues , but I think my problem is about mange the scene or whatever is the definition .

Edited by mrmohadnan
0

Share this post


Link to post
Share on other sites

That entirly depends ...

 

What does modelAnimatorManager and physicsManager do? do you NEED 1 for each zombie?

 

if you have 100 items in the list, and you need to iterate over it, there is no way to get around doing it 100 times. you could look into Multi-threading, but that could cause more problems than it solves.

 

without any details, i would say Do each of the items NEED a physics manager? Why not 1 physics manager that can handle the updating of everything?

 

I currently use a physics engine and have over 1000 objects updating each frame, and the framework does this for me in ~20ms.

2

Share this post


Link to post
Share on other sites

thanks Andy474 , modelAnimator just load the animation for the model and set the world matrix which will be drawn later on the screen , not physics manager but it's like the controller for the model , i.e updating the bounding box for the model ......etc .

 I was talking with my friend belfegor , he advice me to create one class that contain the model and the modelAnimator and the chrachter controller and just make list of it instead of making 100 list from each one of model , modelAnimator , chrachter controller for each class !!!

for you Andy , what is your advice , tell me about the data structure you used and tell me your opinion in general smile.png and how did you manage all your stuff 1000 model or whatever 

Edited by mrmohadnan
0

Share this post


Link to post
Share on other sites

Well I use an engine called Farseer Physics to manage my games physics. you could look at the source code, But 1000 objects are not going to take anytime to process at all.

 

I have ~1346 and my update frame time is about 15ms.

0

Share this post


Link to post
Share on other sites

Ok , Andy do you face problem like this :

you have 10 models using the same effect , if you use XNA or Directx (the same applied ) I got this error :

Code used to make 10 copies of ModelManagerSupprt which will contain the model and the effect and will holds chrachter controller (BEPU Phsics Engine) :
 

            
            foreach (ModelManagerSupport dwarfModel in dwarfModels)
            {
                //dwarfModel.model = Content.Load<Model>("Models//dwarf//dwarfmodel");
                //dwarfModel.effect = Content.Load<Effect>("Models//dwarf//skinFX");
                //dwarfModel.setEffect(camera , game);
                //dwarfModel.setModelAnimationStatus(game);
                //dwarfModel.intializeChrachterController(new Vector3(0, 0, 0), 20, 10, 2000, 2000, 80, 40);

                //space.Add(dwarfModel.chrachterController);

                //dwarfModels.Add(dwarfModel);
            }

 

 


iatq84t8ca58z3x6g.jpg

Edited by mrmohadnan
0

Share this post


Link to post
Share on other sites
Asking for code is typically a bad approach. People don't want to write your software for you, and besides that ruins all the fun of it :). What you want to do is "instanced drawing". You load the model once into a Vertex Buffer, and then draw the same object over and over using different shader parameters. Edited by metsfan
2

Share this post


Link to post
Share on other sites

metsfan , thanks but why I can't simply load effect and 10 models which use the same effect ? , besides that is Instancing works for animated models  (.x ) format ?

Edited by mrmohadnan
0

Share this post


Link to post
Share on other sites

metsfan , my problem is not with instancing , my problem is that I can't create 2 effects and 2 models which used the same effect as shown above in the code 

0

Share this post


Link to post
Share on other sites

If your models have a lot of detail and your game starts to stall, you can try to implement Instancing, so instead of having separate draw call for identical zombies (for instance say 100 draw calls). You have one shader, which can draw desired number of models at once.

You can read about animated model instancing here:

 

http://developer.download.nvidia.com/SDK/10/direct3d/Source/SkinnedInstancing/doc/SkinnedInstancingWhitePaper.pdf

 

It might get tricky so first thing is to ask yourself if you really need such optimisation.

Edited by Tasaq
0

Share this post


Link to post
Share on other sites

OK , Thaaaaaanks so much , but for now I will not do Instancing , all I need is to figure out the bug in my game .

If I load 2 models ( the same model zombie ) and give them the same effect I got the following errore :

 

   for(int i =0 ; i<2 ; i++)
        {
            dwarfModel[i].model = Content.Load<Model>("Models//dwarf//dwarfmodel");
            dwarfModel[i].effect = Content.Load<Effect>("Models//dwarf//skinFX");
            dwarfModel[i].setEffect(camera , game);
            dwarfModel[i].setModelAnimationStatus(game);
            dwarfModel[i].intializeChrachterController(new Vector3(0, 0, 0), 20, 10, 2000, 2000, 80, 40);

            space.Add(dwarfModel[i].chrachterController);

            dwarfModels.Add(dwarfModel);
        }

 

 


iatq84t8ca58z3x6g.jpg

Edited by mrmohadnan
0

Share this post


Link to post
Share on other sites

that has nothing to do with loading 1, 10, 100 or 1 million objects.

That's just a problem trying to upcast and Effect into something that is not (a BasicEffect), just as the error message is complaining about.

 

The rest of the thread doesn't make a lot of sense either... unless you want to draw 1 million zombies in the same pose, you'll need to draw them separately.

Having the animation data shared for all the zombies or one for every zombie is a memory problem.. are you having problems with memory? If you have, I bet there are MANY other places eating up your memory.. but seriously, considering the fact that you can't understand a simple error message like that means you don't have problems with memory solvable by sharing animation data.. so my suggestion is.. keep coding and forget about all this.

1

Share this post


Link to post
Share on other sites

kunos  thanks , so I did not see your advice and answer for my problem !! I still can't figure out the problem as show in the picture above !! 

Edited by mrmohadnan
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0