Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Phil123

Member Since 08 Jul 2012
Offline Last Active Yesterday, 11:37 PM

#5171543 multiple source files and global varaibles.......................

Posted by Phil123 on 04 August 2014 - 08:31 PM


Anyways you're right I do have a lot of constants.

 

Yes, and I've tried the whole "keep the constants in one file thing" before a long time ago and I was not a fan of the results.

 


I was planning to shrink my code using something call enum but this option seems efficient too

 

I'd encourage you to try any method that you come up with.  Simply taking someone's word for something is not nearly as effective of a learning experience as trying something yourself and deciding that it isn't efficient.




#5162092 Learning Game engine or Programming first

Posted by Phil123 on 22 June 2014 - 07:58 AM


Will understanding the code, identifying problems ,google searching, learning and amending the issues be enough to get started off?

 

A great way to learn is to run into problems and solve them so I would suggest to start making prototypes until you're comfortable (if you just thought of a prototype, then think even smaller - trust me).  Though if you run into a lot of "I don't know how to do this in C#, or I don't know how that works in C#" then you may want to take a step back and just focus on C# console programming until you're more comfortable with it so it doesn't effect your game development workflow.

 

Get started as soon as you can, but don't burn yourself out.  This is a long process.




#5162076 Learning Game engine or Programming first

Posted by Phil123 on 22 June 2014 - 07:06 AM


do i really need to know how to WRITE code ? or just clearly understand what exactly the code is saying ?

 

If you're interested in becoming a game programmer then yes, you'll want to learn how to write code as it'll increase your available tool set and it'll drastically help your workflow.

 

If you don't plan on spending a lot of time on this, then I would say go ahead and just focus on Unity and C# scripting, or Unreal 4 and their visual Blueprint system (or [insert game engine of choice here]).  I would definitely not recommend a beginner jumping into UE4 C++ because they're doing some interesting things with their build tool that you normally wouldn't see in a stand alone C++ program and it'd only confuse the hell out of someone who's trying to learn C++; However, you can get extremely far with just their Blueprint system.

 

 


but if i think of trying to write the whole code myself ... i just cant remember it...

 

Indeed.  It will take time.  With more practice, you'll learn to solve problems you encounter without needing to memorize specific solutions.  Unity has been around for long enough that you can search "How do I do [X] in Unity?" in google and you'll likely find someone else who encountered the exact same problem and someone else who provided a solution for said person.




#5138471 Industrial Strength Hash Table

Posted by Phil123 on 12 March 2014 - 12:26 PM

I've been enjoying the coding horrors forum for a while, so I decided to post a snippet of code that I found in a large c++ project that I'm (unfortunately) a part of.  Normally I wouldn't poke fun at code like this, but I couldn't resist this one.

 

Enjoy.

#pragma once

#include "Includes.h"



template<class T>

class Dictionary

{

private:

    std::vector<std::string> keys;

    std::vector<T> values;

public:

    Dictionary()

    {

        keys = new std::vector<std::string>{};

        values = new std::vector<T>{};

    }



    ~Dictionary()

    {

        delete[] keys;

        delete[] values;

    };



    std::vector* Values() { return &values; };

    std::vector* Keys() { return &keys; };



    size_t size() { return keys.size(); }



    void Add(std::string _key, T value)

    {

        keys.push_back(_key);

        values.push_back(value);

    };

    void Remove(std::string _key)

    {

        for (size_t i = 0; i < keys.size(); i++)

        {

            if (keys.at(i) == _key)

            {

                keys.erase(keys.begin() + i);

                values.erase(values.begin() + i);

                break;

            }

        }

    };

    T Get(std::string _key)

    {

        for (size_t i = 0; i < keys.size(); i++)

        {

            if (keys.at(i) == _key)

            {

                return values.at(i);

            }

        }

        return nullptr;

    };

};




#5106382 Coding horror experiment in C++

Posted by Phil123 on 01 November 2013 - 10:17 PM

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <vector>
#include <cmath>
#include <iostream>

struct ImageData
{
    unsigned int width;
    unsigned int height;
    unsigned char pixel_data[32 * 32 * 4 + 1];
};

struct Ghost
{
    sf::Vector2f position;
    sf::Vector2f oldPosition;
    sf::Vector2f forces;
    float radius;
    float invmass;
    int m_GoodAmnt;
    sf::Sprite sprite;
};

