Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Let's make a game, /prog/

Name: Anonymous 2011-12-30 8:36

In C++ of course. I'll start with a class definition for our character.


#include <string>
#include "GIANT_LIST_OF_STL_HEADERS.hh"
#include "Typedefs_For_Shit_Liek_u8.hh"

namespace RPG {
        class Character {
        protected:
                u8 Str;
                u8 Dex;
                u8 Con;
                u8 Int;
                u8 Wis;
                u8 Cha;
                // Rest of class and RPG left intentionally undefined
                // Because Sepples is not Ruby and can't define the same class twice

Name: Anonymous 2011-12-30 9:12

C++ is shit.

Name: Anonymous 2011-12-30 9:25

Fuck off faggit bitch

Name: Anonymous 2011-12-30 9:50

Use a language that support roles/traits/mixins. I refuse to work with THE FORCED USE OF CLASS HIERARCHIES anymore.

Name: Anonymous 2011-12-30 10:08

# progventure.rb

class Character
  attr_accessor :str, :dex, :con, :int, :wis, :cha
  attr_accessor :hp, :max_hp, :mp, :max_mp
  def initialize(name, str, dex, con, int, wis, cha,
                   hp, mp, items = [], spells = [])
    @name = name
    @str, @dex, @con = str, dex, con
    @int, @wis, @cha = int, wis, cha
    @hp = @max_hp = hp
    @mp = @max_mp = mp
    @items = items
    @spells = spells
  end
  def get(item);     @items << item; end
  def drop(item);    @items.delete(item); end
  def has?(item);    @items.include?(item); end
  def learn(spell);  @spells << item; end
  def forget(spell); @spells.delete(spell); end
  def knows?(spell); @spells.include?(spell); end
end

$party = []
$party << Character.new(
    name = 'Xarn',
    str = 8,  dex = 9,  con = 10,
    int = 12, wis = 11, cha = 10,
    hp  = 90, mp  = 100
)
$party << Character.new(
    name = 'Leah',
    str = 8,  dex = 11,  con = 9,
    int = 10, wis = 9,   cha = 13,
    hp  = 80, mp  = 110
)
$party << Character.new(
    name = 'The Sussman',
    str = 11, dex = 9,  con = 8,
    int = 13, wis = 10, cha = 9,
    hp  = 80, mp  = 120
)

Name: Anonymous 2011-12-30 11:08

>>5
At the first glance, I thought that was assembly.

Name: Anonymous 2011-12-30 11:13

>>4
PHP 5.4?

Name: Anonymous 2011-12-30 16:15

>>5

Wow... all of your characters have shitty stats.

Name: Anonymous 2011-12-30 17:32

>>1'
>8 spaces for a tab
>C++
>redefining types


go back to /g/

Name: Anonymous 2011-12-30 17:50

>>1
If it isn't in ANSI C, or can't compile with the -pedantic flag, then go fuck yourself!

Name: Anonymous 2011-12-30 17:51

let's make a game check my doubles

Name: Anonymous 2011-12-30 20:40

>>10
fuck off and die, Zhivago

Name: Anonymous 2011-12-31 2:15

why are you using protected!

Name: Anonymous 2011-12-31 3:39

>>13
protected double penetration();

Name: Anonymous 2011-12-31 20:37

>>13
In case RPG::Character gets subclassed.
>>10
It's C++, not ANSI C. And I'm fairly sure it will compile with -pedantic

Name: Anonymous 2011-12-31 23:49

>>15
And I'm fairly sure it will compile with -pedantic

do you know what -pedantic means?

Name: Anonymous 2011-12-31 23:54

>>16

gnu people call people who follow the ansi standard to maintain cross compiler compatibility, pedantic. Yeah, it is kind of a dick move by them.

Name: Anonymous 2012-01-01 0:10

>>17
fuck you, you fat pedantic piece of shit

Name: Anonymous 2012-01-01 0:12

>>17
What a dick move on there part for keeping the language standard and portable.

Name: Anonymous 2012-01-01 0:13

>>18

LETS TAKE IT OUTSIDE

Name: Anonymous 2012-01-01 0:20

>>19
yeah, I know right?

Name: Anonymous 2012-01-01 0:22

>>19
Really. I mean having portable shit puts frozenVoid out of work.

Name: Anonymous 2012-01-01 2:26

>>16

-pedantic means that the code will only compile if it only uses ansi standards. Any compiler specific shit will generate an error. Although the above code does use headers that are assumed to be in the same directory as the RPG code, but were not written out of how unnecessary they were, the code would compile with -pedantic because it does not use any non-standard C++ features.

Name: Anonymous 2012-01-01 5:03


       -pedantic
           Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do not follow
           ISO C and ISO C++.  For ISO C, follows the version of the ISO C standard specified by any -std option used.

           Valid ISO C and ISO C++ programs should compile properly with or without this option (though a rare few will require -ansi or a -std option specifying the
           required version of ISO C).  However, without this option, certain GNU extensions and traditional C and C++ features are supported as well.  With this
           option, they are rejected.

           -pedantic does not cause warning messages for use of the alternate keywords whose names begin and end with __.  Pedantic warnings are also disabled in the
           expression that follows "__extension__".  However, only system header files should use these escape routes; application programs should avoid them.

           Some users try to use -pedantic to check programs for strict ISO C conformance.  They soon find that it does not do quite what they want: it finds some
           non-ISO practices, but not all---only those for which ISO C requires a diagnostic, and some others for which diagnostics have been added.

#####      A feature to report any failure to conform to ISO C might be useful in some instances, but would require considerable additional work and would be quite
#####      different from -pedantic.  We don't have plans to support such a feature in the near future.

           Where the standard specified with -std represents a GNU extended dialect of C, such as gnu89 or gnu99, there is a corresponding base standard, the version
           of ISO C on which the GNU extended dialect is based.  Warnings from -pedantic are given where they are required by the base standard.  (It would not make
           sense for such warnings to be given only for features not in the specified GNU C dialect, since by definition the GNU dialects of C include all features
           the compiler supports with the given option, and there would be nothing to warn about.)


Better download your own ansi C syntax checker I guess.

Name: Anonymous 2012-01-01 6:58

>>1
// Because Sepples is not Ruby and can't define the same class twice

implying you inheritance couldn't be used

Name: Anonymous 2012-01-01 8:03

>>23
Wrong.

Don't change these.
Name: Email:
Entire Thread Thread List