Jump to content

  • Log In with Google      Sign In   
  • Create Account


jellyfishchris

Member Since 19 Apr 2012
Offline Last Active Nov 23 2013 12:46 AM
-----

#5062202 My First Text Based RPG help

Posted by jellyfishchris on 15 May 2013 - 10:55 PM

For those of us that cant read code formatted like that:

http://codebin.org/view/94bf6d09

 

Ok I am confused what you actually what the program to do so I am just going to stab in the dark.

 

while (eHealth > 0)
{
	eHealth - attack;

	if (eHealth <= 0)
	{
		cout<< "You have killed the goblin."<< endl;
		cout<< endl;
		++stats;
		break;
	}
}

In your loop you are doing eHealth - attack.

 

So lets think about this, your doing the golbins health minus attack which is 1. Now you never store the 1 and it is just forgotten about. Now ehealth is greater than 0 because its still 8 because it is never saved. Now the program will go into an infinite loop.

 

However lets fix this and do eHealth = eHealth - attack;

First loop:

  eHealth = 1;

  do if statement = no

Second loop:

  eHealth = -6;

  do if statement = yes

    output "You killed the goblin \n"

    add one to stats;

    break while loop;

 

Additionally stats was never assigned so you will get a runtime failure, so if you change it to int stats = 0;

 

Ok your next question is going to be it comes up with but it also printed "You have died" this is becuase you have forgotten to add a break statement for the case of attacking the goblin. So it will execute case1 which you kill the goblin, it never finds a break to break the case so it does case2 also then case2 finds a break and finishs.

 

Hope this is enough information and good luck!




#5061450 calculator app

Posted by jellyfishchris on 13 May 2013 - 01:01 AM

Here is something to think about. What if I enter in:

7 + (6 × 52 + 3)

 

http://www.mathsisfun.com/operation-order-bodmas.html




#5056237 Starting without wanting to find a job

Posted by jellyfishchris on 23 April 2013 - 07:47 PM

But how's your knowledge of Lagrangian mechanics? Poisson distributions? Standard deviation? The rules of integration and differentiation? Pipelined architectures? Data structures? Computational efficiency? BN notation? Colour theory? The physics behind lenses? Mutexs? Locks? Lock-free code? SIMD? Solutions to sparse matrices? Can you dervie the equations to convert a quaternion to a matrix from scratch?

 

Half of that stuff, having a double major myself I dont even know. And dont see the point in knowing either.

 

In response to the actual post. I know how you feel, just stay in school and write code in your spare time.




#5054794 Starting a FPS game ideas on where to begin?

Posted by jellyfishchris on 18 April 2013 - 10:07 PM

You have to understand building a game is very complex process and you have to have understanding of alot of theories before you just dive into this sort of thing. I like this example of what you are trying to do: Its like trying to write a book without knowing how to spell. So if you want to use this example of writing a book before being able to even read. Ill write it as if this was a guide to a preschool student wanting to write a book.

1) Learn to say a few words such as "Mum"
2) Learn to say a few sentences "I want food", "Im hungry"
3) Learn your ABC
4) Learn a few spellings such as "Cat" and "Dog"
5) Learn to write a few sentences. "The cat sat on the mat."
6) Learn more complex sentences and structures. "There once was a princess, her name was Anna"
7) Create your very first book. It will be very short and not very good
8) Back to learning complex theories for many years
9) Now your at a point to write any book etc.

Ok now that thats done lets translate that back to making a 3d game without knowing how to program.

1) Choose a language
2) Write your very first "Hello World!" program
3) Write a very basic program that has methods! Example a program that once you give it $10 for an item that is $5.45 it tells you how many of each coin you need back in change.
4) Learn how programming concepts such as polymorpism, classes, etc.
5) Write a very simple ASCII game. Example a game where there is a grid of 0's and 1's. A P represents you, M represents a monster, F represents the finish line. You must get to the finish line while the monsters just choose a random number and move in that directions.
6) On to learn about data structures and algorithsm! Learn things such as vectors, binary trees, link lists, FSM etc etc.
7) Ok now we can start with a 2d game! Make mario/pacman or something very basic and similar.
8) Back to learning more structures and some game specific algorithms and demo projects practising your 3d. Example make a world where you can fire a cannon into objects. (In 3d)
9) You can write your FPS or any type of game you feel like.

Please bear in mind this is what you must do if you want to make a good game or what to have a career in this industry. If you want a terrible game and just want to skip half of the lessons then you wont understand and wont be able to do alot of things. If you want that skip points 5,6,7,8.

 
 




#5051716 class problems

Posted by jellyfishchris on 09 April 2013 - 09:46 PM

JEngine.cpp
 

#include "JEngine.h"
#include "stdafx.h"
 

 

Should be

 

JEngine.cpp
 

 

#include "stdafx.h"
#include "JEngine.h"





 


 


 




#5045419 Critique/tips on first breakout attempt?

Posted by jellyfishchris on 21 March 2013 - 05:35 PM

Have you looked at what happens if you try to hit a block from on top of it?
If you look at

 

ball.setDy(-ball.getDy()); 

 

 

You should consider using vectors to represent the balls velocity.




#5040154 Is my design "bad"?

Posted by jellyfishchris on 06 March 2013 - 04:07 PM

First question...

Why are you using maps the way you are?

 

 std::map 
<std::string,SHIPCLASS> 
ShipClass;    std::map<int,RACE> 
Race;    std::map<int,PROV> 
Prov;    std::map<int,PLANET> 
Planet;    std::map<std::string,MAPCELL> 
MapCell;    std::map<int,UNIT> 
Unit;    std::map<int,FLEET> 
Fleet;
 

 

You are linking an int to a object for example of type race. Surely this should be a vector instead.

Ok here a few things you should consider before starting to code everything into the same class.

As youve stated there can be many rules etc so you need to think about away that the system will be able to extended apon. Below are a few links of design patterns you should most likely use to help make your job easier. Once you have finished reading all of those and understand them, and maybe implement them. Maybe you should have a better idea on how you want to design your system.

 

 

Good luck!

 

http://en.wikipedia.org/wiki/Strategy_pattern

http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

http://en.wikipedia.org/wiki/Factory_method_pattern




#5037008 Late night coding

Posted by jellyfishchris on 26 February 2013 - 11:14 PM

While finishing off a uni assignment with 4 other programmers at around 3am in the night, you start to write some sloppy code. We didn't notice until we decided to review the code after submitting... For the record we already check if the program worked, which it did.

 

Here is an example of what we found a few days later (snippet taken from a FishController class)....

 

        if (dt == 0.0f)
        {
            dt = 0.0f;
        }
        else
        {
            dt = diff.total_milliseconds();
            dt /= 100.0f;
        }
 

 

 




#5031651 Initializing a variable

Posted by jellyfishchris on 12 February 2013 - 07:21 PM

Your doing an int / int division this returns a int results and then your passing it to a double so...

 

5 / 2 = 2.5

2.5 - Convert to an int 2.

Convert 2 to a double 2.0

 

So an easy fix would be to do....

 

 

double score4 = (score1 + score2 + score3)/ 3.0;
 



PARTNERS