extern const ImageData imageData;
#define PLAYER_GHOST 0
#define GHOST_GOOD 1
#define CONVERSION_DISTANCE 80.0f
#define GOOD_MINIMUM 100
#define GOOD_MAXIMUM 255
#define BAD_CONVERSION_RATE 3
#define GOOD_CONVERSION_RATE 1
#define GOOD_CONVERSION_RATE 2

static sf::Vector2u mousePosition;

#define MASS 2 * 1e-2

float randomFloat()
{
    return std::rand()/(float)RAND_MAX; //get out of here swiftcoder!
    return 4.0f;//std::rand() / static_cast<float>(RAND_MAX);
}

sf::Vector2f randomVector(sf::Vector2u bounds)
{
    return sf::Vector2f(randomFloat() * bounds.x, randomFloat() * bounds.y);
}

//return random vector between min/max....although since randomFloat returns 4, more like min+max*4....
sf::Vector2f randomVector(sf::Vector2f min, sf::Vector2f max){
    sf::Vector2f Vec = min+(max-min);
    return sf::Vector2f(Vec.x*randomFloat(), Vec.y*randomFloat());
}

//returns good ghost counter.
unsigned int ghostAdvance(std::vector <Ghost> &vec, sf::Vector2u screenSize){
    unsigned int GoodGhosts = 0;
    // gravity well test (it is a feature)
    for (size_t i = 0; i < vec.size(); ++i)
    {
        goto LABELE;
        if (i == PLAYER_GHOST) continue; // if you remove this a ghost will die
LABELE:
        if(vec[i].m_GoodAmnt<GOOD_MINIMUM) continue;
        Ghost *p = &(vec[i]);

        sf::Vector2f r = p->position - sf::Vector2f(mousePosition.x, mousePosition.y);
        r.x = r.x / screenSize.x;
        r.y = r.y / screenSize.y;

        double len2 = pow(r.x, 2) + pow(r.y, 2);
        r = sf::Vector2f(r.x / sqrt(len2), r.y / sqrt(len2));

        const float MIN = 0.02;
        if (len2 < MIN) len2 = MIN;

        double ax = r.x * (+1) * MASS / len2; // physics
        double ay = r.y * (+1) * MASS / len2;

        p->forces = sf::Vector2f(ax, ay);
        GoodGhosts++;
    }

    for(size_t i=0;i<vec.size();i++){
        Ghost *p = &(vec[i]);
        //Verlet integration
        sf::Vector2f oldPos = p->position;
        p->position += p->position - (p->oldPosition + (p->forces * 0.5f));
        p->oldPosition = oldPos;

        //Wall collision detection
        double overY = 0;
        if(p->position.y > screenSize.y-p->radius)
            overY = (screenSize.y-p->radius) - p->position.y;
        if(p->position.y < p->radius)
            overY = (p->radius) - p->position.y;        
        if(p->position.x < p->radius){
            p->oldPosition.x = p->position.x;            
            p->position.x = p->radius;
        }
        if(p->position.x > screenSize.x-p->radius){
            p->oldPosition.x = p->position.x;            
            p->position.x = screenSize.x-p->radius;
        }            

        //Friction with floor
        if(overY != 0){
            p->oldPosition.y = p->position.y;            
            p->position.y += overY;
            double xVel = p->position.x - p->oldPosition.x;
            if(xVel != 0)
                p->position.x -= (xVel * 0.1);
        }
    }
    //Ghost-Ghost collision detection
    for(size_t i=0;i<vec.size();i++){
        //fixed j to i+1
        for(size_t j=i+1;j<vec.size();j++){
            Ghost *pi = &(vec[i]);
            Ghost *pj = &(vec[j]);

            float dx = pj->position.x-pi->position.x;
            float dy = pj->position.y-pi->position.y;
            float a = dx*dx+dy*dy;
            float l = (pi->radius + pj->radius);
            //do conversion if within distance.
            if(a<=CONVERSION_DISTANCE*CONVERSION_DISTANCE){
                int BadRate = GoodGhosts>3?BAD_CONVERSION_RATE:0;
                if((vec[i].m_GoodAmnt>=GOOD_MINIMUM && vec[j].m_GoodAmnt<GOOD_MINIMUM)){ //i is good, j is bad
                    vec[i].m_GoodAmnt -= BadRate * vec[j].sprite.getScale().x;
                    vec[j].m_GoodAmnt += GOOD_CONVERSION_RATE * vec[i].sprite.getScale().x;
                }else if(vec[i].m_GoodAmnt<GOOD_MINIMUM && vec[j].m_GoodAmnt>=GOOD_MINIMUM){
                    vec[i].m_GoodAmnt += GOOD_CONVERSION_RATE * vec[j].sprite.getScale().x;
                    vec[j].m_GoodAmnt -= BadRate * vec[i].sprite.getScale().x;
                }else if(vec[i].m_GoodAmnt<GOOD_MINIMUM){ //both i and j are bad.
                    vec[i].m_GoodAmnt -= BAD_CONVERSION_RATE * vec[j].sprite.getScale().x;
                    vec[j].m_GoodAmnt -= BAD_CONVERSION_RATE * vec[i].sprite.getScale().x;
                }else{ //both are good.
                    vec[i].m_GoodAmnt += GOOD_CONVERSION_RATE * vec[j].sprite.getScale().x;
                    vec[j].m_GoodAmnt += GOOD_CONVERSION_RATE * vec[i].sprite.getScale().x;
                }
                vec[i].m_GoodAmnt = vec[i].m_GoodAmnt<0?0:vec[i].m_GoodAmnt>GOOD_MAXIMUM?GOOD_MAXIMUM:vec[i].m_GoodAmnt;
                vec[j].m_GoodAmnt = vec[j].m_GoodAmnt<0?0:vec[j].m_GoodAmnt>GOOD_MAXIMUM?GOOD_MAXIMUM:vec[j].m_GoodAmnt;
            }
            if(a <= l*l ){
                bool massfix=false;
                if(pi->invmass == 0 && pj->invmass == 0){
                    massfix = true;
                    pi->invmass = pj->invmass = 1;
                }
                if(a==0) continue;
                float dist = sqrt(a);
                float difference = (dist - l) / (dist*(pi->invmass+pj->invmass));    

                pi->position.x += pi->invmass * dx * difference * 0.5;
                pi->position.y += pi->invmass * dy * difference * 0.5;
                pj->position.x -= pj->invmass * dx * difference * 0.5;
                pj->position.y -= pj->invmass * dy * difference * 0.5;

                if(massfix){
                    pi->invmass = pj->invmass = 0;
                }
                goto LABELF;
                if(i==PLAYER_GHOST){
                    //ghost hit player!
                    vec.erase(vec.begin()+j--);
                    continue;
                }
                LABELF:;
            }
        }

        // convert to bigger "good" ghost
        for(size_t i=0;i<vec.size();i++){
            for(size_t j=i+1;j<vec.size();j++){
                if (vec[i].m_GoodAmnt == GOOD_MAXIMUM && vec[i].m_GoodAmnt == GOOD_MAXIMUM && GoodGhosts > 4)
                {
                    if (vec[i].sprite.getScale().x >= 3.0f) break;

                    float distanceBetweenX = vec[i].position.x - vec[j].position.x;
                    float distanceBetweenY = vec[i].position.y - vec[j].position.y;

                    if (distanceBetweenX + distanceBetweenY < 50.0f)
                    {
                        vec[i].sprite.setScale(vec[i].sprite.getScale().x + (vec[j].sprite.getScale().x - 1.0f) + 0.5f, vec[i].sprite.getScale().y + (vec[j].sprite.getScale().y - 1.0f) + 0.5f);
                        vec[i].radius += 0.5f;
                        vec[j] = vec[vec.size() - 1];
                        vec.pop_back();
                        GoodGhosts--;
                        break;
                    }
                }
            }
        }

    }
    return GoodGhosts;
}

