Jump to content

I just made an incredible incredible piece of code relating to Fallout.


Prosper

Recommended Posts

In the past I have said creating an engine better or equal tofallouts' was easy.

 

Well now I want to show you an example of why I believe Fallout as the game is easy to recreate as well. Look how genius this code is. All I had to do was think critically.

        std::vector<signed int*> stats;
        stats.push_back(&m_self.Intelligence);
        stats.push_back(&m_self.Perception);
        stats.push_back(&m_self.Strength);
        stats.push_back(&m_self.Charisma);


        unsigned int nStatPointsAllocated = 0;
        const unsigned int nMaxStatValue = 10;
        unsigned int nMaxStatsPoints = (nMaxStatValue * stats.size()) / 2;
        while (nStatPointsAllocated < nMaxStatsPoints)
        {
            for (unsigned int iii = 0; iii < stats.size(); ++iii)
            {
                signed int* snp = stats[iii];
                unsigned int nToGive = roll_die(0, nMaxStatValue);
                if (nStatPointsAllocated + nToGive < nMaxStatsPoints)
                {
                    if (*snp + nToGive <= nMaxStatValue)
                    {
                        *snp = *snp + nToGive;
                        nStatPointsAllocated = nStatPointsAllocated + nToGive;
                    }

                }

            }
        }

So this code is in my player-class initialization function, which I use to give every player default values. Just look how masterfully I approached stat allocation in my character creation code.

 

A large part of the most important experience when you start the game is shown here and complete. So simple and yet so fallouty.

 

 

Here is a copy of the above code in an encrypted volume. (TruCrypt)

The password for the volume is :

5ref0jsjINdG5unyoOam9fk

 

Download Link for Volume:

http://www.sendspace.com/file/3qizym

 

p.s. I have no job.

Edited by Prosper
  • Like 1

redacted

Link to comment
Share on other sites

Eew, vectors and c++? Just eeeeeew.

 

Also, don't you want automatic stat allotment to be a function? Don't want that kind of code executing just... well, whenever, even if that code is contained in just a character generation screen, you want it deliberately executed by a call so that it's easy to disable when testing your game out.

 

I'm also wary that your code isn't extendable. What I mean is, enemies in your game - won't they use stats like the PC? You have a vector called stats, but shouldn't that vector be contained in a "unit" object? Unit can be a player or an monster of some sort.

Edited by anubite

I made a 2 hour rant video about dragon age 2. It's not the greatest... but if you want to watch it, here ya go:

Link to comment
Share on other sites

Eew, vectors and c++? Just eeeeeew.

 

Also, don't you want automatic stat allotment to be a function? Don't want that kind of code executing just... well, whenever, even if that code is contained in just a character generation screen, you want it deliberately executed by a call so that it's easy to disable when testing your game out.

 

I'm also wary that your code isn't extendable. What I mean is, enemies in your game - won't they use stats like the PC? You have a vector called stats, but shouldn't that vector be contained in a "unit" object? Unit can be a player or an monster of some sort.

 

"I'm also wary that your code isn't extendable. What I mean is, enemies in your game - won't they use stats like the PC? You have a vector called stats, but shouldn't that vector be contained in a "unit" object? Unit can be a player or an monster of some sort."

 

m_self is the name of a structure containing the basic entity properities like Strength, Charisma, Intelligence. If you would like more properties declare them in that structure and just as I do in my source code  push those properties into the vector. All done. That is extensibility.

 

"well, whenever, even if that code is contained in just a character generation screen, you want it deliberately executed by a call so that it's easy to disable when testing your game out."

 

Init is not the player class constructor. Just a function I made that is part of the player class.

 

If you are going to critisize my code point out where it is not doing its job properly. I still can't get over how incredibly well I captured stat allocation.

Edited by Prosper

redacted

Link to comment
Share on other sites

Everyone loves prosper.

"It wasn't lies. It was just... bull****"."

             -Elwood Blues

 

tarna's dead; processing... complete. Disappointed by Universe. RIP Hades/Sand/etc. Here's hoping your next alt has a harp.

Link to comment
Share on other sites

Everyone loves prosper.

I don't, I seen what he calls 3d modelling and frankly I take offense.

 

If he wants to make an attempt to fix that cluster**** that's the Gamebryo engine, I say : Godspeed!

I'd say the answer to that question is kind of like the answer to "who's the sucker in this poker game?"*

 

*If you can't tell, it's you. ;)

village_idiot.gif

Link to comment
Share on other sites

It's not offensive. It's bloody art!

 

Art I tell you!

"It wasn't lies. It was just... bull****"."

             -Elwood Blues

 

tarna's dead; processing... complete. Disappointed by Universe. RIP Hades/Sand/etc. Here's hoping your next alt has a harp.

Link to comment
Share on other sites

<book falls as I walk by and clear my throat>

 

cormen-lg_cover.jpg

  • Like 1

Fere libenter homines id quod volunt credunt. - Julius Caesar

 

:facepalm: #define TRUE (!FALSE)

I ran across an article where the above statement was found in a release tarball. LOL! Who does something like this? Predictably, this oddity was found when the article's author tried to build said tarball and the compiler promptly went into cardiac arrest. If you're not a developer, imagine telling someone the literal meaning of up is "not down". Such nonsense makes computers, and developers... angry.

Link to comment
Share on other sites

  • 4 weeks later...

<book falls as I walk by and clear my throat>

 

cormen-lg_cover.jpg

 

Looks interesting. Would that be intelligible to a non-techie?

"It wasn't lies. It was just... bull****"."

             -Elwood Blues

 

tarna's dead; processing... complete. Disappointed by Universe. RIP Hades/Sand/etc. Here's hoping your next alt has a harp.

Link to comment
Share on other sites

yes, it mostly uses pseudo-code and lots of pictures, IIRC

Walsingham said:

I was struggling to understand ths until I noticed you are from Finland. And having been educated solely by mkreku in this respect I am convinced that Finland essentially IS the wh40k universe.

Link to comment
Share on other sites

 

<book falls as I walk by and clear my throat>

 

cormen-lg_cover.jpg

 

Looks interesting. Would that be intelligible to a non-techie?

 

 

Yep, language-impartial as far as I know. And, would help a person understand why making 6 line consumption calls to boiler code is really just the tip of an iceberg.

Fere libenter homines id quod volunt credunt. - Julius Caesar

 

:facepalm: #define TRUE (!FALSE)

I ran across an article where the above statement was found in a release tarball. LOL! Who does something like this? Predictably, this oddity was found when the article's author tried to build said tarball and the compiler promptly went into cardiac arrest. If you're not a developer, imagine telling someone the literal meaning of up is "not down". Such nonsense makes computers, and developers... angry.

Link to comment
Share on other sites

Cool. I shall have to trace a copy.

"It wasn't lies. It was just... bull****"."

             -Elwood Blues

 

tarna's dead; processing... complete. Disappointed by Universe. RIP Hades/Sand/etc. Here's hoping your next alt has a harp.

Link to comment
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
×
×
  • Create New...