• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
dynamiteandy

Helping fix a few things.

3 posts in this topic

Hey,

So I'm developing a game called PongBreakout in c++ using a game engine i got from uni (when i was there..)
I've got a few problems with my game that i'm struggling to fix and need some help to figure out how to do so.

the first bug is that the countdown is far to fast and i dont know how to slow it down - ive been told to use a scalar (not a clue what that is..) <- ball.cpp (Update())
the second bug is that the ball sometimes gets stuck at the side of the screen if the paddle is there (play it and you'll eventually notice it.) <- ball.ccp (ProcessCollisons())
the third bug is that the rand() function doesnt seem to be working for getting a value between 8 and 5. <- ball.cpp
And lastly the cpu paddle is very buggy movement wise, is there anyway to make it move a bit better instead of always juttering.. <- enemyboard.cpp

To run this game you need direct x aug 2009.

https://www.dropbox.com/sh/yykud3daabght8y/aejKK5bXFZ

http://www.microsoft.com/en-us/download/details.aspx?id=23549


Everything required is on on my dropbox.
0

Share this post


Link to post
Share on other sites

A scalar is a single value, like "2" or ".01".  They usually...scale things.  Scalar is often used in the same concept space as "vector" and the difference there is that a vector has its multiple fields (x, y, and z value, for example) while a scalar is just a solitary value. 

You can multiply two scalars together,

2 * .4 = .8

and multiply a vector by a scalar,

(1,1,0) * 2 = (2,2,0)

but you can't multiply two vectors together (what does that even mean, anyway?).  Vectors have specific operations like dot- and cross-products.  Though you CAN add and subtract them, if they're the same dimension.

 

TL;DR: someone has told you to use a scalar to reduce the countdown speed, so you probably want to find the spot in your code that's counting down, determine what numerical value it's using as the check (I hope it's time-based and not frames-based, as the latter will run at different speeds on different PCs), and then multiply that by some number (either increasing it or decreasing it) to reach the desired countdown speed.

 

I can't check the other bugs thanks to corporate firewall disliking dropbox.

0

Share this post


Link to post
Share on other sites

the second bug is that the ball sometimes gets stuck at the side of the screen if the paddle is there (play it and you'll eventually notice it.) <- ball.ccp (ProcessCollisons())

 

My guess for #2 is, if the paddle is moved to intersect the ball while the ball is in the middle of the paddle, the X-velocity isn;'t large enough so that, on the next frame, it can't move outside the boundary of the paddle, so the x-velocty values just toggles between +X and -X each frame.  I would ensure the ball is moved to the edge of the paddles boundary before negating the X velocity.

 

the third bug is that the rand() function doesnt seem to be working for getting a value between 8 and 5. <- ball.cpp

The line:

case 1: velocity.set((rand()%(8-5)+5),-rand() % 5 + 1); // Rand is broken. Why?

Will set X between 5 and 7, since rand()%(8-5) will return 0, 1, or 2, and adding it to 5 will give 5, 6, or 7.

Is that what you are seeing?  You need to make it rand()%4 + 5 if you want a random value from 5 to 8.

 

And lastly the cpu paddle is very buggy movement wise, is there anyway to make it move a bit better instead of always juttering.. <- enemyboard.cpp

 

If the Y-velocity of the ball is less than half the Y speed of the enemy paddle (ie, enemy paddle is 5, and Y velocity is 2), then the paddle will jump back and forth according to your code.  Imagine PaddleY is 100, and BallY is 99.  You will move the PaddleY = 95 the next frame, and the BallY = 97.  Now you will move the PaddleY back up to 100 since PaddleY < BallY.

 

You could, instead of always moving the enemy paddle the maximum speed, simple move it the the Y difference if it is smaller than the maximum speed.  Change this:

// Change this...
 
else if (position.YValue > BallPos.YValue)
        {
            position.YValue = position.YValue - speed;
 
        }
// To This...
 
else if (position.YValue > BallPos.YValue)
        {
            position.YValue = position.YValue - MIN(speed, position.YValue - BallPos.YValue);
        }
 
//Where MIN returns the minimum of the 2 values.
0

Share this post


Link to post
Share on other sites

the third bug is that the rand() function doesnt seem to be working for getting a value between 8 and 5. <- ball.cpp

The line:

 

case 1: velocity.set((rand()%(8-5)+5),-rand() % 5 + 1); // Rand is broken. Why?

Will set X between 5 and 7, since rand()%(8-5) will return 0, 1, or 2, and adding it to 5 will give 5, 6, or 7.

Is that what you are seeing?  You need to make it rand()%4 + 5 if you want a random value from 5 to 8.

 

What was actually happening is that it was still somehow being set between 3 - 8 and i wasnt sure why.

 

I'll be sure to try get these fixes into place tomorrow morning,.

 

EDIT: rand is still returning values less than the minimum value.

Edited by Dynamite Andy
0

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
Sign in to follow this  
Followers 0