Find string in array - what am I missing?

Bit of background, I’m pretty new to blueprints (only been using them a couple of weeks) but I do have a solid background in programming (PHP/MySQL for the last ten years) Initial impressions are good but I have run into the whole - can’t do multidimensional arrays - thing and am currently in the process of jumping through hoops to make that happen. So I’ve adopted a relational database approach with an array of 3 dimensional indexes and a corresponding array of data structs. The project is procedurally generated so each time I add a new room it works out the location then adds that onto the index array and then adds a corresponding entry to the data array. Because these are added at the same time the array keys should stay in sync and thus I’ll be able to get the data key by searching the index array for room location.

Problem is my find is failing every time and I can’t for the life of me figure out why. Pretty sure this will be a classic case of - noob misses something obvious - Any ideas? See the attached photo - Surely it should have found it at [3]?

Just do it in c++ and save your self the trouble. The BP implementation doesn’t even support sorting of arrays so you would have to do that anyway.

Also, look into how to use Map.
it’s essentially a multidimensional array.

That said, is the gmap indexes array made of values that include the " symbol?

try to see if you get a result of Get with index 3 and print it out for starting to debug.
Also print string prints to the log as well, which is much more legible than the top of the screen corner…

Thanks for taking the time, mate. I actually popped back in to say - I’ve solved it. Turns out, because my rooms each have 6 doors, only one of which can be open at a time. If I open a door, it closes the other but the data persists on the closed door but doesn’t get updated. did I mention I’ve been using PHP for the last ten years? Variables still being there after I’ve used them is a bit of a culture shock :eek: So I’d chosen the wrong debug object to watch. It was working fine the whole time.

I looked at maps early on but ran into some issues. I was still trying to simulate a 2-d array at the time, tho so I’ll probably switch my index over to that. I’m guessing search will be way faster than wading through an array?

I’m hoping to avoid C++ if at all possible. It’s going on 30 years since I used that and, yeah, it’s similar enough to PHP to be familiar but just different enough that I can envisage a making a whole load of stupid mistakes. I’m really liking the way the nodes-approach sorta prevents a whole bunch of syntax and type errors. Plus, watching the dataflows is a hoot to debug!

And, yeah, the " thing on the array watch had me scratching my head for a while but it turns out that just an idiosyncrasy of the editor - they’re both string data and play fine together.

I always done more then just php, but as a senior fullstack dev for the last 12 years I feel your plight.

That said the unreal C++ is almost it’s own language so you would be learning pretty much from scratch.

Alternatively the engine now has Perl scripting, which is easy enough for a php person to learn/use.
I’m not sure how powerful it is, but I really have to start looking into it to automate things editor side.

I’m not sure about speed on Map vs Search.

Compared to php the end product here is extremely performant. We are talking 1000 loops on milliseconds vs the php usual.

I have tried myself to use php tricks to fool the editor like an empty loop just to bypass the fact you get no delay in a function. You just can’t. It’s as fast as not having a loop…

The cool thing is (if I’m reading it right) I have the option to go C++ if I hit a wall with the nodes anyway? The visual thing really appeals to me and I’m pretty sure I’m learning the libraries while I’m at it - you can kinda see the stuff going on in the background if you know how to look.

So now I’ve run into another problem - intermittent visual glitch. I’m pretty sure I know what’s causing it. The way the level works is you’re always based on worldspace origin with one room there and another room adjacent, north, south east, west, up or down. If you move into an adjacent room and then open one of those doors the order of events is as follows:

1 the previously open door closes
2 the room behind that is destroyed
3 the current room and the pawn are moved to worldspace origin
4 the new adjacent room is spawned
5 the door is opened

I was expecting issues with stage 3 and I got one, in the form of a weird circular shadow appearing over the door, just before it opens. Doesn’t happen every time so I’m guessing it’s a timing issue. Something is lagging for a split second, every now and again. Room has one dynamic light, slap bang in the centre.

Here’s a video of it happening about 0:45 and again around 1:20

