Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6934723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:59:51+00:00 2026-05-27T11:59:51+00:00

I’m building a spot the diffrence multiplayer game. The specifiactions of the game are

  • 0

I’m building a “spot the diffrence” multiplayer game.

The specifiactions of the game are :

  1. There can be up to 10 players in each game.
  2. A user must not see the same picture twice.
    (a picture consists of
    four images and the user must “spot the difference” between them )
    .

I have a collection of thousands and possibly even tens of thousands of
pictures to choose from. The problem I’m facing is an extremely
non-eficient and un-scalable method for finding a picture that none of the
game players have seen yet.

In my database I have a usage table with the following fields :

  1. picture_id
  2. user_id

My current solution is as follows :

User enters game, app selects a picture from the database that does not appear in the usage table for that user, and for each user that enters I run the same function only adding values of pictures that other users in the same game have already seen.

I am concerned that once there is a database of tens of thousands of pictures to choose from, and the usage table is already being filled up by previous games, that the function will simply take too long damaging the flow of the game.

This method is not very scalable and I am expecting quite a steady flow of constant traffic meaning lots of games being played.


Does anyone have any suggestions on how to improve this logic or suggestions for a better database structure?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:59:51+00:00Added an answer on May 27, 2026 at 11:59 am

    You could simply add a field to the picture table (not the user/picture mapping) that flags whether a picture has been used. You can then set that flag whenever a pictures is used, and index that field for fast identification of unused pictures. This is effectively caching the result to a hasBeenUsed() function.

    Some people may object on various ground and that such premature optimisations can lead to a highly cluttered and very tightly coupled structure. Penalising future maintainability.

    An alternative is to have every picture in the user/picture mapping table. If a picture is not used, its associated user_id is left as NULL. An index with picture_id first will make identification of un-used pictures very quick.

    But most of all, it actually depends on the query you have to make this random selection. Very often (but not always) poorly scalable algorithms can be replaced with much more scalable algorithms without changing the database structure at all. But to know that we need to see your query, as well as the schema and behavioral information about the data (constraints, likely %unused, etc).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
Does anyone know how can I replace this 2 symbol below from the string
I need a function that will clean a strings' special characters. I do NOT
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.