Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

What's the most efficient way to check a value against a large list of items?

Hello all, I am making a word game (like Scrabble) which requires players to use tiles to make words. I am trying to make it so that the words are checked for validity against a database of words (the entire english dictionary) when played. I was wondering if there some way of simply asking if the value exists in the database without having to loop through every word to find out? Would TMaps help out in this instance? The english language as a text file is around 1.6mb so I imagine it would be quite inefficient to be looping through this every time.

And secondly, would it be possible to populate the word database with an external text file via blueprints?

Any help would be greatly appreciated :)

Product Version: UE 4.10
more ▼

asked May 16 '16 at 06:57 AM in Blueprint Scripting

avatar image

20 4 7 10

avatar image nati8boy May 17 '16 at 12:08 PM

So after a bit of searching around it looks like TMaps are probably the thing I am after, but they (still) don't appear to be accessible from blueprints. Even if created via C++. Can anyone confirm this?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

you can separate your data alphabetically, so if your word begins with an S, you only check through the list of words beginning with the letter S. that way, instead of checking a million entries, you only check 30,000. if you want things to be more efficient, you can break the data down into smaller arrays. so put all the words that begin with "Sh" into its own list, and that will bring that 30,000 items to check, down to about 2,000, which should be fast enough.

if you want to automatically organize your data into an alphabetical tree that can be searched quickly, you might want to look into Btrees:


more ▼

answered May 16 '16 at 10:08 AM

avatar image

9.6k 320 205 450

avatar image nati8boy May 16 '16 at 12:38 PM

Ah yes. That sounds like a good option of splitting up the data. What is the equivalent of the b-tree in Unreal? I seem to be just getting 'behaviour trees' coming up in my Google searches (sorry, bit of a noob with this stuff - hence the questions ;) )

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

First of all, if you are that much worried about efficiency you should not be using blueprints but c++ instead. Secondly, you should consider using a integrated database solution such as SQlite 3. Implementation and tutorial on forums. (Porting txt to database is pretty easy.)

Scrabble is much more complex with it's point system, you do not need to add these on the database. Instead, make each tile have a 'point'>1 integer variable and then calculate the total points if the word exists and is valid for submission.

more ▼

answered May 16 '16 at 09:40 AM

avatar image

335 33 26 45

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question