2
\$\begingroup\$

I'm working on a mobile sports game with Unity. I'm wondering how I could create an efficient effect of an audience in the stadium.

I know that with more than 15 characters in my games (with 1800 faces and 20 bones) the game slows down, so I guess that even with a small number of bones, using 3D characters for even the first row of seats isn't feasible... Would you have some tips on how to do this another way?

I have also tried to "paint" them, and add a blur effect, but the result is not very good...

blurred stylised picture of an audience

\$\endgroup\$
3
  • \$\begingroup\$ How about one sprite per audience member/audience group? \$\endgroup\$ Jan 25, 2013 at 8:29
  • \$\begingroup\$ @PandaPajama Thanks, what do you mean by Sprite, in Unity? Do you mean creating an animated texture with a group of people, and add several plane with the same texture all around the stadium? \$\endgroup\$
    – Paul
    Jan 25, 2013 at 11:24
  • 1
    \$\begingroup\$ Sure, whatever fits your game the most. My point is that there is a lot in between fully rigged 3D models for each member of the audience, and one texture for the entire audience. \$\endgroup\$ Jan 25, 2013 at 14:24

2 Answers 2

4
\$\begingroup\$

If it's for mobile devices, as in phones, then making the public as individual characters (even really low poly ones) is out of the question. Not only will it bog down the limited resources of the device, but no one will notice such detail on such a small screen.

My best bet would be an animated texture. Or multiple animated textures, where you have one for "idle" (not much happening in public, just small isolated motions), one for "cheering" (all public moves wildly), etc. And then you display then accordingly on a plane which represents the public's geometry.

Now, in order to obtain the animated texture you could do a bunch of repeated textures on plains, have them animate (like raise them a bit for crowd standing up, move some around for crowd fussing about, etc) and then create pre-rendered textures out of these.

Or I guess you could use some actual public footage which you can tile about and create animated textures out of that.

\$\endgroup\$
7
  • \$\begingroup\$ Thanks, i did not know the animated texture! It seems perfect, i will try and confirm if it gives me a nice result, thanks Shivan! \$\endgroup\$
    – Paul
    Jan 25, 2013 at 11:22
  • \$\begingroup\$ You can do various scripting tricks that allows you either to hide/show various planes with different textures, or shift the texture on an object in order to get the animated texture effect. Check out the answers to such a question on their forum:answers.unity3d.com/questions/19848/… \$\endgroup\$ Jan 25, 2013 at 13:13
  • 1
    \$\begingroup\$ Texture resolution should be smthn like (max screen resolution) * (public average screen ratio) / (public visible ratio). If it's for IPhone 4 and above,then you have 640×960 screen size, and let's say the tribune occupies about 1/3 of the screen on the average, and also we can see about a quarter of the whole tribune at a given time. then you have 640 * (1/3) / (1/4) = 853 and 960 * (1/3) / (1/4) = 1280. Round that to power of 2 values and you get either 512x1024 or 1024x1024. Obviously you'll have to go higher that that for higher res. screens (like IPad screen), but the idea is the same. \$\endgroup\$ Jan 25, 2013 at 15:00
  • 1
    \$\begingroup\$ The number of planes should be something like (number of different animations for public) x (average number of frames per animation) . Let's say you have a "public idle" animation of about 15 frames and 2 different "public cheering" animations of about 30 frames each. Then you'll need 1x15 + 2x30 = 75 planes. That makes about 150 triangles, which is quite fine performance-wise, even for a phone. \$\endgroup\$ Jan 25, 2013 at 15:03
  • 1
    \$\begingroup\$ Note that this is one way of simulating animated textures: create each animation frame as a separate texture,place it each on a different plane, have all planes placed at the same location,then show/hide so that you quickly display each plane individually giving the sensation that there's only one plane there on which the texture "moves".Another way is to make a big texture containing all frames for the animation, and then play around with the UV Mapping such it displays only one of the multiple animation frames drawn on your texture at a given time. This way uses more memory but less CPU/GPU. \$\endgroup\$ Jan 25, 2013 at 15:06
2
\$\begingroup\$

Fake it.

In a mobile game, this is an unimportant detail. Most of the screen will be dedicated to the action. This is my suggestion:

If the player is playing:

  • Crowd should appear a few meters away from the playable part of the field (to account for out of bounds space), camera should not be able to move directly up to them in this situation.
  • Crowd will drawn either using a single plane or a layered group of 2 - 5 planes (geometry consists of 2 to 40 triangles).
  • Crowd animations are handled through a set of animated textures which should consist of only a few (no more than maybe 10) low resolution images per animation. These animations can be tiled on the planes to reduce image size and memory usage at the expense of the CPU or GPU.
  • Animations should change based on a crowd state enum that is set after player events (such as scoring, missing a shot, or bad over all performance) animations can include things like happy idle, angry idle, celebrate, rage, rage quit.

(Optionally) When an important player event is triggered:

  • If player is to do some sort of action that deserves special attention, the camera may move to the crowd (move should be quick fade out and in so that the player cannot see the swap between a fake crowd and a character model crowd).
  • When camera moves to the crowd, it actually moves to a separate part of the game (not near the field more like a room). The only things to be drawn in this scene are the area surrounding (like bleachers and a skybox) the character model crowd, and the character models for people in the crowd (which should be limited based on your hardware, preferably no more than 10 at most).
  • Since the full crowd is only drawn when the game is at a standstill (player is paused during the animation) the game logic only needs to update and draw the full crowd until animation is complete. After animation is complete the full crowd moves to an inactive state and is not updated or drawn again until another important player event is triggered.

To summarise: Fake the crowd with a simple 2D sprite until the player does something important (scores an amazing goal, injures another player, or whatever important events happen in your game). By only showing a 2D sprite during active game play, the overhead of an in-game crowd is reduced. As long as you show a more detailed 3D version of the crowd during an event, you can trick the player into thinking the crowd is full 3D at all times. Make sure not to draw or update the full crowd and the actual game at the same time, else any performance gains from faking it will be lost.

\$\endgroup\$
1
  • \$\begingroup\$ no worries, someone edited it to make it actually readable. \$\endgroup\$ Jan 29, 2013 at 19:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .