Download

Replication - Generating a grid of blocks and passing to clients

I have a game and I got it to generate a 10x10 grid of random blocks using spawn as class and a nested for loop.

Basically the goal is to have the blocks generate server-side and then be passed to players when they join the game.

Also, I have the grid of blocks generating via a level blueprint, I was wondering if there was a way to do it outside of that?

And the last thing is probably much simpler, but I don’t know how to request the server to handle an object being destroyed and awarding points for it (a value in the character itself).

Bump - I just need a little help from someone to progress.

Is this forum dead? I thought I could at least get some response…

You need to check if for net authority before doing anything that affects the gameplay.

I suggest creating a replicated function and checking the authority there and calling that.

You should watch the networking tutorials Epic have, And look at the “Content Examples” example of replication.

HTH

I got pretty far with those, but I’m stuck again, and this time it’s upon trying to use a node called “Spawn Actor for Gameplay Task” which runs on the server and it demands a “Task Owner” I’m lost with the whole task owner thing, i’ve tried a lot of things, but nothing seems to work! 6f36ddb7ff975e670ad1cebc4d7ce278690579c9.png

I am not familer with the “Spawn Actor for GamePlay Task” node, But here are pictures of one of my BP’s (It’s a projectile that spawns actors of the specified class every N seconds ):
This is the event graph
7f86a0fdd46bbe67d6f6d8927800cb0ebb6da358.jpeg
And here is the Spawn function

Let me know if you need more help.

I have also just remembers that Exi has released a free PDF Unreal Engine 4 Network Compendium Released.
It is a really good read for networking in UE4.

HTH

Edit: If you move(hover) the mouse over the red error bar there will be a pop up that tells you what it is about.

I ended up finding that Class Arrays don’t work at all, they always return a value of NULL for any class input. So when i went back and tried to retrieve it, NULL was returned. I went around this by making my own Enumerator mock up and went about it that way with this function to return the proper class. This works for me.

365ea74a93c968b57692ab80ec7c2340d82f9626.png

Thanks for the note on networking too, much appreciated :slight_smile:

I’m working on trying to get the left mouse button to raycast on the server side right now, as it’s best to handle all logic on the server side so the client isn’t responsible for game changing events. That’s what I’ve been learning anyway, if you have any more helpful links or tips, let me know, and I’m sure ill be back when i run into some trouble with networking xD

The class array should have worked, Could you post info about it?
It could have been that something went wrong when setting the default contents.

Feel free to PM me the link to the thread (or just a question) if you need more help, I do my best to help.
I have done the raycast from camera position( the mouse should be easy to take into account) to pickup a weapon, So I should be able to help if you need it.

Tips:
Make sure that your replicated actors have there owners set, I have had some issues (I can’t remember what exactly) when they did not have an owner.

Good luck :slight_smile:

PS: I’ve done most of the network related stuff in C++, so I may have to translate to the BP equivalent.