• 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.

Aiwendil

Members
  • Content count

    118
  • Joined

  • Last visited

Community Reputation

158 Neutral

About Aiwendil

  • Rank
    Member
  1. I thought & was the address and * was the value. Either way, I tried it and it didn't work. Thanks for trying to help though.
  2. Hi again, Sorry to be asking so many questions, but I have another problem. I'm trying to write a program that takes command line parameters and sorts them, then does various operations on them. Everything works fine except for the sorting. #include <stdio.h> #include <stdlib.h> float variance(char* data[], float average, int num); void swap(char *a, char *b); int main(int argc, char *argv[]) { int i; float total = 0; float mean = 0.0; printf("Data: "); for (i = 1; i < argc - 1; i++) { if (argv[i] > argv[i + 1]) { swap(&argv[i], &argv[i + 1]); } } for (i = 1; i < argc; i++) { printf("%s ", argv[i]); } printf("\nMaximum: %s\n", argv[argc - 1]); printf("Minimum: %s\n", argv[1]); for (i = 1; i < argc; i++) total += atoi(argv[i]); mean = total / (argc - 1); printf("Mean: %.2lf\n", mean); printf("Variance: %.2lf\n", variance(argv, mean, argc)); } float variance(char* data[], float average, int num) { float sum = 0.0; int i; for (i = 1; i < num; i++) { sum += (atoi(data[i]) - average) * (atoi(data[i]) - average); } return (sum / (num - 1)); } void swap(char *a, char *b) { char tmp = *a; *a = *b; *b = tmp; } I've also tried sorting inside main without using swap and a few other ways, but none of them really do anything. What am I doing wrong? Thanks
  3. Thanks, that fixed it.
  4. Thanks for the replies. So is that scanf("\n...", ...); or what?
  5. Hi again, I'm trying to get the user to enter a string in C by using fgets(), but my program keeps skipping over the input secion that uses fgets(). Can someone help me figure out why it's skipping? #include <stdio.h> int main(void) { char semester; char input = ' '; int year; char inputArray[50]; char* className; int lowGrades[4]; int numStudents = 0; int i, j; int student[50][3]; char *studentInitials[50]; printf("\t\tSEMESTER GRADE REPORT\n"); printf("\t\t-------- ----- ------\n\n"); printf("You will need the class identification, the initials of\n"); printf("and the three test scores for each student, and the low\n"); printf("cutoff score fo a grade of 'A', 'B', 'C', and 'D'.\n\n"); printf("When you have entered the scores for the last student,\n"); printf("press Return at the initials prompt.\n\n"); printf("Press Return when you are ready to proceed:\n\n"); printf("Fall or Spring semester? (F or S): "); scanf("\n%c", &semester); printf("Year: "); scanf("%d", &year); printf("\n"); printf("Which class: "); className = fgets(inputArray, 50, stdin); printf("\n"); for (i = 0; i < 4; i++) { if (i == 0) printf("Low score for an '%c' (out of 300) : ", i + 65); else printf("Low score for a '%c' (out of 300) : ", i + 65); scanf("%d", &lowGrades[i]); } for (i = 0; i < 4; i++) { printf("Student's initials: \n"); studentInitials[i] = fgets(inputArray, 50, stdin); printf("Scores:\n"); printf(" Test #1: "); scanf("%d", &student[numStudents][0]); printf(" Test #2: "); scanf("%d", &student[numStudents][1]); printf(" Test #3: "); scanf("%d", &student[numStudents][2]); printf("\n"); numStudents++; } return 0; } Also, is there a way to tell if only the enter key has been pressed? I want the user to be able to add students until they press only enter for student initials (I know the loop won't really work for that right now, and I'll change it later when I know how to get only enter as input). Thanks
  6. What are some games that are similar to Zelda but are targeted towards an older audience?
  7. Thanks for the reply. Quote:If it's for collision detection purposes, you don't need to store the corners. If the rectangle will always be axis-aligned, you can store the rectangle in min/max form or center/extents form. If the rectangle can be arbitrarily orientated, a standard representation is a center point, two (or three) basis vectors describing the orientation, and two (or three) extents, one for each basis vector. Can you give an example or provide a link to an example/tutorial (preferably with code)? I don't want to just copy the code, but I think it might make more sense if I can see the actual code for something like this along with the description.
  8. Quote:As a side note, applying incremental transforms to geometry over multiple updates is rarely the right approach. I'm not saying there are no circumstances where it's appropriate, but it's far more typical to store a local-space copy of the geometry and then transform it 'from scratch' as needed. Is that the same thing as instancing? I was making this so that I could use it for collisions. Would it be better to just store four points and use those to make the collision rectangle? For example: class Object { ... D3DXVECTOR2 mCollisionPoint[4]; }; Each point would be offset a certain distance from the object to match where it needs to be to make the collision work properly.
  9. Ok, here's my updated code (only the updates are shown, the rest is the same as above). void CustomRectangle::rotate(float degrees) { mRotation += degrees; D3DXVECTOR2 temp = mPos; mPos.x = 0.0f; mPos.y = 0.0f; updateCorners(); for (int i = 0; i < 4; i++) { mVertices[i].x = (mCornerPos[i].x * cosf(mRotation) - mCornerPos[i].y * sinf(mRotation)); mVertices[i].y = (mCornerPos[i].x * sinf(mRotation) + mCornerPos[i].y * cosf(mRotation)); } mPos.x += temp.x; mPos.y += temp.y; updateCorners(); } Now it moves to the origin, but doesn't move back. The other problems that I've found is that calling the move function doesn't move the rectangle, and when I create a rectangle with a rotation, it doesn't start with the rotation applied. void CustomRectangle::create(float x, float y, float width, float height, float rotation) { mPos = D3DXVECTOR2(x, y); mWidth = width; mHeight = height; rotate(rotation); mCornerPos[0] = D3DXVECTOR2(x, y); mCornerPos[1] = D3DXVECTOR2(x + width, y); mCornerPos[2] = D3DXVECTOR2(x + width, y + height); mCornerPos[3] = D3DXVECTOR2(x, y + height); for (int i = 0; i < 4; i++) mVertices[i] = mCornerPos[i]; } void CustomRectangle::create(const D3DXVECTOR2 &pos, float width, float height, float rotation) { mPos = pos; mWidth = width; mHeight = height; rotate(rotation); mCornerPos[0] = D3DXVECTOR2(pos.x, pos.y); mCornerPos[1] = D3DXVECTOR2(pos.x + width, pos.y); mCornerPos[2] = D3DXVECTOR2(pos.x + width, pos.y + height); mCornerPos[3] = D3DXVECTOR2(pos.x, pos.y + height); for (int i = 0; i < 4; i++) mVertices[i] = mCornerPos[i]; } Any ideas? I don't know why I'm having such a hard time with this, it seems like it shouldn't be this hard.
  10. I'm trying to create a custom rectangle class that allows the rectangle to rotate. I got it to rotate, but it's rotating around the origin, not its center. I've tried everything I can think of, but I'm not really good at the math involved. What do I need to do to get it to rotate around its center and not the origin? #include "CustomRectangle.h" #include "Colors.h" CustomRectangle::CustomRectangle() { mRotation = 0.0f; mCenter = D3DXVECTOR2(0.0f, 0.0f); mPos = D3DXVECTOR2(0.0f, 0.0f); mScaleX = 1.0f; mScaleY = 1.0f; } void CustomRectangle::create(float x, float y, float width, float height, float rotation) { mPos = D3DXVECTOR2(x, y); mWidth = width; mHeight = height; mRotation = rotation; mCornerPos[0] = D3DXVECTOR2(x, y); mCornerPos[1] = D3DXVECTOR2(x + width, y); mCornerPos[2] = D3DXVECTOR2(x + width, y + height); mCornerPos[3] = D3DXVECTOR2(x, y + height); for (int i = 0; i < 4; i++) mVertices[i] = mCornerPos[i]; } void CustomRectangle::create(const D3DXVECTOR2 &pos, float width, float height, float rotation) { mPos = pos; mWidth = width; mHeight = height; mRotation = rotation; mCornerPos[0] = D3DXVECTOR2(pos.x, pos.y); mCornerPos[1] = D3DXVECTOR2(pos.x + width, pos.y); mCornerPos[2] = D3DXVECTOR2(pos.x + width, pos.y + height); mCornerPos[3] = D3DXVECTOR2(pos.x, pos.y + height); for (int i = 0; i < 4; i++) mVertices[i] = mCornerPos[i]; } void CustomRectangle::rotate(float degrees) { mRotation += degrees; for (int i = 0; i < 4; i++) { mVertices[i] -= mCenter; mVertices[i].x = (mCornerPos[i].x * cosf(mRotation) - mCornerPos[i].y * sinf(mRotation)); mVertices[i].y = (mCornerPos[i].x * sinf(mRotation) + mCornerPos[i].y * cosf(mRotation)); mVertices[i] += mCenter; } } void CustomRectangle::draw(LPD3DXLINE line) { D3DXVECTOR2 rectPoints[5] = { D3DXVECTOR2(mVertices[0]), D3DXVECTOR2(mVertices[1]), D3DXVECTOR2(mVertices[2]), D3DXVECTOR2(mVertices[3]), D3DXVECTOR2(mVertices[0]) }; line->Draw(rectPoints, 5, GREEN(255)); } void CustomRectangle::updateCorners() { mCornerPos[0] = D3DXVECTOR2(mPos.x, mPos.y); mCornerPos[1] = D3DXVECTOR2(mPos.x + mWidth, mPos.y); mCornerPos[2] = D3DXVECTOR2(mPos.x + mWidth, mPos.y + mHeight); mCornerPos[3] = D3DXVECTOR2(mPos.x, mPos.y + mHeight); mCenter.x = (mCornerPos[0].x + mCornerPos[1].x) / 2; mCenter.y = (mCornerPos[0].y + mCornerPos[4].y) / 2; }
  11. While I was waiting for a response I kept working and I ended up using the division operator and got it to work. Thanks for the response though. I'll check out those links just to make sure I completely understand it.
  12. Hi everyone, I'm trying to learn C, and I'm working through a book and one of the exercises is to write a program that takes an integer and outputs it with a decimal before the last two digits. For example, 1523 would be 15.23. I can't seem to figure this out for some reason. I'm sure it's really easy, but I just can't see how to do it right now. How would you do this? Thanks
  13. Thanks for the recommendations, I'll look into those. Quote:Also, next time you ask for game recommendations, please list what platforms you have. I have a PC and Xbox 360. I denfinitely will include that info if there is a next time.
  14. I'm looking for some new games to play, and I'm looking for some that have good melee combat. I've been playing Dragon Age Origins recently, and it's ok, but I'd prefer something with more freedom in combat. With Dragon Age, the character really does all of the fighting, you just click once and the character practically does the rest. I'm looking for games where the character attacks with each button press (similar to the old Lord of the Rings games). Do you know of any? Thanks
  15. Hi everyone, Has anyone here read Windows Via C/C++? Is it any good? Thanks