Skip to content

feat: Add a new template: 2D Platformer#3042

Merged
Eideren merged 10 commits intostride3d:masterfrom
D4rkDuck:feat-2dplatformer-template
Mar 15, 2026
Merged

feat: Add a new template: 2D Platformer#3042
Eideren merged 10 commits intostride3d:masterfrom
D4rkDuck:feat-2dplatformer-template

Conversation

@D4rkDuck
Copy link
Copy Markdown
Contributor

PR Details

This PR adds a new template to the stride launcher.
The template adds very basic functionality with no specialized code architecture, making it perfect for newbies to get into creating a new 2D project.
This template uses new assets from two new CC0 licensed asset packs:

Related Issue

Feat: 2D Platformer Template #3030

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

When rebuilding the solution there are 3 error messages related to tests. I believe these are unrelated to my changes. Stride.GameStudio launches with no problems.

image

Visuals

Here are screenshots of the launcher and launched game:

image image

@Ethereal77
Copy link
Copy Markdown
Contributor

Is the PR done? Or still WIP?

@D4rkDuck
Copy link
Copy Markdown
Contributor Author

Is the PR done? Or still WIP?

Done and ready to be reviewed.

Copy link
Copy Markdown
Contributor

@Ethereal77 Ethereal77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made some comments on things you can improve.
Sorry for all the nitpicking, it is to mantain a common code style along Stride codebase.

Nice work overall!

Comment thread samples/Templates/Platformer2D/Platformer2D/Resources/coin.png
Comment thread samples/Templates/Platformer2D/Platformer2D/Resources/lancelot.png
Comment thread samples/Templates/2DPlatformer/_2DPlatformer/Resources/skybox_texture_ldr.dds Outdated
Comment thread samples/Templates/Platformer2D/Platformer2D/Resources/spring.png
@D4rkDuck D4rkDuck requested a review from Ethereal77 January 29, 2026 18:07
Copy link
Copy Markdown
Collaborator

@Eideren Eideren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good ! Just a few minor things to show best practices

@Ethereal77
Copy link
Copy Markdown
Contributor

As a last step after having done all of that (to avoid too much hassle), but before calling it done, I would propose to rename the template and its related files and projects to Platformer2D instead of _2DPlatformer. It is pretty unconventional to name programming things starting with a digit, and imho the underscore is ugly.

@VaclavElias
Copy link
Copy Markdown
Contributor

As a last step after having done all of that (to avoid too much hassle), but before calling it done, I would propose to rename..

This makes sense. I had to do the same in the toolkit.. many things are now Something2D..

@D4rkDuck
Copy link
Copy Markdown
Contributor Author

D4rkDuck commented Feb 2, 2026

Alright, but before I create a new project with the same settings: Is there an easy way to renaming?

Because I assume with projects there are always some kind of references set somewhere that relate to the name and I can't just go through each file and _2DPlatformer -> Platformer2D, same with file names right?

So what I'm saying is, it's easiest to just create a new project with Platformer2D as it's name + namespace.

@Ethereal77
Copy link
Copy Markdown
Contributor

Whatever is easier for you. For these kind of things, I usually do this:

  1. Close VS.
  2. Do a bulk rename of directories and files.
  3. Here I do a commit so the file renaming is registered in Git (even if they still contain incorrect data).
  4. Then I do a search and replace in all text files (code files: *.cs, project files: *.sln, *.csproj, and Stride files: *.sdsl, *.sdfx, *.sdpkg, and the *.sd* asset files).
  5. Then I try to compile to verify that all is still working as intended.
  6. Finally, I do the commit that includes all this replacing, and done!

This way, the history of the files is correctly preserved.

@D4rkDuck
Copy link
Copy Markdown
Contributor Author

D4rkDuck commented Feb 2, 2026

@Eideren so I pushed the code changes, but I guess the required fields set via the editor are saved in a different file. Looking through the files like scene and prefabs I am unable to see where exactly those values are saved (what has been selected for the required fields). Any idea? The only difference I see between my local project and the template is a difference in UUIDs

@Eideren
Copy link
Copy Markdown
Collaborator

Eideren commented Feb 2, 2026

@D4rkDuck Maybe you forgot to reload the code or something broke during reload, but here is the required property highlighted in the editor on your coin prefab
image
And the warnings when building the game
image

@D4rkDuck
Copy link
Copy Markdown
Contributor Author

D4rkDuck commented Feb 2, 2026

@D4rkDuck Maybe you forgot to reload the code or something broke during reload, but here is the required property highlighted in the editor on your coin prefab image And the warnings when building the game image

Yes I commented about 20minutes ago that the required fields are missing haha. How would I get the changes? I am testing the code in a local project and then copy stuff into the template-repo. So just copying the code from the .cs files isn't enough for the component selection in the editor.

@Eideren
Copy link
Copy Markdown
Collaborator

Eideren commented Feb 2, 2026

Ah, right, my bad, I didn't understand your issue. All objects and properties in prefabs and scenes are saved in their respective *.sdprefab and *.sdscene files in your 2DPlatformer\Assets directory.
Once you've assigned the properties in the editor, you can take those files and overwrite those in your template

@D4rkDuck
Copy link
Copy Markdown
Contributor Author

D4rkDuck commented Feb 2, 2026

Ah, right, my bad, I didn't understand your issue. All objects and properties in prefabs and scenes are saved in their respective *.sdprefab and *.sdscene files in your 2DPlatformer\Assets directory. Once you've assigned the properties in the editor, you can take those files and overwrite those in your template

hmm what exactly is needed to be overwritten? Taking just the content of the coin prefab and scene is not enough and seems to break the project (assets can't be found and scene doesn't exist). I assume that is because of conflicting IDs set in those files (main ID at the top and all ref ids). So the simplest would be:

  1. Create a Platformer2D project from the template
  2. Set references for required fields
  3. Copy and replace whole files from the local project into the template folder (not sure what the boundaries are, as in what files actually need to be replaced and which not)

@Eideren
Copy link
Copy Markdown
Collaborator

Eideren commented Feb 3, 2026

Right, you could copy/paste the whole asset directory, best to open the project directly in the sample directory and correct it there though, which I did and pushed in this PR to avoid wasting your time ;)

@D4rkDuck
Copy link
Copy Markdown
Contributor Author

D4rkDuck commented Feb 3, 2026

Right, you could copy/paste the whole asset directory, best to open the project directly in the sample directory and correct it there though, which I did and pushed in this PR to avoid wasting your time ;)

Ah I see, new things learned. Thanks!

@Eideren Eideren merged commit e0a2278 into stride3d:master Mar 15, 2026
2 checks passed
@Eideren
Copy link
Copy Markdown
Collaborator

Eideren commented Mar 15, 2026

Finally took the time to merge it in, thanks a bunch @D4rkDuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants