<ASAP> Please provide a "PURE C++" Sample Game with "ALL the basics".

Hello Epic guys!

Some of us just need a basic sample game showing a simple** HUD , PlayerController, Input, RealTime Customizable Character, Weapon Assignment, MapChanging/Loading and a Singleton**, being this last a feature assignable on the Editor, but about you can’t find a single complete sample on docs. Until if you start a “NonBP” new project it didn’t come with all basic needed components/classes and your samples until now are most, “if not completelly” BP based. :mad:

Explaining the request:

I was comparing my learning curve from UDK with my current stall and rough progress on U4.

I got how to code my classes on UScript a lot faster than with U4, I can be talking just by myself, but it’s being a pain, so I apologize in advance if my feedback/request shows what many could call as a “newbie frustration”. :frowning:

As you should know, use a third party engine has some pitfalls, because you don’t need to know “the language” itself, but the logic that your engine provider programmers did used, and how their classes/libraries/macros works, let’s be sincere, it’s not about learn to code on C++ (there are plenty of resources about this on Google), it’s about watch what you did on C++. As an example, when you add a class trough the editor it already comes with the “Unreal Default Constructor”, you “force” naming convention with that prefixes, well, it’s not just “sit down and code” as on the “Age of UScript”, now it’s sit down and obligatorily code as an “Epic Games’ programmer*” whose requisites and under the hood knowledge unfortunatelly are not easy to figure about.

  • I’m not saying that this is bad, most of us will grow a lot from this, but you could haste the things.

When learning UDK and UScript an amazing resource were the “Sample Games” that you gave to us, I learnt a lot from “Whizzle” and “Dungeon Defense” code samples, not because I could “Ctrl+C + Ctrl+V” programming, but simply because they shown how to declare, initialize, setup methods as PostBeginPlay(), Tick() and so on in a way that we didn’t get some weird compiler error on adding up each 5 lines of code.

I understand that you “probably” do wants to promote your “Blueprint” feature, but specially the guys that were with lots of UScript “ready and working classes” could be interested on just rewrite then on the new standards and go on to the happyness. :o

I bet that to any from your pro²grammers until if alone would be a 3 days work and could reduce amazingly the quantity of questions that we currently have on the Hub. :wink:

I apologize again if the mood/tune was not the better, I really love what you did by me on making UDK and now U4 accessible, so if I was a bit harsh please forgive me.

Best Wishes!

creasso

But it does have a sample “PURE C++” game with “ALL the basics” - ShooterGame. I found that to be an invaluable source, as well as the C++ Starter kits. As well as just jumping head deep into the code.

Whut?
When you start a new project you can create base FirstPerson, Flying, Rolling, Sidescroller, ThirdPerson and TopDown projects done in PURE C++
And in Marketplace you can find Shooter Game and Strategy Game, they are coded too

Created a project of this kind already…
Look at the ACharacter class, there is not even “ONE” call to SetSkeletalMesh( )…
Check also the ProjectSettings on the Engine, there is no Singleton Class or usage…
Do a Solution Find by the string “weapon”…
Understand what I’m talking about? :wink:

NOTE: After check on marketplace found the Shooter Game…
I’m downloading it now, I thought you were talking about first person project, also the previous study from Strategy Game was not a big thing.
I’ll check this out and come back to apologize after…
Thanks for point it out.

Ow… And could you please give me a spoiler?
Does the Shooter Game have a Singleton Class assigned? It should be UGameGlobals or something alike by what I’ve seen on docs. :smiley:

Sorry, no reason to apologize.

Well, I would love to come back here and say: Hey! Sorry! I didn’t know about the amazing resource on that sample.

But, unfortunatelly it’s not the case, I finally got the download complete, it’s amazing, I agree, but it’s not what I was talking about…

First, looks like everything gameplay related now just could be done trough Blueprint, until on “said” C++ projects you can find the Blueprint folder with “main functionality” bound to it:

About the Singleton, the project settings doesn’t show any class choosen, BUT! Whoot! It’s GameKing… :smiley:

And about the Character class, c´mon, is just a pawn with two meshes previously created (being one the default) that turns hidden to true to “simulate” a switch between then, there is no usage of Runtime mesh loading or assignment on the class.

So, sorry guys, but if you does allow me to still make a suggestion, I’ll still defend the point that Epic would be amazing (as usual) if provide at least one “PURE C++” game sample. :rolleyes:

Kinda want to second this as well. Granted, think I’ve discovered a good deal about what I’ve been searching for, but perhaps for others who started off with a background similar to mine would benefit greatly. So many little things that I’ve stumbled on by chance, like learning of certain functions that trigger by some boolean value change, or knowing which methods are always fired and which ones to attach custom code into. Indeed you’ve included so many fantastic functions that it would be impossible to cover all… Think I read before that adding sample code to the API documentation was in the works, this may help as much as a fully c++ sample would.

What I’d recommend is that if a new sample project was made, it’s totally basic. We have tons of great effects samples to look into. I’m talking simple shapes, a few humanoid figures wandering around via AI, some UI elements maybe with some drag and drop, scene/level transitions, etc. Purely game function kind of stuff. Not just using the default methods, but showing a few custom classes and how they fit into extending existing classes.

I think the engine is designed that a lot of the Gameplay logic be done in Blueprints and C++ together. Just as you have some limitations trying to use only Blueprints you will have some limitations trying to not use them at all.

