Creating a simple game! Collect Pickups!

So I have created a very crude version so far and I’m looking for help on Improving, and just looking to show my progress to the community!

Just as a heads up I don’t have to much programming experience, and I am mainly an artist but I want to turn environments into a fun little game to run through!

What I currently have functionally!

  • I have one pickup that give the player one point!
  • I have a score bored that follows the player and tells them how many points they have!
  • All information goes from the pickup to the score bored through the level blueprint

Here are my current Blue prints and shots in game!
Start with zero points:

When you grab a pickup you get points and the pickup disappears and explodes giving the player a point. It then waits 5 seconds to explode and reappear

blueprint of the pickup

blueprint of the score bored

Level blueprint: This is where I think some major improvement can be done Im just not sure how to go about it! I have the pickup event coming from the pickup for each pickup in the level and a pickedup event that is sent to the score bored blueprint adding a point to the players score. I there a way to have to score bored get the event picked up from the pick up and the pick up also tell the score bored how many points it is worth?

What I will be working on! / questions I have for everyone reading!
-I’m not sure if I should be create a game type blue print to handle all information + I don’t really know how to get blue prints(not the level blueprint) to talk with each other. For instance how could I get the score bored to directly here when a pickup is picked up?

  • Also I would like to create different types of pick up that are picked up in different ways. For example the current one is picked up by walking into it, but what if I wanted one to be shot by a gun to be picked up and another to be grabbed by a key pressed based on proximity?

  • Also I would like to create a timer that is the allotted amount of time that is given to the player to collect as many pickup as they can

  • Not even sure how to do this at all, but would be a cool stretch to make it multiplayer

Updates soon! Thanks in advanced for any input!

I did implement a pickup system in a test project I worked on a couple days ago:


Don’t laugh, I just put a few hours into it, mostly to get faster with class BPs and hud functions(yes all hud/menu stuff have some kind of animation too, finally heh), and again, it’s just a test. : D

The thing is, I didn’t put even a single node into the level blueprint, and I’m not saying you shouldn’t, but you should try to minimize your work there, as much as possible. It both makes scaling up the game much much easier and your gameplay also is not dependent on specific levels. Try to only use level blueprint, for level-specific stuff.

As for your last shot for instance, you shouldn’t really have to always modify the level blueprint, again and again everytime that you add a new pickup to the level. For that you have a couple ways to proceed. What I did, was to create a simple blueprint interface, called HudBlueprint, and using that, I communicate directly from the pickup actor to my Hud BP (you can do it with your PC BP too, but in my case Hud made more sense).

This way, not only you’re not dependent on the level blueprint anymore at all, but also each pickup takes care of its own event, which is what all objects should preferably do in a OOP environment, including C++/BP.

Wait a minute, you did have some questions too, didn’t you?

-I’m not sure if I should be create a game type blue print to handle all information + I don’t really know how to get blue prints(not the level blueprint) to talk with each other. For instance how could I get the score bored to directly here when a pickup is picked up?
[/QUOTE]

I already mentioned what you need to do, you have actually 2 general ways to go for that, but I would suggest implementing

For that either move the score handling to the hud class, if you want to use a real Hud, or use the same actor you have now, either way, make a new interface, and implement it in both that class and your pickup BP.

  • Also I would like to create different types of pick up that are picked up in different ways. For example the current one is picked up by walking into it, but what if I wanted one to be shot by a gun to be picked up and another to be grabbed by a key pressed based on proximity?
    [/QUOTE]

A good way is to implement all of those in the pickup BP, and keep them all disabled by default, and then enable only 1 depending on what behavior you want for each specific pickup.

Another way is to create a paret pickup BP, which takes care of the pickup event itself, but you also make a few child of that BP, and each one takes care of exactly one type of blucprint , as far as the pickup method goes, they all call the pickup event in the end and the parent code kicks in and handles the rest.

  • Also I would like to create a timer that is the allotted amount of time that is given to the player to collect as many pickup as they can
    [/QUOTE]

Again, you have a couple ways, but to keep it simple, either use a Timer, or a delay + Tick event, or even a timeline.

  • Not even sure how to do this at all, but would be a cool stretch to make it multiplayer
    [/QUOTE]

Well there’s no need to say, you first have to figure out what you want different players to do, and how they should interact, in other words, first take care of your concpet for MP, and then we can talk money, heh.

Level blueprint: This is where I think some major improvement can be done Im just not sure how to go about it! I have the pickup event coming from the pickup for each pickup in the level and a pickedup event that is sent to the score bored blueprint adding a point to the players score. I there a way to have to score bored get the event picked up from the pick up and the pick up also tell the score bored how many points it is worth?

[/QUOTE]

This is exactly where I am stuck. I cannot find a way to make one event for all my pickups, without referncing them all.

Maybe look at inverting your flow on the level blue print - rather than having every single pickup connected this way to your scoreboard - make this connection within the class blueprint of the pickup. Have that reference your scoreboard blueprint from within the class blueprint then you do not need to connect each one up as you place you should just drag and drop your pickups as many as you want. So at the moment you have your event “PickedUp” within your scoreboard blueprint. Try placing that event in your Pickup blueprint and the logic for the level blueprint should be moved to your score board. That will simplify your setup significantly. :slight_smile:

Interfaces are you friend.

tutorial

Overview

There are a few ways to tackle this. You could keep the actual score in a GameMode blueprint, and have each pickup use Get Game Mode and cast to the correct type to change it. Then the scoreboard could do the same thing, access the GameMode and cast to get the current score.

Or each pickup could use a Get All Actors Of Class to find the scoreboard and notify it when they get picked up, though this is a bit slower.

Hi JamesG ,

is it more fast cast game mode what use a interface between the pickup and the score?

thaks.

I tried that blueprint parent inherited method. It works well (probably), parents event is fired on each child object.
But i was kind of lost in event Dispatcher way of working (ie. what call, assign etc do).

Content examples have one very big flaw, there is everything mixed together from all maps, examples, and blueprints for everything used in project.
So its very hard to find all BPs involved in example i want to learn.
But one example has “for Each” loop that iterates trough every instance of some class. So this network with net of nodes could be replaced by that single loop.
But but, inherited method or interfaces look more elegant.

Ps. I followed those tuts about interfaces, but I am getting “accessed none” error. I know subtle differences between class, instance of class and all those references.
Still trying to figure what is what in unreal 4.

Find game instaces is a pinnacle of made games.

direct reference and casting a way:

Thanks , that and HUD tutorial explained me 2 things i was missing.

Btw. I tried “get ALL actors of class” + “for each loop” approach, simple game had visible lag each time I fired event with this loop on 100 pickups, so for each is not good solution.

I think best and fastest is Cast as Player used from inside of pickup blueprint, then you modify players variable.

Maybe take a look at the pickup blueprints in the Swing Ninja sample game that might help :slight_smile:

Hey everyone!

Thank you for all of the information! It helped allot and gave me allot to look through!

So here is what I have done so far!


So I built a simple HUD that give the player there score and shows there Health with help from the HUD level in the example content! thanks for pointing out the level !

I also finally figured out Interfaces!! there allot easier then I thought!

In the game so far I have health, health total and score as variables that in the Pawn BP (My Character which as I have been working Im going to move Score to the Game Mode so I could change the pawn if I want)!
I created a interface that I called GameInfoTransfer and I figured out finally that if you want to use the interface with all your BPs you have to Implement the interface on each of your BPs.(do this by clicking the Blueprints Props button at the top of any BP and then in the bottom left add your interface to the BP, check my Grabit pickup pic for the red boxes)
The interface is connected to all of my BPs, and for example, whenever any of my pickups are picked up I send a Scored interface message to the player and the Event Scored shoots and give the player a point!
I then took that a step farther and created a PlayerDamaged function in the interface so i heal or damage a player when they pick up a pickups!

Some other small things that I am working on are damage on fall, and some sort of endurance bar for sprinting and jumping higher.

Here are some of the new BPs there are alot more and if you want me to show them let me know

This the pickup BP and I show where you can add your interface


Here is the Pawn Its a mess and I want to create some macros and functions to clean this up more(also move the score to the gamemode BP)


and here is my boring but amazing interface!

No Laughing here Im still learning! thanx for all the info it helped alot!

like sayed Interfaces, that way I dont have to rebuild the level blueprint in every level I build!

Moving the score into the game mode! I actually moved it to the pawn but realized later that if I want to change the pawn that would obviously mess up the score so good call!

I still havent looked at that yet! Ill add it to the list!

My new List!
-Rework the fall Damage
-Create a enderence system for running faster and jumping higher
-Learn how to implement my own character/Pawn
-Create Start menu

They are probably about the same speed.

ok, thanks, good to know.