Sign in to follow this  
stasd

Soccer Visualization

Recommended Posts

Hi All, My first post here, so please correct me if this comes a bit off topic. I'd like to create a visualization of a soccer field (football that is). The field should be displayed as a 3d rectangle and players are shown as small rings with their numbers inside the ring (very much like traffic signs). The players are shown a bit above the ground and will move around upon arrival of the position command (received over TCP). Requirements: 1) Global view (from arbitrary place around the field) 2) Player view (from within the the center of the player ring) 3) D3D9, C++ Questions: Is there any sample code that deminstrate the required model ? If there isn't, how would you guys implement it ? The last time I touched DirectX was quite a long time ago and I had only 2D related experience. So' I'm currently in the process of learning the new stuff, the problem is that I need to bring a demo in a week.

Share this post


Link to post
Share on other sites
exactly what do you mean by '3d rectangle'? do you mean a flat plane rendered in a 3d environment? same with the players, are they flat also and just placed slightly above the field, or do they have depth?

If they're the former (i.e. flat plains, i.e. textured quads), it should be pretty simple. You just need to make a texture for the field and for each of the player rings, and then use DX to create a quad for each.

For your camera (regardless of which view), you pretty much just need to keep track of a vector of where it is and know the direction its pointing. I don't use D3D personally, so I can't help you out with specifics. In general, however, the 'look' direction is either done with two vectors (one for the heading direction and the other for the 'up' direction) or its done using a rotation matrix.

In a simple project like this, I'd say you mostly just need a 'Field' class and a 'Player' class, in addition to whatever else you're doing in the way of networking, input and camera. The Field class isn't going to do much besides draw the textured quad. The Player class will need to have a 'move' public function so you can change the position of a player when the input or network require it.

Hope that helps you out a bit, and post back if anything doesn't make sense.

Share this post


Link to post
Share on other sites
This wouldn't happen to be a school assignment, would it? [wink]

Anyways, you could get very complicated with this, very quickly. But I'll try to keep it simple, since it has to be done soon.

First off, you need to get up to speed on the latest version of D3D. Here is a listing of some great tutorial sites.

Second, you need to implement the networking side of your application. The simplest way to do this would be to go straight to WINSOCK. Search around GDNet or Google (and MSDN, certainly) - there are tons of tutorials and samples out there.

And finally, you need to use DirectInput to get input from the keyboard and mouse. Look at the SDK documentation and tutorials for this - it's really simple.

Share this post


Link to post
Share on other sites
Thank you guys.

Unfortuanetly, this is not a school project. It is a start of something relatively serious.

What I have is a set of video cameras and a set of computers analysing the captured images. The images come from a real soccer game. The networking and image processing parts are working ok, I need to build the visualization part ASAP to get the investors interested.

The player positions, movement vector and their numbers are passed to the visualization program where it should be presented.
Furthermore, I'd need to draw a line that will follow the last pass made by the player with the ball.

I think for the first version the players are simple rings (no depth) about 40 pixels in diameter. I thought of implementing it with the mipmaps.

Has anybody seen a demo that is close to what am I trying to accomplish ?

Share this post


Link to post
Share on other sites
Doesn't sound that hard to do.
Start with initialising D3D.
Next setup a camera (tutorials can be found in the DXSDK).
Then you'd want to render the field by just setting up a vertex buffer that contains two triangles (tutorials are available on MSDN.)

Having done that (you could use the sample framework), you will need to implement free camera movement (global view).

The players are simple to do. Use the D3DXCreateTorus function to create a simple torus for the players (one model is sufficient) and place it on the field using transformation matrices. This helps you visualise the moving direction as opposed to a billboard. The ID3DXFont interface will provide tools for drawing the numbers.

I'd suggest starting with one player first. Store its orientation and translation along with the mesh and use these for your camera in player view mode.

If it works, update these properties with network input.

If you succeeded with that, you can plug in the other players and you're done.

depending on your learning abilities and the time you put into this, it could take a few weeks, though.



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