nice work even if it reminds me of one of the worse movies ever. Cube.

As far as the bug. First thing I would look into is occlusion / bounds.

Second thing, I would want to make sure/ analyze if this always the same door on the same side.
does the room rotate? Maybe a temporary change of material on the doors to include a number or adding a transparent non blocking mesh with numbers would help.

as far as wierd goes, it’s definitely odd.
it could be a texture loading. It depends on how the room geometry looks.
If the wall has an actual hole, then the doors are over-laying one another from the room you are in to the room you will be in.
and what you are seeing might be the back side of the door in the other room.

In which case, since they open at the same time you can probably just shrink the mesh to be half as wide and it would correct the issue as well as making the bounds bigger would.

On the other hand the fact you can’t see the same happening from outside the room makes me think it’s a planar reflection capture / lighting issue…

Worst movie ever? ■■■■, and I was just starting to like you, too :stuck_out_tongue: It is based on the movie. I’m going to do a kind of interactive movie tour as a - get to know my way around the engine - project. Hadn’t thought of reflections, I’ll take a look at those. Lights, too had crossed my mind.

As for which door it’s happening on, it’s whichever one you’re opening. I’ve more or less discounted the lightsource, since it’s in the middle of the space, I’d expect it to throw the shadow somewhere else from time to time but it’s always the activated door. There’s no intersecting geometry anywhere - whole thing was built in blender, on the grid and is composed of individual panels, and door pieces.

The thing you said about “Occlusion / bounds” sorry, I still got a lot to learn about this malarkey, anything other than programming logic and I’m clueless. What should I be googling to get up to speed?

Oh, occlusion is something you will now notice forever even in AAA games… (like a mummy curse, I know)

the usual thing that happens is flickering. Your black blob doesn’t really flicker.

it happens when the engine doesnt really know if a mesh should be displayed or not on account of other geometry occluding it.

Basically, with default settings put any mesh in the project such as a cube above the player’s head. During play pan the camera downwards so you barely start to see the cube.
you should then start to see the mad flickering.
should you survive the epileptic attack, you’ll now be forever cursed and will start to notice it everywhere you go.

To fix it, click the cube, look up Bounds, and increase the w/y/z by something. Usually I go with 2 or 10 depends on how much it flickers and what it’s sitting behind.

it’s probably not your problem, so I really just cursed you for nothing :stuck_out_tongue_winking_eye:

Btw, a tip on something that sort of bothered me, I would make the doors open in a random direction. I know it’s not really movie canon. But it would be less cube and more Get Smart if you know what I mean :stuck_out_tongue_winking_eye:

Let us know if you spot/fix the issue with the flicker and/or show more so we can think of more ideas…

Cheers for the heads up re: occlusion. Forewarned is half way to being an octupus after all! I know exactly what you’re talking about too. The new wolfenstein game has a ton of locations where there are 2-d planes signifying cars and pieces of paper, lying on tables, obviously occupying the exact same z-coords and flickering like hell, that’d be what you’re talking about, right?

Not so keen on the idea of random door direction, like you said - it’s not canon and I’m really shooting for authenticity here.

I eventually solved the shadow issue by sticking a 100ms delay between the old room being destroyed and the other one being transported to world origin. I think what was happening was to do with an edge case where the destroyed room might not disappear fast enough to get out the way of the relocated room and thus, for a fraction of a second, there were two dynamic point lights occupying the exact same space in the middle of the map. As soon as the door started animating … <insert technical explanation here>

What really screwed me up was that, when I was initially testing the mechanics, I stuck a mesh at world origin so I could easily see if the whole teleport thing was working. From my pov in VR I’d see the mesh suddenly “appear” in the middle of the room I was in whenever I opened a door. Of course I used the sphere mesh so I thought this was some kind of shadowing artifact and spent days trawling through everywhere I thought the sphere might have been baked or cached even after I deleted it. Just so happened the shadow glitch was round, just like if a sphere was casting it.