• Advertisement

C++ I tried posting in Unreal forum but my post doesn't appear so trying here. Help with an issue in the c++ Battery Collector tutorial. Screenshots included.

Recommended Posts

I am looking to learn C++ in Unreal so have commenced the tutorial '3rd Person Battery Collector Power Up Game'.

It is on the 3rd video of the series that I have come across an issue. In the screenshot I have attached labelled 'picture 1', this is the tutors class which is correct. My screenshot 'picture 2' is where I see some issues.

- my #include is in a grey colour font. It should be red right?
- I also do not have a #include "BatteryCollector.h" in my class also. In the tutors example this line of code is present.

Can anyone help me with why I have these issues. I am using Visual Studio 2015 as well. I thought would using VS'17 help so I installed this today. I have yet to try this out with that though but then I thought. Shouldn't it work fine on VS'15 anyway, would using VS'17 make much difference at all.

I am very keen to work through this tutorial today so if the forum might be able to help me I would be so so grateful.

Thank you.

gamedevPic1.png

gamedevPic2.png

Edited by GameDevCoder

Share this post


Link to post
Share on other sites
Advertisement

Case matters. "Pickup" is not the same as "PickUp".

I notice that the .h file is called Pickup, while you are trying to include "PickUp.h". Same with all the functions.

Share this post


Link to post
Share on other sites
19 minutes ago, Lactose said:

Case matters. "Pickup" is not the same as "PickUp".

I notice that the .h file is called Pickup, while you are trying to include "PickUp.h". Same with all the functions.

Oh my, thanks very much for spotting. I shall open up the project and see if this sorts it all out. I hadn't realised I made an error with how I named the class. Well spotted and thank you again for spotting this. Shall post an update with how it turns out.

Share this post


Link to post
Share on other sites

Took awhile to try this out as I was finding it tricky to just remove the class i had before, done now though. So now making it again with the correct title. 'include' is still grey unfortunately. Maybe it being grey doesn't matter, possibly just something i can change in the font colour merely. It's strange how the examples code has that other line of text in it though too. I may just try pressing on with the tutorial and find out if this include thing is stifling me down the line.

gamedevPic1.png

Share this post


Link to post
Share on other sites

The color of things is your preference, they have no effect on C++ what-so-ever.  I personally prefer the dark scheme for visual studios as the white strains my eyes I find after many hours coding.  You didn't have to remove your previous class to fix your mistake, you merely had to change #include "PickUp.h" to #include "Pickup.h" the filenames don't effect the class in any way at all.  You could have also just right clicked on the file in Solution Explorer on the right side and picked Rename too.

Also, instead of posting your worries/concerns here, hit F7 to build your project and see if there are errors.  Then post those errors if you, after researching them (best way to learn), still cannot figure out the solution.  But just retyping someone else's code is no way to learn.  You need to try and understand what the code is doing and why it is working.

Share this post


Link to post
Share on other sites
11 minutes ago, Mike2343 said:

The color of things is your preference, they have no effect on C++ what-so-ever.  I personally prefer the dark scheme for visual studios as the white strains my eyes I find after many hours coding.  You didn't have to remove your previous class to fix your mistake, you merely had to change #include "PickUp.h" to #include "Pickup.h" the filenames don't effect the class in any way at all.  You could have also just right clicked on the file in Solution Explorer on the right side and picked Rename too.

Also, instead of posting your worries/concerns here, hit F7 to build your project and see if there are errors.  Then post those errors if you, after researching them (best way to learn), still cannot figure out the solution.  But just retyping someone else's code is no way to learn.  You need to try and understand what the code is doing and why it is working.

thanks for the post. some very handy tips there. Just want to mention. One issue i was having was the #include for my class was greyed out. In the tutorials example 'include' is in blue font. I don't mean the white background or anything. Would you be able to comment on this bit at all? I think u may have covered something about this but I just wanted to clarify my concern I was having.

Share this post


Link to post
Share on other sites

Yes, the very first line of my reply covered it.  The color of your #include has zero effect on what C++ does.  It's merely an IDE preference you can change.  Had you tried to compile, it may have been successful.  The UE4 team likely changed their color scheme to make it more readable on stream/video or just prefer their IDE that way.  The # indicates a preprocessor event.  If you type #define SOMETHING above the #include it will be the same color as the #include.  As it's the # that decides what color the IDE assigns to the following text (until the space).

Again, hit F7 and see what happens.  Do you get errors/warnings in the output window below about it?  If not, there is nothing to worry about, carry on learning.  Also learning "C++" from UE4 tutorials will not really teach you C++.  They have a lot of very specific and highly custom things they've coded up that do not exist in C++.  Just be forewarned you will likely have to unlearn things to program in C++ outside the Unreal engine.

Share this post


Link to post
Share on other sites
6 minutes ago, Mike2343 said:

Yes, the very first line of my reply covered it.  The color of your #include has zero effect on what C++ does.  It's merely an IDE preference you can change.  Had you tried to compile, it may have been successful.  The UE4 team likely changed their color scheme to make it more readable on stream/video or just prefer their IDE that way.  The # indicates a preprocessor event.  If you type #define SOMETHING above the #include it will be the same color as the #include.  As it's the # that decides what color the IDE assigns to the following text (until the space).

Again, hit F7 and see what happens.  Do you get errors/warnings in the output window below about it?  If not, there is nothing to worry about, carry on learning.  Also learning "C++" from UE4 tutorials will not really teach you C++.  They have a lot of very specific and highly custom things they've coded up that do not exist in C++.  Just be forewarned you will likely have to unlearn things to program in C++ outside the Unreal engine.

Thanks so much for your replies. They both read incredibly helpful. I will have to go over them properly later on when I'm in Unreal also. Much appreciated and thanks very much again for the reply. Most helpful.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By sergio2k18
      Hi all
      this is my first post on this forum.
      First of all i want to say you that i've searched many posts on this forum about this specific argument, without success, so i write another one....
      Im a beginner.
      I want use GPU geometry clipmaps algorithm to visualize virtual inifinte terrains. 
      I already tried to use vertex texture fetch with a single sampler2D with success.
       
      Readed many papers about the argument and all speak about the fact that EVERY level of a geometry clipmap, has its own texture. What means this exactly? i have to 
      upload on graphic card a sampler2DArray?
      With a single sampler2D is conceptually simple. Creating a vbo and ibo on cpu (the vbo contains only the positions on X-Z plane, not the heights)
      and upload on GPU the texture containing the elevations. In vertex shader i sample, for every vertex, the relative height to te uv coordinate.
      But i can't imagine how can i reproduce various 2d footprint for every level of the clipmap. The only way i can imagine is follow:
      Upload the finer texture on GPU (entire heightmap). Create on CPU, and for each level of clipmap, the 2D footprints of entire clipmap.
      So in CPU i create all clipmap levels in terms of X-Z plane. In vertex shader sampling these values is simple using vertex texture fetch.
      So, how can i to sample a sampler2DArray in vertex shader, instead of upload a sampler2D of entire clipmap?
       
       
      Sorry for my VERY bad english, i hope i have been clear.
       
    • By mangine
      Hello. I am developing a civ 6 clone set in space and I have a few issues. I am using Lua for the logic and UI of the game and c++ directx 12 for the graphics. I need a way to send information between Lua and c++ occasionally and was wondering what is the best and most flexible (and hopefully fast) way to do this. Don't forget that I also need to send things from c++ back to Lua. I know of a lua extension called "LuaBridge" on github but it is a little old and I am worried that it will not work with directx 12. Has anybody done something similar and knows a good method of sending data back and forth? I am aware that Lua is used more and more in the industry and surely plenty of AAA game programmers know the answer to this. I want a good solution that will hopefully still be viable code in a couple of years...
    • By owenjr
      Hi there.
      I'm pretty new to this and I don't know if it has been asked before, but here I go.
      I'm developing a game using SFML and C++.
      I would like to use the "Tiled" tool to load maps into my game but I don't actually find any tutorial or guide on how to exaclty use it (I know that I have to read an XML file and stuff). I just step into diverse projects that make all a mess. 
      Anyone knows where can I find good information to make my map loader by myself?
      Thanks in advantage!!
    • By MHG OstryTM
      Hello guys,
      I've released my game for the first time. I'm very excited about it and I hope you'll enjoy the game - Beer Ranger. It's a retro-like puzzle-platfromer which makes you think a lot or die trying. You have a squad of skilled dwarfs with special powers and your goal is tasty beer. There is a lot of traps as well as many solutions how to endure them - it is up to your choice how to complete the level! 
      Link to the project: Project site
      Link to the Steam site with video: Beer Ranger
      Have fun and please write feedback if you feel up to.
      Some screens: 




    • By cesarpachon
      hello, I am trying to implement a realistic simulation of a roulette wheel. it is not clear for me what is the proper way to simulate the initial status of the ball, when it spins against the edge of the wheel until it loss energy and start falling towards the centre.
      I modelled the conic table as a height map, as I assume that would provide the smoother surface. but I see anyway there is rough squared corners everywhere, so really I don't have a smooth inner wall to slide against.
      I wonder if I should ignore the wall and simulate the sliding by code. i.e: apply force (or impulse?) each frame to keep the ball at a fixed radius and somehow force it to follow a desired angular speed..  later, when I want to execute the falling behaviour, just stop applying that forces and let the simulator and the gravity do their work.. makes sense?
      any advice is highly appreciated!
       
  • Advertisement