int ghostAdd(std::vector <Ghost> &vec, sf::Vector2f position, sf::Vector2f velocity, sf::Texture &textureBall, int GoodAmnt){
    Ghost gh;
    gh.position = position;
    gh.oldPosition = position-velocity;
    gh.forces = sf::Vector2f(0, -0.001);
    gh.invmass = 1;
    gh.radius = 16;
    gh.m_GoodAmnt = GoodAmnt;
    gh.sprite.setTexture(textureBall);    
    gh.sprite.setColor(sf::Color((int)position.x%256,(int)position.y%256,rand()%256,200));

    vec.push_back(gh);
    return vec.size()-1; //return index of ghost.
}

// forward declaration
void loop(sf::RenderWindow &screen, sf::Vector2f &position, sf::Vector2f &Velocity, sf::Image &image, sf::Sprite &sprite,
    sf::Texture &texture, std::vector<Ghost> &ghosts);

int main()
{
    std::srand(static_cast<unsigned>(std::time(0)));
    sf::RenderWindow screen(sf::VideoMode(800, 600, 32), "Ghost Horror Code");
    screen.setFramerateLimit(60);

    sf::Image image, imageBall;
    image.create(imageData.width, imageData.height, imageData.pixel_data);

    sf::Texture texture;
    texture.loadFromImage(image);
    sf::Sprite sprite;
    sf::Vector2f position = randomVector(screen.getSize() - image.getSize());
    sf::Vector2f Velocity = randomVector(sf::Vector2f(-1.0f, -1.0f), sf::Vector2f(1.0f, 1.0f));
    goto LABELA;
    sprite.setTexture(texture);
    sprite.setPosition(position);
LABELA:
    std::vector<Ghost> ghosts;
    //spawn inital 3 ghosts.
    for(int i=0;i<3;i++) ghostAdd(ghosts, sf::Vector2f(screen.getSize().x*0.5f-20.0f+i*20.0f, screen.getSize().y*0.5f), sf::Vector2f(0.0f, 0.0f), texture, GOOD_MAXIMUM);
    
    loop(screen, position, Velocity, image, sprite, texture, ghosts);
}

void loop(sf::RenderWindow &screen, sf::Vector2f &position, sf::Vector2f &Velocity, sf::Image &image, sf::Sprite &sprite,
    sf::Texture &texture, std::vector<Ghost> &ghosts) {

        bool running = true;
        mousePosition = sf::Vector2u(screen.getSize().x/2, screen.getSize().y/2);
        while (running)
        {
            sf::Event event;
            while (screen.pollEvent(event))
            {
                if (event.type == sf::Event::Closed)
                {
                    running = false;
                }

                if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape))
                {
                    running = false;
                }
                if (event.type == sf::Event::MouseMoved)
                {
                    mousePosition = sf::Vector2u(event.mouseMove.x, event.mouseMove.y);
                }
            }
            goto LABELB;
            position+=Velocity;
            if(position.x<0.0f){
                position.x = 0.0f;
                Velocity.x = -Velocity.x;
            }else if(position.x>=(float)(screen.getSize().x-image.getSize().x)){
                position.x = (float)(screen.getSize().x-image.getSize().x);
                Velocity.x = -Velocity.x;
            }
            if(position.y<0.0f){
                position.y = 0.0f;
                Velocity.y = -Velocity.y;
            }else if(position.y>=(float)(screen.getSize().y-image.getSize().y)){
                position.y = (float)(screen.getSize().y-image.getSize().y);
                Velocity.y = -Velocity.y;
            }
            sprite.setPosition(position);  //Good bye old crap.
LABELB:
            ghostAdvance(ghosts, screen.getSize());

            screen.clear();
            goto LABELC;
            screen.draw(sprite);
LABELC:
            for(size_t i=0;i<ghosts.size();i++){
                double rad = ghosts[i].radius;
                ghosts[i].sprite.setPosition(ghosts[i].position-sf::Vector2f(rad, rad));
                ghosts[i].sprite.setColor(sf::Color(GOOD_MAXIMUM-ghosts[i].m_GoodAmnt, 0, ghosts[i].m_GoodAmnt, 200));
                screen.draw(ghosts[i].sprite);
            }

            if(rand()%50 == 0 || rand() % 60 >= 57) //decresed rate of spawning.
                ghostAdd(ghosts, randomVector(sf::Vector2f(0.0f, 0.0f), (sf::Vector2f)screen.getSize()),
                sf::Vector2f(rand()%20-10, rand()%20-10), texture, 0);


            screen.display();
        }

        if (running) {
            loop(screen, position, Velocity, image, sprite, texture, ghosts);
        }
}

const ImageData imageData =
{
    32,
    32,
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
    "\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
    "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0"
    "\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0"
    "\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0"
    "\0\377\0\224\377\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377"
    "\0\0\0\377\0\224\377\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0"
    "\0\0\377\0\224\377\377\0\224\377\377\0\224\377\377\0\0\0\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\0\0\0\377\0\224\377\377\0\224\377\377\0\224\377\377\0\0\0\377"
    "\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\0\0\0\377\0\0\0\377\0\224\377\377\0\224\377\377\0\224\377"
    "\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\0\0\0\377\0\224\377\377\0\224\377\377"
    "\0\224\377\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\224\377\377"
    "\0\224\377\377\0\224\377\377\0\0\0\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0"
    "\224\377\377\0\224\377\377\0\224\377\377\0\0\0\377\0\0\0\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\0\0\0\377\0\224\377\377\0\224\377\377\0\224\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\0\224\377\377\0\224\377"
    "\377\0\224\377\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0"
    "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
    "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377"
    "\377\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
    "\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
    "\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0"
    "\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0"
    "\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0"
    "\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0"
    "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\377\377"
    "\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377"
    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
    "\377\377\0\0\0\377",
};

Version 10: Merge allied ghosts together by having a bunch of ghosts!  They're much stronger but can still be easily converted.

Edit: I never thought something like this would be my first open source contribution.  Haha...

 




#5101539 New to working on a team

Posted by Phil123 on 15 October 2013 - 08:04 AM

I guess I would ask yourself these questions:

1) How am I handling input/music/sound?

2) How am I handling scene management?

3) How am I passing data from one class to another?

4) What data structures should I use?

5) Since it's a team project, what coding style will the team adhere to?

6) Do we want to use tortoise svn, github, or some other code repository?

 

I feel as if before you start programming you should at least know what classes are going to be required for your game and their relationships to other classes.  Granted, you may cut a few out or add a few new ones during the development process but you need at least a basic idea, and if you don't have that, then you should go back to the drawing board and figure out what will be in your game.

 

If you don't know what level they're at in terms of programming, then list off what needs to be done (this goes back to the whole design thing) and ask what people feel comfortable doing.  If one guy can only do input (for example) then you could easily task him out to make the best damn input API ever.




#5091177 [Resolved] Something is wrong with my collision detection.

Posted by Phil123 on 02 September 2013 - 08:10 PM

if(bottomA <= topB)
{
    return 0;
}

if(topA >= bottomB)
{
    return 0;
}

if(rightA <= leftB)
{
    return 0;
}

if(leftA >= rightB)
{
    return 0;
}

//If none of the sides from A are outside B
return 1;

Edit: Hmm, interesting way of doing it.

 

How about this?

if(check_collision_rect(player.pos, tile))

That should be tile[i], should it not?




#5056393 What should a games programmer know?

Posted by Phil123 on 24 April 2013 - 10:11 AM

Also, XNA is no longer supported by Microsoft, so should I just familiarize myself with Unity3D since it also supports C#?

 

Regardless of whether or not XNA is supported by Microsoft, XNA is still a great learning tool if you know C# but have never really made a game.  The programming practice and skills you develop through the use of XNA/MonoGame/whatever will always transfer over, as programming (in its simplest form) is just problem solving.

 

Also, Unity3D is great, but if you haven't ever made a game, then perhaps you should start off with a simple 2D game in XNA/MonoGame (side note: yes, I understand you can make 2D games in Unity).




#4960986 Inventory System

Posted by Phil123 on 19 July 2012 - 10:03 AM

Thanks for the posts guys.

How about something like this(just a rough and simple outline):

Forgot about consumables when writing that, left some blanks as well, but I think this can get you going.


Hmm yeah, that helps a lot, thanks!

Anyway, I hope I helped at least get the creative juices flowing. Also, I'd love to hear what your ideas are at this point. You may not have an answer yet, but you must have the beginnings of what your inventory will look like.

Happy coding


Definitely, I didn't expect such quick responses - my plan was to establish some ideas in my head as to how I wanted to approach it and then really crack down on it this upcoming Weekend (Friday to Sunday) as I won't have much time to devote to it before then.

Really appreciate it guys, be sure to check this thread Sunday when I'm done Posted Image


#4957485 How to not become overwhelmed....

Posted by Phil123 on 09 July 2012 - 08:46 PM

But can anyone help with their experience of how they moved forward. An actual proper account of what they did to end up where they are.


