I am just starting to create the models for my newest game, which will be my first game in full 3D.
I have read in a couple unreliable places that it is far better to create all 3D objects as just one mesh and apply different materials to the mesh with weight painting, etc, rather than creating multiple meshes and parenting them to the same armature for animations.
According to these sources, this is because of UV mapping.
Is this true?
At the stage that I am at in creating my models, it would be far easier for me to make each individual part (arms, legs, knees) out of individual meshes and link them all to the same armature. If I do this (not merging vertices together, simply leaving each piece separate and overlapping, while linking them to the same armature), 2 questions:
Will the animations work in a Game Engine, moving all pieces and keeping them all attached where they should be?
If so, will it slow my game's performance to a significant (noticeable) degree because the characters are made of 7 or 8 separate meshes?
NOTE: I am, at this point, at least, planning on using the OpenGL game engine to run my game.
What you can do is create your models from separate meshes, UV unwrap each one, texture it, apply it's material and then when you're done and only then, merge the meshes into one and link that one mesh to your armature.
I think for blender it's Ctrl-J for joining.
I know this doesn't necessarily answer your question but it's just what I would do.
What you should do depends on what you need your model to do with the model. If your character needs to have its equipment or appearance be customizable in some way, or if you need to do special effects involving the change in appearance of the in-game character, keeping the body parts separate may be the more ideal solution. Team Fortress 2 does this with its customization system (or else you wouldn't be able to do things such as replacing the Heavy's gloves with something else or give them bird heads), while the Super Smash Brothers games takes heavy advantage of them in order to make the in-character animations seem good.
And then there are cases where a character's inherent design would've made animations regarding them be very difficult to manage should their joints be all within a single model. Examples of such characters include the Goombas from Mario and Kirby from the Kirby games.
And then there's the artistic choice of it. For example, there's no reason to make Pikachu's ears separate from the rest of the model, but the one used within Pokémon Gen VI onwards (including Pokémon Go) does so anyway. If you look real closely, you can even see the seam where the ear model ends and the head part begins.
To answer your questions as to the technical details, note that as you're using a low level API such as OpenGL for your game, whether or not you'd be able to do this depends entirely on your skills. As to the performance costs, it only depends on the amount of vertices that you have as well as the way you do the shaders. All that OpenGL ever sees is a group of vertices which has "faces" defined to them. It passes said information to the whatever shaders you had coded (to which it then processes the data you sent to it).
Granted, I'm no expert on the API, but even those starting out knowing the modern forms of OpenGL know this.
Related
We're having our first attempt at writing some Gherkin specs for a greenfield application and I'm not sure how to tackle what appear to be inter-dependant features.
Essentially, we have a feature CreateADoor that is actually used as part of two other features BuildAHouse and BuildAShed.
The CreateADoor feature is relatively complex in terms of validation etc. which is why we have lifted it out as a seperate feature (to avoid duplication). The issue is that the result of scenarios for this feature are dependant on the context they were called from (should my newly built door be on a House or a Shed).
The only way I can really see to solve this is to get rid of CreateADoor and have its scenarios duplicated inside both BuildAHouse and BuildAShed. In this specific situation this would be (just about) bearable, but what about the situation where CreateADoor requires 10 scenarios to spec it out, and is used by 10 different features. Having 10 scenarios explode out into 100 doesn't seem good, but I can't see another option at the minute.
Can anyone suggest a different approach that allows us to avoid this explosion of scenarios?
Ideally you should not create these dependencies, but instead if creating a door is part of building a house then the building a house feature should create a door as part of its setup instead of reusing the feature to test creating a door.
This might look like this:
Given I have created a house door
When I create a house
Then I should be able to live in it
and the logic for creating the door should be in the code behind the Given step. This logic might be very different from what actually happens when you create a door in the tests.
If you can't separate things like this then one thing I have done in the past is to make the code behind the Given step call the other steps from the CreateADoor feature so that the code is not duplicated, but the existing steps are reused. This is not ideal, but pragmatically this is sometimes necessary.
This question pertains to a game I have been developing, but I believe it is a pretty generic concept for which I have not been able to find a clear answer.
I have been trying to figure out how to serialize actors (objects in a game world) to a file, dynamically and at arbitrary times.
Context
To understand my question you need to know how the world is generally constructed. The game is a cell-based world with 3 dimensions divided into smaller, more manageable sections that I'll refer to as chunks. The terrain info is all fixed known length, and I can serialize that information just fine, simply writing/reading to/from a world file with the appropriate offset whenever that chunk needs to be loaded into memory (say a player gets near it). That's all well and good until I have to deal with actors and writing them to a single file.
The Problem
I know that ISerializable is an incredibly useful resource for actually obtaining the data from the actors, but the problem I'm having is committing that to disk dynamically. By that I mean inserting/removing actors from the middle of a big file containing all actors. It would be a lot easier if I could serialize the entire game state and actor tree, but I need to be able to do this on small sections of the world at a time. Some sections will have no actors, some will have many (say up to a couple hundred). These sections are being loaded and saved as the players move around the world. Furthermore, the number of actors and size of their data will change over the course of the game, so I cannot handle it like I do the terrain. I need a way of committing the actor quickly, where I can find it quickly later and am not wasting a lot of file space. One thing that may be of use is that all actors in a chunk are serialized/de-serialized at once, never individually.
Note: These worlds can get very large (16k x 16k x 6) and therefore easily have millions of actors in all.
The Question
Is a database really the best way to do this? I am not opposed to implementing one, but that is an involved process and I want to be sure it is a recommended course of actions before I continue. It seems like there might be serious performance implications.
A tradition database (RDBMS) is not always the right way to go. But alas, you ARE trying to persist data.
Most IT professionals will likely guide you towards a traditional database, simply because for us it ISN'T involved. It is out bread and butter. Further more, there are hundreds of libraries that make our lives easier, the latest generation of which are the full blown ORMs.
However, as you have noted, a full blown RDBMS is a little heavy weight for your application (depending on your particular scaling needs). So I'll suggests a few alternatives.
MongoDB
RavenDB
CouchDB
Cassandra
Redis
Now, it IS true that in many ways, these are much lighter weight than RDBMSs. However these so called NoSQL (I picked Document stores, since they seem to be the closest match to your requirements) are somewhat immature. That is not to say they are buggy, and unreliable (they have higher reliability than RDBMSs), but people don't really know how to work with them.
Again, I need to qualify that statement. RDBMS have several decades of research and best practices behind them. There are vast swathes of plug-ins to the tool chains of each implementation. Every single contributor in SO knows how to use a DB well. But, none of those things is true with NoSQL.
TLDR
So it really boils down to this. YES RDBMS (traditional DBs) are complex, like a modern road car. But like a road car (which you buy), these exists the infrastructure to support them.
The alternative is a NoSQL database, which is like building a small electric go scooter. Yes its simpler. But you take it to a car shop, and they'll still have no clue.
Finally
My advice. Use an off the shelf ORM with a RDBMS. The current generation of ORM can pretty much hide your database from you. The setup won't be very performant (you won't be doing microsecond algo trading with it), but it should be enough for your needs.
I'm developing a simulation that will feature many entities constantly updating, perhaps 30 times a second. Let's imagine we have 1000 entities, each of which has a velocity, and consequently a position that must be updated every tick.
So, how would you implement this using the actor model? I'm not necessarily using Erlang for this project, but for the sake of argument, let's just say I am. Would you have an actor for each of these entities? Or would you have a "manager" actor that maintains and updates a list of these entities?
Learn You Some Erlang says:
It is true that Erlang processes are very light: you can have hundreds
of thousands of them existing at the same time, but this doesn't mean
you have to use it that way just because you can. For example,
creating a shooter game where everything including bullets is its own
actor is madness. The only thing you'll shoot with a game like this is
your own foot. There is still a small cost in sending a message from
actor to actor, and if you divide tasks too much, you will make things
slower!
So that seems to suggest that managers would be better. Or is there a third option that I'm not seeing?
You say it! there is not one single good solution.
Now to be more helpful, and with the few background I have, I think you should look at these aspects of your project:
You say simulation. If you need to refresh a collection of entities every 30ms, first work to simplify the operations and the data model, and only second think how you can traverse the collection of data efficiently.
On the other end, if you have a huge and/or evolving collection of objects, with trivial algorithm/data model, then look at smarter data structure than lists, take care of the data copy...
If you use a multi-core (or a cluster) then think to have your entities grouped in several super entities in order to take advantage of parallelism, managing them in separate processes.
Next think if these groups can help you to reduce the number of evaluation (have an adaptive time slice? evaluation on demand? ...) .
Last, I think than generally speaking, Erlang is compact and easy to refactor, so take advantage of this an define some functional steps, and for each of them,
make them work, make them right and make then fast (Kent Beck ?)
For the last step you can get some help from the profiling tools such as fproof
Courage :o)
I think Learn You Some Erlang is making a bit of a premature optimization blunder here. You should use which ever abstraction makes the most sense to you, measure any problems, and refactor if necessary. Personally, I believe modeling each particle as its own actor would be the easiest to deal with, and is also the most idiomatic approach for the Actor model. Practically, however, you should do whatever floats your boat.
This question has already been asked at htc files: Why not to use them?, but the answer didn't answer anything really.
The question is, why is something like CSS3 PIE
not in use on many sites? I'd expect smaller ones to not know about it, but the one that caught my eye was Twitter, who doesn't use it.
Is it because it's not standard? Or does it cause a noticeable slow-down of the site?
Thank you for any responses.
I can't speak for everyone, but my sense is that you don't see tools like these in use on large sites because:
1) They do incur a certain performance cost. CSS3 PIE in particular starts to create a noticeable rendering delay after use on about two dozen elements (in my experience, YMMV.) For that reason its use on large pages might cause a larger rendering delay than the time saved downloading image assets.
2) They start to show bugs with complex DOM changes. Lots of animation, showing/hiding, etc. can sometimes cause PIE to get out of sync.
3) Related to #2, the added layer of abstraction (and its associated bugs) can become a detriment on large development teams with a complex codebase. If you start spending more time debugging the abstraction than it would take to simply create rounded corner images, then the tool is getting in the way.
I'm speaking specifically about CSS3 PIE here because it's near and dear to me (I'm its creator), but similar caveats apply to other polyfills like Selectivizr. This goes for any tool: you always have to evaluate the pros/cons for your specific needs. For example I wouldn't recommend PIE for a high-traffic, performance-critical, highly interactive site like Twitter for the reasons stated above, but it really shines on simpler more static designs.
...Another thought is that it's perfectly valid in many cases to simply let IE degrade to square corners etc. This is always the preferred approach IMO, if possible given your particular situation. So in that case it's not due to any evaluation of the tool, but just a decision that what the tool provides is simply not needed in the first place. :)
I am used to XNA like structures:
LoadContent
Update
Draw
Now based on these 3 main methods my game objects inherit from them.
In XNA I as non-professional and non-game-programmer was badly forced to think in these blocks.
Well add a Sprite baseClass, inherit from DrawableGameComponent.
Now create the WarriorSprite class for the gameobject Warrior.
etc. etc.
I totally get lost in this structures, but I simply want to program a game, not an engine.
I do not want to deal with extra ordinary rendering code each time I want to add an entity to my game.
In addition to that, I never got used to in any tutorial how to let 2 objects to interact....
My focus should lie on porting the game mechanism from game design to code.
Now I found Ogre(3D), and I hoped this engine offers this functionality.
The wiki could not answer my question really.
regards,
If you're getting lost with game-object classes based off other classes, I wouldn't recommend moving to OGRE. It's very object-oriented, by design. It does simplify some of the low level stuff, like working with DirectX or OpenGL, but you still have a lot of classes that inherit from quite a few others and have plenty of methods. If you're confused with that, you may want to read up on classes and see if you can get the hang of those.
If you're looking for an engine that you can just make a game in, though, there are a few different ways you can go.
One of the more common starting placing is modifying existing games, especially creating "total conversions." You have a complete engine, which you already have a copy of, and plenty of game resources, so that can be a good place to start.
You can go looking for an engine, but finding an easy-to-use, cheap and powerful engine isn't terribly easy. There are a lot of varied engines, all at different levels of completeness and different prices. Some that come to mind are Irrlicht, CrystalSpace, Quest3D, DarkBASIC (if you want to sacrifice your sanity and use BASIC ;)). There are plenty of others, though.
You may try checking out these for engines (I know DevMaster has a nice, detailed search):
http://www.devmaster.net/engines/
http://en.wikipedia.org/wiki/List_of_game_engines
And here for general tips:
http://www.gamedev.net/
Yes, Ogre is a complete game engine that will let you build a game, while with XNA you need to create much of the engine-type functionality.
Ogre supports both OpenGL and Direct3D, and is coded in C++. If you want to code in C# you'll need to look elsewhere (or see if anyone has done some sort of C# wrapper for Ogre). If you want to deploy to the Xbox you'll have to use XNA unless you have a contract with Microsoft.