Honestly, I’m not sure it is possible to have a game with no Blueprints in it.

What? I hope not, would be bad engine design.
Want to second this as third. :slight_smile:

I’d second this too but it looks like someone already beat me to it. Anyway, I’ll still claim fourth! This needs some love.

Coming from a language not too far off the beaten path of c++, I’ve thought of this several times during my second and third week peering into code examples (even so after shooter-game, etc). The API being a monster, some simple/moderately-advanced building block examples would be wonderful.

Edit-
Ideas for such examples should be off the wall stuff - dealing with light properties, scaling various post affects, interacting with matinee and the like. There are a fist full of tutorials showcasing blueprint compared to C++ tutorials. Any tutorials you guys do for C++ should definitely be written. Video’s are a pain to pause and reference after awhile.

Actually, the shootergame IS a PURE C++ sample. In UE4, even if you want to make a game entirely in C++, you need to create a blueprint subclass of your code classes to actually use in the editor. Also, you aren’t supposed to have direct content references in C++, create a blueprint and set your skeletalmesh variables there.

If you look at the shootergame blueprints, you will notice that their graphs are actually blank. There is NO blueprint functionality whatsoever in that game. The blueprints are only there out of necessity, for referencing content and editor placement.

Think of it this way: in UDK, we had a “Content Browser” and an “Actor Classes” browser. In UE4, you don’t use the Actor Classes browser, you just make a blueprint of your C++ class and treat it as content. (There probably still is an Actor Classes browser somewhere, but I’ve neither used it nor felt the need for it.)

I hope this clears some things up for you :slight_smile:

#greg

In UDK you could get the same functionality you described by using “Archetypes”, you could create one from a custom class and fill any variable tagged with var( ) on the editor and save for further usage, this now (I guess) is also made by Blueprints if we tag any variable on code with the UPROPERTY( ) identifier. Is specially useful to make things that you’ll use on Level Design process to things that should be on level ready from start.

The Character class is an “archetype” whose meshes were assigned trough editor. Now, let’s think this process if you are implementing a character class to gameplay…

1 - Declare Mesh variable component on Visual Studio on your .h file.
2 - Initialize all fields from your variable except the “Mesh” on your cpp file.
3 - Compile with tag Development Editor.
4 - Open Editor.
5 - Create a Blueprint from your class and open to access the components.
6 - Find your Mesh on Asset Browser and assign it.
7 - Save the “Package”.
8 - Close the editor and back to VS
9 - Switch back to tag Development
10 - Continue coding…

What Imho would be a pure C++ character sample code…

1 - Declare Mesh variable on Visual Studio on your .h file.
2 - Initialize all fields from your variable on your .cpp file (using the right method to point the mesh you want trough a Path).
3 - Continue coding…

I just began “dissecating” the sample and got some “tips” on another thread about how to adapt previous UScript knowledge to the new programming methods, but I guess that by watching my description you can understand better what some of us does wants to see. :wink:

Why would you do something like that? Things like the path to an asset should never be hard coded…

@creasso

They don’t want the content references to be permanent, probably in case the needed asset doesn’t exist or has been renamed. (Blueprint referencing will keep the asset after a rename :)) Also, why would you need to set the Mesh right after you make the var? Do this:

1 - Declare Mesh variable component on Visual Studio on your .h file.
2 - Initialize all fields from your variable except the “Mesh” on your cpp file.
3 - Act like you already set the Mesh variable and continue coding until you want to test.
4 - Compile and open the editor like normal.
5 - Go set your Mesh var in your class blueprint. This is the only added step, which you would have had to do in VS anyway.
6 - Continue testing like normal…

Is that so bad? I haven’t found any problems with it. (Also, it is possible to set content references in code if you really, really want to, but it is not recommended.)

We can discuss this until the judgement day… But please, if you could let’s keep the thread theme:
Someone from community would like to know how to code some things as an Epic guy without need to open the editor shorting Blueprint usage to minimal. :smiley:

#order66 - One of the reasons: To prevent object creation/spawn without a base asset assigned (someone could forget, do you agree?)
#greg - Yes! I really, really, really, really want to know this and a lot more things. :smiley:

Here’s an example from the shootergame ShooterHUD.cpp:

And in ShooterHUD.h all we need is:

For some reason they did all the content referencing in code for the shootergame HUD. Check ShooterHUD.cpp for more examples :slight_smile:

So all you are really wondering about is how set an object from a path in C++?

OMG… This is being hard… :frowning:

I’ve seen a lot of samples with FConstructorHelper, but if you watch the documentation with some “deepness” you’ll notice also the Async Loading Asset trough usage of FStreamableManager that Epic’s documentation points that “don’t stall your thread”. So, on read this I suppose that an Epic programmer would not use the “forced” FconstructorHelper hack everytime it needs something from a package.

This kind of things “as I said previously” just a REAL EPIC PROGRAMMER can know (specially the right way to implement), and while a “complete and sampled” API documentation with everything will take a lot of time to compile, a simple Pure C++ sample would give us enough directions about what to do, what not and when to do, to don’t mention the lots of syntax examples (declarations, when to use pointers, inlines, references) that we could get.

Well yeah it’s more complicated, that’s why they encourage the use of blueprints. :slight_smile:

Great! I think you got the idea now!
And so, we can go to: What’s the point on provide full source code if they also don’t point some well explained directions about how “they are used” to use it? :wink: