Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 66 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
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: 481
Location: Idiot from northern Europe
Oh I saw that game on chilis update.
Looks dope! Well done

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


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: 3435
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: 38
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 13 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: 38
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 7 times
Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: June 24th, 2017, 5:57 pm 
User avatar

Joined: February 14th, 2017, 7:32 pm
Posts: 170
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: 38
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: 2762
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: 2762
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  
 Post subject: Re: C++ Progress ish
 Post Posted: July 1st, 2017, 5:01 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3435
Location: Japan
Yeah, definitely use the char literals when you can.

_________________
Chili


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

Joined: April 13th, 2017, 8:35 pm
Posts: 38
Well, well, well...
What happened in the past few weeks? Not that much...at least for me.

Changed the level selection menu in the super hotline miami game.
Edit: found these http://imgur.com/a/G8eJu

Watched the old B19 tutorial for loading sprites but then I watched a few more. Nothing much, just tryna make it work. Added a little something something. Functions to make a sprite black&whie, threshhold, invert...just for fun. Maybe I'll use them later when a character dies draw him black and white, or when it takes damage draw it with threshhold.

Spoiler:
Code:
   void Desaturate()
   {
      int newValue = ( GetR() + GetG() + GetB() ) / 3;
      *this = Color(newValue, newValue, newValue);
   }
   void ThreshHold(int value)
   {
      assert( value >= 0 && value <= 255 );
      int average = (GetR() + GetG() + GetB()) / 3;
      if ( average < value )
      {
         *this = Color(0,0,0);
      }
      else
      {
         *this = Color(255,255,255);
      }
   }
   void Invert()
   {
      int r = 255 - GetR();
      int g = 255 - GetG();
      int b = 255 - GetB();
      *this = Color( r,g,b );
   }
And then do that for every pixel in the surface except the key.

Then continued with the old series ( B19 - I6 ). Great stuff. I4 was a very good watch even tho I might not have understood everything, it gives a pretty good idea about how things works.
Made the chaos game. It's still a very simple version of it with hard coded numbers and the points can't be moved.
Spoiler:
Image

Homework for current I6.

Good times, good times.


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

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:
cron