When I first started studying C++, I thought it'd be a good idea to purchase some "Game Tutorials" where it teaches you how to program from the basics up, but it's more game-focused. (Starts out with "Hello world." then moves on to text-based RPGs, RPG map editors, etc). Anyways, long story short, after getting to the tutorial for the first Text-Based RPG in the tutorials and barely understanding what the hell I was doing, I started working through Stephen Prata's C++ Primer Plus book.

Fast forward 4-5 months later without even thinking about programming games, and I'm designing and programming my own text-based RPG. It's currently over 1100 lines of code, has minimal player content (just started working on it last week, cut me some slack Posted Image ), but the greatest feeling in the world is when you're implementing new things into a program, and you click "Compile" and get 0 errors, and it's completely bug free. Seriously, it's like magic - it's like "okay, I want this in my program. /code it, and it works." It's an extremely powerful feeling when you know your hard work and studying has paid off.

I understand everything I'm doing, everything I'm implementing, I think logically before hand as to how I introduce something before I start coding (fail to plan == plan to fail), and how it may affect something else in my program. I'm always looking for new ways to improve my code, whether that's through a new function, or something I learned today (class inheritance), so the learning process just doesn't stop for me.

Am I a brilliant programmer? Definitely not, I'm probably your average computer joe (well, by my standards anyway). Am I a professional programmer? Not yet. Does this mean I won't continue to spend months upon months mastering the craft?

Hell no, I will not stop until I have mastered this language, as well as many others.

Edit: No idea what happened, somehow half of my message was cut off. Fixed though ^^


#4957312 Weekly Discussion on RPG Genre's flaws [Week 3 : Attrition]

Posted by Phil123 on 09 July 2012 - 10:26 AM

No disrespect intended, I fully understood your inclusion of this example and support it.


No offense taken ^^, I re-read my original post after what you posted and realized I wasn't particularly clear on what I was trying to get across.

Thanks for your input Phil123, much appreciated.


No problem, this is a pretty tough topic of discussion (but a very good topic regardless) because balancing proper attrition rates in RPGs seems like a designer's nightmare when you think about it.

I'm going to assume you're referring to the use of consumables "in-battle" rather than in-between fights correct? While this is a bit more fun, like I have previously stated, loosing too many mandatory turns to actions that are not strategically sound but only "necessary" IS boring as well.


Agreed.

The problem here is I think you're encouraging the player to heal, which, in and of itself, isn't necessarily fun. I think the key lies in having less healing, not more. A turn spent healing is a turn lost in battle, or a few seconds lost outside of battle. It is time not spent towards thinking about your strategy. Sure, occasional healing works, but there is a reason games such as Diablo 3 have moved away from their healing-frenzy loops. If anything, this mechanic encourages more healing, and as much as it can be a decent patch for the issue, I think it does encourage the problem rather than being a permanent solution.


Yeah, those are some very good points.

Using one after 2 encounters instead of 4 is direct feedback to the player that something is wrong.


