Jump to content
View in the app

A better way to browse. Learn more.

Obsidian Forum Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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

redacted

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:

  • Author

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

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.

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

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.

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

 

cormen-lg_cover.jpg

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.

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

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.

 

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

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.

Prosper is the last, best hope for PC gaming.

The ending of the words is ALMSIVI.

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.