πŸš€ First Steps in Perforce: A Beginner's Guide

Welcome to your journey with Perforce! This guide will walk you through the essential tasks you'll perform using the P4V client. Let's dive in!

πŸ“‹ Table of Contents

  1. Creating a Workspace
  2. Managing .p4ignore Files
  3. Navigating Your Workspace
  4. Editing Files
  5. Adding Files
  6. Deleting Files
  7. Working with Streams
  8. Best Practices


Official Perforce Video: Perforce Helix Core Beginner’s Guide: How to Create a Workspace

πŸ—οΈ Creating Your Workspace

Before you can start working with files, you need to set up your workspace. A workspace is your personal working area where you interact with files from the Perforce server.

Steps to Create a Workspace:

  1. Open P4V: Launch the Perforce Visual Client

  2. Connect to the Server:

    • If not already connected, go to Connection > Connect to Server
    • Enter your server address, username, and password
  3. Create a New Workspace:

    • Go to Connection > New Workspace
    • Or use the shortcut (when inside the Workspaces context window): Ctrl + N (Windows) or Cmd + N (macOS)
  4. Configure Workspace Settings:

    • Name: Enter a unique name for your workspace (e.g., "Username_ProjectName_Machine")
      • It is recommended to begin all workspaces with your abc123 username
    • Root: Choose a local directory for your workspace files
    • Stream: Select the appropriate stream for your project (e.g., "//depot/main")
    • Description: Add a brief description of your workspace's purpose
  5. Set Workspace View:

    • This defines which parts of the depot you want in your workspace
    • For most users, the default view based on the selected stream is sufficient
  6. Advanced Options:

    • Configure options like line-ending settings or submit options as needed
      • Tick on Modtime under Advanced tab
      • Tick on Rmdir under Advanced tab
  7. Create Workspace:

    • Click 'OK' to create your workspace
  8. Initial Sync:

    • After creating the workspace, you'll be prompted to sync files
    • This downloads the current versions of files to your local workspace
Workspace Naming Convention

Follow your team's naming convention for workspaces. A common format is "UserName_MachineName_ProjectName".

Note

The specific options and appearance may vary slightly depending on your Perforce server configuration and P4V version.


πŸ›  Managing .p4ignore Files

Why Use .p4ignore?

.p4ignore files help manage which files are versioned in your project. This is crucial for game development, where you often have build directories, temporary files, or third-party libraries that shouldn't be in version control.

Setting Up .p4ignore Support

  1. Enable .p4ignore Support:

    • Open Command Prompt as administrator

    • Type setx P4IGNORE .p4ignore and press Enter

    • Alternative Method: Edit System Environment Variables:

      • Search your computer for an option to 'Edit the system environment variables'
      • Under 'System variables', click 'New'
      • For 'Variable name', enter P4IGNORE
      • For 'Variable value', enter .p4ignore
      • Click 'OK' on all windows to save the changes
      • Restart any open command prompts or applications for the change to take effect
  2. Create a .p4ignore File:

    • In your workspace root, create a file named .p4ignore
    • Add patterns for files to ignore, for example:
# Ignore temporary files
*.tmp

# Ignore build directory
build/

# Ignore all files in temp directories
temp/**
Pro Tip - .p4ignore File

For Unity or Unreal projects, check if a template .p4ignore file is provided in your depot. It's a great starting point! If not, we provide a default Universal .p4ignore file that can be used for most game design and virtual production projects.


Your workspace is your local copy of files from the server. Here's how to navigate it efficiently:

πŸ‘€ Viewing Your Files

  1. Open the Workspace Tree tab:

    • Menu: View > Workspace Tree
    • Shortcut: Ctrl + 0 (Windows) or Cmd + 0 (macOS)

    Workspace Tree


Official Perforce Video: Perforce Helix Core Beginner’s Guide: Submitting, Syncing, and Managing File Changes


πŸ”„ Syncing to the Latest Version

πŸ”’ Checking Out Files

πŸ“€ Submitting Changes

  1. Go to the Pending tab

  2. Right-click your changelist and select Submit

  3. Enter a detailed description

  4. Click Submit

    Submit Changes


✏️ Editing Files

  1. Check Out: Right-click the file and select 'Check Out'
  2. Edit: Make your changes using your preferred editor
  3. Submit: Right-click the edited file and select 'Submit'
Remember

Always provide a clear, descriptive message when submitting changes!


πŸ“ Adding Files

  1. Create or Place Files in your workspace

  2. In P4V, right-click and select Mark for Add

  3. Submit the changelist to add files to the depot

    Adding Files


Official Perforce Video: Perforce Helix Core Beginner’s Guide: Undoing Changes and Fixing Deleted Files


πŸ—‘ Deleting Files

Important

Always use P4V to delete files. Don't delete directly from your file system!

  1. Locate Files: In the Depot tab, find the file(s) you want to delete
  2. Mark for Deletion: Right-click and choose "Delete"
  3. Submit the Change:
    • Go to the Pending tab
    • Right-click the changelist and select "Submit"
    • Enter a description explaining the deletion
  4. Verify: Check both the Depot tab and your local workspace to ensure the files are gone
Tip

If files persist locally after deletion, try refreshing your workspace or syncing to the latest revision.


🌊 Working with Streams

Streams are purpose-defined branches that make managing changes easier.

  1. View Stream Structure:

    • Open the Stream Graph tab: View > Stream Graph or Alt + 7
  2. Switch Streams:

    • Right-click your workspace, choose "Edit Workspace"
    • Select the desired stream
    • Or drag the computer icon in the Stream Graph

    Switch Streams

  3. Merge Changes:

    • Right-click the target stream and select 'Merge/Integrate'
    • Follow prompts to resolve conflicts

    Merge Streams

Also see:

πŸ’‘ Best Practices

  1. Sync Frequently: Get the latest version before starting work
  2. Check Out Wisely: Only check out necessary files
  3. Review Changes: Use "Revert If Unchanged" before submitting
  4. Descriptive Submissions: Always provide clear commit messages
  5. Communicate: Keep your team informed about significant changes
  6. Regular Syncs: Update your workspace often to minimize conflicts

Want to Learn More?

Check out the Official Helix Core Documentation for in-depth information and advanced techniques!
Visit the Perforce YouTube Channel for video tutorials and references!