04.05.2015 Views

Perforce integration in a AAA game engine

Perforce integration in a AAA game engine

Perforce integration in a AAA game engine

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Perforce</strong> <strong><strong>in</strong>tegration</strong> <strong>in</strong> a <strong>AAA</strong> <strong>game</strong> eng<strong>in</strong>e<br />

The Strength of the C++ API<br />

Marc Desfossés<br />

Lead Tools Programmer<br />

Jean-Sébastien Pelletier<br />

Technical Lead<br />

<strong>Perforce</strong> <strong><strong>in</strong>tegration</strong> <strong>in</strong> a <strong>AAA</strong> <strong>game</strong> eng<strong>in</strong>e<br />

Ubisoft Enterta<strong>in</strong>ment<br />

1


Introduction<br />

The organized chaos of the <strong>game</strong> <strong>in</strong>dustry<br />

2


History – Pr<strong>in</strong>ce of Persia<br />

• How it worked on Pr<strong>in</strong>ce of Persia (2003)<br />

• In-house source control<br />

• What we loved<br />

• Bigfile: File system stored <strong>in</strong> a s<strong>in</strong>gle file<br />

• Integrated <strong>in</strong> editor<br />

• What did not work<br />

• Data corruption<br />

• Not scalable : No submit queue<br />

3


History – Start<strong>in</strong>g from scratch<br />

Foundations of a new eng<strong>in</strong>e (2004)<br />

• Full <strong>Perforce</strong> Integration<br />

• Keep Bigfile’s concepts<br />

• <strong>AAA</strong> <strong>game</strong> title<br />

• Big teams<br />

• Lots of assets<br />

4


Game Production Workflow<br />

Creat<strong>in</strong>g a <strong>AAA</strong> <strong>game</strong><br />

5


Eng<strong>in</strong>e overview<br />

Anvil (Editor) <br />

3DStudio Max <br />

MoAon Builder <br />

Photoshop <br />

Scimitar (Eng<strong>in</strong>e) <br />

Guildlib (Data Exchange) <br />

P4 <br />

Bigfile <br />

6


Objectives<br />

• Performance<br />

• Stability<br />

• Get rid of data corruption<br />

• Scalability<br />

• User Experience<br />

7


Objectives - Scalability<br />

• Over 2 millions of files on AC3<br />

• ~ 500 users submitt<strong>in</strong>g code or data<br />

• 150 Gigs of data<br />

• Multi-Studio support (5 studios)<br />

8


Objectives - Scalability<br />

9


Objectives – User experience<br />

• Simple User Interface<br />

• Expos<strong>in</strong>g only the basics features<br />

• Add, Edit, Delete<br />

• Limited branch<strong>in</strong>g and resolve for power users<br />

11


User Experience - Custom dialogs<br />

Anvil Editor <br />

12


User Experience - Custom dialogs<br />

Visual Diff <br />

Submit Assistant <br />

13


Architecture<br />

Leverag<strong>in</strong>g the C++ API<br />

14


Architecture – The Bigfile<br />

• File system embedded <strong>in</strong> ONE file similar to a zip file.<br />

• Database driven<br />

• Transactions<br />

• It conta<strong>in</strong>s relationships between all <strong>game</strong> objects<br />

• Source control metadata for each file stored <strong>in</strong> FAT<br />

• Revision number<br />

• File status<br />

15


Architecture – Clientview Sync Process<br />

- Mirror bigfile and its associated perforce client<br />

- Run commands such as fstat, flush, edit, revert, delete,<br />

add.<br />

- Once this is completed we can run any <strong>Perforce</strong><br />

command.<br />

16


Architecture – Splitt<strong>in</strong>g <strong>game</strong> object files<br />

BIGFILE <br />

/foo/texture.psd <br />

<strong>Perforce</strong> <br />

Meta Data <br />

Name = texture.psd <br />

Object Type = Texture <br />

Folder = foo <br />

Data <br />

17


Architecture – Splitt<strong>in</strong>g <strong>game</strong> object files<br />

• Avoid branch<strong>in</strong>g when mov<strong>in</strong>g or renam<strong>in</strong>g<br />

• Move or Rename becomes edit of the meda-data file<br />

• Save disk space on server<br />

• No data file submit for rename or move<br />

• Allow custom file statuses<br />

• Only the meta-data file is synced<br />

18


Architecture – File Mapp<strong>in</strong>g<br />

BIGFILE <br />

<strong>Perforce</strong> Depot <br />

/foo/texture.psd <br />

File texture.psd with ID 0x300012ce1 <br />

//ac3/ma<strong>in</strong>/d/3/00/01/300012ce1.d <br />

//ac3/ma<strong>in</strong>/a/3/00/01/300012ce1.a <br />

19


Architecture – The C++ API<br />

• FileSys class<br />

• Used to redirect I/O<br />

• Lets us improve performance<br />

• Callback call for each file when runn<strong>in</strong>g<br />

commands<br />

20


Architecture – Sync Example<br />

• P4 sync //ac3/ma<strong>in</strong>/…<br />

• Callbacks <strong>in</strong> FileSys class for each file synced<br />

• Open()<br />

• Stat() – Return false (no temp file)<br />

• Write() – Append buffer <strong>in</strong> memory<br />

• Close() – Commit buffer and update metadata <strong>in</strong><br />

bigfile<br />

21


Architecture – Sync Performance<br />

22


Architecture – Custom File Statuses<br />

• Ghosted files<br />

23


Architecture – Custom File Statuses<br />

• Hijacked files<br />

• Clobbered files that can be reverted<br />

• Skipped dur<strong>in</strong>g sync<br />

• Conta<strong>in</strong>ed <strong>in</strong> a special changelist<br />

24


Demo<br />

25


Benefits vs Costs<br />

Is it really worth it ?<br />

26


Benefits<br />

• Integrated User Experience<br />

• Embedded <strong>Perforce</strong> operations<br />

• Submit Assistant dialog<br />

• 5 m<strong>in</strong>utes setup<br />

• Custom Statuses<br />

• Ghosted files<br />

• Hijacked files<br />

• Performance<br />

27


Costs<br />

• High ma<strong>in</strong>tenance<br />

• Always beh<strong>in</strong>d <strong>Perforce</strong>’s new features<br />

• Shelve and Streams for <strong>in</strong>stance<br />

• Test<strong>in</strong>g is complex<br />

• Upgrades need to be fully tested<br />

28


F<strong>in</strong>al words<br />

29


F<strong>in</strong>al words<br />

• The <strong>Perforce</strong> C++ API is powerful and lets you<br />

manage your own File System.<br />

• <strong>Perforce</strong> can support the load required by the<br />

gam<strong>in</strong>g <strong>in</strong>dustry.<br />

• A tight <strong><strong>in</strong>tegration</strong> allowed us to simplify our<br />

users workflows.<br />

30


Questions ?<br />

31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!