How would you implement this such that the player doesn't get the impression he's simply too low of a level and needs to grind out more exp? (Not that a bit of grinding is necessarily the worst thing in the world, I'm just talking in a theoretical situation).


#4957117 Weekly Discussion on RPG Genre's flaws [Week 3 : Attrition]

Posted by Phil123 on 08 July 2012 - 08:22 PM

It may appear clear to you, but I think we're missing the key part to your argument here


The part of my argument that's important is that the player's resources (gold, units - in this case) were limited just enough such that the player actually gives a damn and tries to mitigate as much damage as possible, but said resources aren't limited to the point where the game is no longer fun. If I told you "rofl, you can't beat my game, it's too hard" and you beat it, you'd feel a sense of accomplishment as the player. In this game's case, the player is gently told "ha - if you don't play well, you're going to lose, not now, but 2 hours from now when you run out of resources" so when the player DOES play well, and they end up beating the game (or a boss, or achieving something in the game) they feel that sense of accomplishment. Yes, this doesn't directly correlate to jRPGs or other RPGs, but I just thought that their system was very well done, and that it would be a half decent example for this discussion.

As for actual RPGs, the way I see it, there's a few issues with attrition and the nature of RPGs. Here are some scenarios, issues, and possible solutions:

1. Character health/mana does not regenerate outside of combat -> if the player runs out of consumables, this means a lengthy trip back to town. If the player doesn't have enough money, they're forced to grind lower level areas until they have enough money or until they get stronger (common player response for a RPG - definitely a boring one, and I don't think this should ever happen). Possible solutions:

A. Monsters drop health/mana/restoration orbs when killed (very popular in action RPGs). Not enough to heal you to full every time, but enough so you can keep going.

B. Random spawns of restorative consumables on the ground (where you can pick them up and save them for later, or they automatically heal you). This encourages the player to explore, rather than waste their time grinding lower level mobs or going back to town for more items. (Hell, this actually reminds me of Halo, where your shields regenerate, but your health doesn't - the only way to restore your health is to keep exploring and hope you find a health pack).

C. When you're victorious in a battle, you receive a number of consumables that could be a percentage of how many you used. (Say, used 12 potions for a really hard fight, the player would receive 5-6 back in order to keep them exploring/fighting/biting off more than they can chew - but they wouldn't receive enough consumables such that they can spam heal themselves with items all day long)

2. Character health/mana regenerates to full outside of combat -> the problem with this when I see it implemented in some (keyword: "some.") RPGs is that this puts even more of a requirement on consumables than if your health/mana hadn't regenerated outside of combat. By starting every battle at full health and mana (basically, maximum strength or close to it), I guarantee you, 9 times out of 10, combat will be balanced such that it is much more difficult, and then you have the same issues as above, where you'll have to run back to town get more consumables, or whatnot.

Well, how the hell can you design a good system? Easy, by studying others'. I think BioWare did one hell of a job on Mass Effect 3. Basically, enemy strength is based off of your level, so there really isn't anything that is ridiculously hard because you're under leveled, or ridiculously easy because you're extremely strong. Enemies that are hard will be difficult regardless of level, enemies that are easy will be easy regardless of level.

In regards to attrition, you have an easy way to heal yourself and your squad mates if they die (Medi Gel). So how did BioWare limit the player's resources like the above game I referenced? Well, Medi Gel isn't the easiest thing to come by during a mission, and you can have a maximum of 5 (I think? it's been a while), so it's not like you can use them like candy. But here's the kicker, even if you run out of Medi Gel, you aren't done for. You still have your shields, and you can revive your squad mates if they die without Medi Gel (it just requires you being right beside them, reviving them).

That's another example, I hope I made it clearer than I did previously. I realize these aren't strict RPGs but hopefully someone can apply these ideas to RPG design and come up with some solutions that are better than the ones I listed above (because my solutions definitely aren't perfect).


#4957012 Weekly Discussion on RPG Genre's flaws [Week 3 : Attrition]

Posted by Phil123 on 08 July 2012 - 02:19 PM

There's a series by the name of King's Bounty, where it's sort of like a tactical turn-based army verses army where your hero doesn't do much except cast spells, and you win the battle when all of the opposing units are defeated (vise versa for losing). Though your hero does effect your unit stats (5 attack, 5 defense means every unit gets 5 attack and 5 defense, basically, and the more Leadership points you have, the more units you can recruit) the main focus of battle is controlling your units.

Anyways, this game was STRICTLY balanced, such that if you lose too many units, you simply can't continue in the storyline (the king will give you some gold if you lose all of your units, but it's isn't really enough gold to get back on your feet right away). If you lose a battle (or lose any units that don't get resurrected), those units are permanently gone, unless you have the gold to purchase more. There weren't random battles, there were X enemies per area, and once you killed them, the only way to get gold was to A. find it, B. move on to a tougher area or C. find it in chests or do quests (which are limited as well). And what happens if you find a merchant that's selling really good units? Well, units are generally in short supply (the better ones, anyway), so even if you have 1,000,000,000 gold, you can't just "throw away" units all the time.

This provides the player with the general idea that he needs to minimize losses, and each class has their own way of minimizing unit losses (Paladin: good at resurrecting units, Mage: controls the flow of the battle with spells, or you can just use spells to kill them, Warrior: drastically increased unit effectiveness and increased army size).

So when the player takes all of these game facts/mechanics into account, they'll realize that they're fighting a war of attrition - whether or not you're doing well is completely up to how your battles have gone and how skilled you are tactically as a player, and how well you make decisions and minimize damage taken from your opponents. If you play poorly, then it'll catch up to you, but if you play really well, then you'll find yourself with extra units, gold, and equipment, which will make the really hard battles manageable.

I suppose I'm saying, if a game is very well designed and thoroughly tested, then attrition will provide a sense of accomplishment for the player when they reach certain points in the game.


PARTNERS