Skip to content

Added 3 New LBP3 Categories - #1109

Open
W0lf4llo wants to merge 9 commits into
LBPUnion:mainfrom
W0lf4llo:feature/lbp3-recently-played
Open

Added 3 New LBP3 Categories#1109
W0lf4llo wants to merge 9 commits into
LBPUnion:mainfrom
W0lf4llo:feature/lbp3-recently-played

Conversation

@W0lf4llo

Copy link
Copy Markdown
Contributor

I added support for LBP3's recently played category.

Essentially, LBP2 tracks which levels you've played client side, and just reports it back whenever you click on "Recently Played". LBP3 on the original servers would handle all of this server sided. This essentially works by recording the recently played community levels via the games "gameState" request, then it stores the recently played slot ID's and the timestamps per each user. I set a limit so that it keeps a maximum of 20 recently played levels, when you replay a level that was already on the list, it changes the timestamp to have it re-appear at the top of the list. The game also only applies to users who are playing on LBP3. If you play LBP1 or LBP2, it will not change this list whatsoever.

image

@W0lf4llo W0lf4llo changed the title Added Recently Played support for LittleBigPlanet 3 Added Recently Played & Recommended For You to LBP3 Aug 13, 2026
@W0lf4llo

Copy link
Copy Markdown
Contributor Author

I wrote a fairly simple recommendation system for the server which is VERY similar to how Sony used to handle it. I left my comments in there so you can easily read what everything does and why its there. If anything else is needed to change in this PR please let me know! I just figured I'd stack it on top of this pr as i built this on top of my already existing work.

@Toastbrot236

Copy link
Copy Markdown

Is there a reason you're using /gameState instead of /play to find out what levels a user has played?

@W0lf4llo W0lf4llo changed the title Added Recently Played & Recommended For You to LBP3 Added 3 New LBP3 Categories Aug 13, 2026
@W0lf4llo

Copy link
Copy Markdown
Contributor Author

Also, I forgot to thank you on here for the recommendation, as using /play was a far better way of tracking when a user actually enters a community level. I appreciate it!

@W0lf4llo

W0lf4llo commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Also, this is my last commit to the PR unless an issue has been found.. which I'm sure there will 100% be issues, just feel free to let me know, and ask any questions if needed!

Increased the limit of recently played slots from 20 to 30.

@FeTetra FeTetra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a lot more to review, but I'm going to leave this for now.

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using LBPUnion.ProjectLighthouse.Types.Users;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
using LBPUnion.ProjectLighthouse.Types.Users;

This can be removed.

Comment on lines +36 to +39
public IActionResult GameState()
{
return this.Ok("VALID");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
public IActionResult GameState()
{
return this.Ok("VALID");
}
public IActionResult GameState() => this.Ok("VALID");

Why was this reformatted?

Comment on lines +13 to +21
public override string Name { get; set; } = "Newest Levels";
public override string Description { get; set; } = "The most recently published content";
public override string IconHash { get; set; } = "g820623";
public override string Endpoint { get; set; } = "newest";
public override string Tag => "newest";
public override string[] Sorts { get; } =
{
"date"
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
public override string Name { get; set; } = "Newest Levels";
public override string Description { get; set; } = "The most recently published content";
public override string IconHash { get; set; } = "g820623";
public override string Endpoint { get; set; } = "newest";
public override string Tag => "newest";
public override string[] Sorts { get; } =
{
"date"
};
public override string Name { get; set; } = "Newest Levels";
public override string Description { get; set; } = "The most recently published content";
public override string IconHash { get; set; } = "g820623";
public override string Endpoint { get; set; } = "newest";
public override string Tag => "newest";
public override string[] Sorts { get; } =
{
"date"
};

Comment on lines +23 to +25
public override IQueryable<SlotEntity> GetItems(DatabaseContext database, GameTokenEntity token, SlotQueryBuilder queryBuilder) =>
database.Slots.Where(queryBuilder.Build())
.ApplyOrdering(new SlotSortBuilder<SlotEntity>().AddSort(new FirstUploadedSort()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
public override IQueryable<SlotEntity> GetItems(DatabaseContext database, GameTokenEntity token, SlotQueryBuilder queryBuilder) =>
database.Slots.Where(queryBuilder.Build())
.ApplyOrdering(new SlotSortBuilder<SlotEntity>().AddSort(new FirstUploadedSort()));
public override IQueryable<SlotEntity> GetItems(DatabaseContext database, GameTokenEntity token, SlotQueryBuilder queryBuilder) =>
database.Slots.Where(queryBuilder.Build())
.ApplyOrdering(new SlotSortBuilder<SlotEntity>().AddSort(new FirstUploadedSort()));

@FeTetra FeTetra Aug 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This file has tons of formatting issues, there are private fields at the top which should all be configuration options, you should consider making a new config file to store search and category query options. There are also a lot of db operations which could potentially become very expensive, especially if the number of things such as neighbors can potentially approach the set max neighbor value of 250. A lot of the variable naming choices are confusing, such as the repeated use of h in lambda expressions which can seemingly refer to a hearted user or a hearted slot of which can either be hearted by you, a user you hearted, or (in the case of only slots) a distinct user who hearted the same slot as the user you hearted. In every other case with categories, they directly return an IQueryable for the database, in this case, you do all the db work here, and then convert the list of results into an IQueryable. This sidesteps the purpose of returning an IQueryable to begin with, as it is intended to only provide the database query for code within the list controller to actually perform the returned query alongside other things like pagination. The code will always attempt to grab a maximum of 1000 slot candidates for the resulting list, making the later query pagination in the code totally pointless.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants