itch.io is community of indie game creators and players

Devlogs

Lesson in Perforce-Unreal Relations - by Tim Kim

No Rest For the Wicked
A downloadable game

Preface

It's easy to think that understanding and embedding a process into your habits is easy up until you reach an error that leaves you scratching your head... in my case, this was more than evident with my run-in while using Perforce and Unreal together. Let me set the scene for you:

Problem

One of my jobs for this project entails implementing a separate Game Mode to ensure that our Main Menu level does not run off the same Game Mode as our other levels. Why? Well that's because the Player Controller we utilize for our main gameplay needs to be different from a game mode that is build specifically for our players to navigate the main menu! Though not a crucial step, I decided to create a new C++ Class in our Unreal Project, which automatically creates two text files in the project files: a header file and  a cpp file - created specifically for the Menu Game Mode. As usual, I go into the Revision Control button in the Unreal Editor, create my submission description and send it up! From here on out, everyone else should be able to see the new C++ Class I made for the Menu Game Mode and also (more importantly) view the Main Menu that I created. Well here's what I see once I pull from the Perforce repository and go to view my work from the night before: not only does the Main Menu not show up when starting the Main Menu Level, but I'm also greeted with this message when investigating the cause:

Flustered, I go to check the Perforce Repository to also find that the header and cpp file that I had created was nowhere to be found. Almost as if someone went in and deleted the code I uploaded!

Solution

After some research and asking teammates about their usual revision control process, I discover two important things that have brought my greater knowledge about utilizing Perforce and Unreal. Yes, you can push content up from unreal, but these pushes are generally pertinent only to changes made inside the Unreal editor itself. Items considered outside of the unreal project (yes, surprisingly, this also accounts for/includes header and cpp files being used in your Unreal Project) must be pushed from Perforce specifically

If no pushes are made from your own local workspace and you decide to get the latest revision - you might as well say "goodbye" to your work, because they're getting overwritten. That's right. The biggest takeaway I learned from this experience was: if you're submitting code to the Perforce repository, especially code that you wrote for your Unreal Project - Submit your changes FIRST, then you can go back to your Unreal Editor and push content from Revision Control if you've made changes in the editor as well. This was how I was able to ensure that my code for this project's game instance was pushed into our project and our Perforce repository

Conclusion

Mistakes and errors are a great way of learning any process. Sure, if things were made easier, I think I would have had a better time with just focusing on working on the project - but now, I feel more confident that if I or a team member were run into issues on Perforce (say they could have sworn they pushed code, but they're not seeing it on the repository) I'm fairly confident in my ability to help out.

Leave a comment