Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3, 4, 5
Author Message
 Post subject: Re: C++ Progress ish
 Post Posted: June 17th, 2017, 3:14 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 332
Location: Idiot from northern Europe
Oh I saw that game on chilis update.
Looks dope! Well done


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: June 17th, 2017, 4:21 pm 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3233
Location: Japan
ceofil wrote:
What's the best way to aproch this kind of stuff? Try to do it on your own ( and probably spend a lot of time on it) or search and use a method that is already tested and it's more efficient and all?


Definitely search and research and find algorithms. Don't reinvent the wheel; it takes a lot of time and the results aren't gonna beat what humanity has already produced. You can learn some skills by implementing stuff like that from scratch, but researching and implementing existing algorithms is also a super important (probably more important) skill that needs to be exercised early and often. And also you wanna get shit done.

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: June 20th, 2017, 5:50 pm 
 

Joined: April 13th, 2017, 8:35 pm
Posts: 27
Where I'm at so far.
This is like a demo or something. Just added a bunch of enemies and some wall for a "playable" level.
I plan on adding a level editor like in the tanks game but now it will be saving and loading levels from files. Also change the AI to be a little more responsive for what's happening around. Probably change the graphics too.


Attachments:
File comment: wasd to move, left click to shoot, slow motion if you don't move, r to restart
super hotline miami.rar [2.34 MiB]
Downloaded 5 times
Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: June 24th, 2017, 5:23 pm 
 

Joined: April 13th, 2017, 8:35 pm
Posts: 27
Hi there!
Finished the level editor...kind of. Still have to figure out why when loading the level all the angles are set to 0. Also want to make it so you can load and save multiple levels and change the interface so it fits more levels.
There is already a level in there. load -> level editor -> implement to play it.

screenshot
github

Any feedback is appreciated.


Attachments:
super hot.rar [2.94 MiB]
Downloaded 1 time
Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: June 24th, 2017, 5:57 pm 
 

Joined: February 14th, 2017, 7:32 pm
Posts: 87
Just a quick question, how far into the tutorials are you? That seems like some advanced stuff, and I'd like to help you with this , so wanted to know if I could.


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: June 24th, 2017, 5:59 pm 
 

Joined: April 13th, 2017, 8:35 pm
Posts: 27
The last tutorial I've watched is Intermediate 4.


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: June 24th, 2017, 7:18 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2468
Location: Oklahoma, United States
Did you know?

instead of the slow length <= radius
Code:
   for (int i = 0; i < nOtherBullets; i++)
   {
      if (otherBullets[i].IsSpawned())
      {
         if (Vec2(otherBullets[i].GetPosition() - pos).GetLength() <= radius )
         {
            alive = false;
            otherBullets[i].Destroy();
         }
      }
   }


You can check for LengthSq <= radiusSq
Code:
   // Calculate square radius outside of loop to avoid recalculating each iteration.
   const auto radiusSq = radius * radius;
   for (int i = 0; i < nOtherBullets; i++)
   {
      if (otherBullets[i].IsSpawned())
      {
         if (Vec2(otherBullets[i].GetPosition() - pos).GetLengthSq() <= radiusSq )
         {
            alive = false;
            otherBullets[i].Destroy();
         }
      }
   }

This avoids having to do the square root each iteration of the loop.

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: June 24th, 2017, 7:26 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2468
Location: Oklahoma, United States
Instead of using hex codes for char keys, I would suggest using the literals; 'W', 'S', 'A', 'D'. The reason being it is way easier to tell at a glance those are the keys you are meant to push.

Code:
   if (kbd.KeyIsPressed('W'))
   {
      delta.y = -1.0f;
      movementHappened = true;
   }
   else if (kbd.KeyIsPressed('S'))
   {
      delta.y = 1.0f;
      movementHappened = true;
   }
   if (kbd.KeyIsPressed('A'))
   {
      delta.x = -1.0f;
      movementHappened = true;
   }
   else if (kbd.KeyIsPressed('D'))
   {
      delta.x = 1.0f;
      movementHappened = true;
   }


This way, you or anyone else won't have to look up char codes to know which letter/number/symbol you are trying to use. If I got the order wrong or incorrect keys here, it's because I didn't want to look the hex codes up.

I like the code layout, it's pretty clean, keep up the good work.

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3, 4, 5

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: