Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 404 405 [406] 407 408 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 908435 times)

Kirbypowered

  • Bay Watcher
  • Proficient Dabbler
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6075 on: July 04, 2014, 06:57:15 am »

I'm running visual studio express with pdcurses for making a roguelike. It's not a bad option if you're on windows, it was extremely easy to set up.
Speaking of setting up libraries, is there any general method of knowing what to include where? I've been told to look for things in include folders and library folders, but of course pdcurses had neither of these (apparently pdcrs34dllw.zip has all the important files?). The include stuff seems to be needed for the compiler (.h/.hpp files) and the library stuff for the linker (.lib/.a files). There's also the case of the special .h files, like curses.h and libtcod.h, which are not included in these folders but still need to be recognized somewhere.

I think I was able to get libtcod set up (though it might not actually be working), but I haven't tried anything with pdcurses yet.
Logged
THE WINTER MEN COME DOWN THE VALLEY AND KILL KILL KILL.
I'm voting for the Plaid Acre up next on COLORS AND MEASUREMENTS weekly.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6076 on: July 04, 2014, 05:35:58 pm »

> pdcrs34dllw.zip

yeah, that one.

i did this just the other day:

- install Visual studio C++
- make a blank c++ project, i.e. ensure this isn't a win32 console app or anything.
- stick pdcurses .h, lib and dll files into the project's directory
- add pdcurses .lib file as a dependency in the project settings for linker inputs.
- include the curses.h where needed in your program
- done
« Last Edit: July 04, 2014, 05:38:08 pm by Reelya »
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6077 on: July 12, 2014, 12:13:21 am »

I have 3 enums for describing tiles in DF, as follows.

Code: [Select]
enum TiletypeShape {
NO_SHAPE = -1;
EMPTY = 0;
FLOOR = 1;
BOULDER = 2;
PEBBLES = 3;
WALL = 4;
FORTIFICATION = 5;
STAIR_UP = 6;
STAIR_DOWN = 7;
STAIR_UPDOWN = 8;
RAMP = 9;
RAMP_TOP = 10;
BROOK_BED = 11;
BROOK_TOP = 12;
TREE = 13;
SAPLING = 14;
SHRUB = 15;
ENDLESS_PIT = 16;
}

enum TiletypeSpecial {
NO_SPECIAL = -1;
NORMAL = 0;
RIVER_SOURCE = 1;
WATERFALL = 2;
SMOOTH = 3;
FURROWED = 4;
WET = 5;
DEAD = 6;
WORN_1 = 7;
WORN_2 = 8;
WORN_3 = 9;
TRACK = 10;
};

enum TiletypeMaterial {
NO_MATERIAL = -1;
AIR = 0;
SOIL = 1;
STONE = 2;
FEATURE = 3;
LAVA_STONE = 4;
MINERAL = 5;
FROZEN_LIQUID = 6;
CONSTRUCTION = 7;
GRASS_LIGHT = 8;
GRASS_DARK = 9;
GRASS_DRY = 10;
GRASS_DEAD = 11;
PLANT = 12;
HFS = 13;
CAMPFIRE = 14;
FIRE = 15;
ASHES = 16;
MAGMA = 17;
DRIFTWOOD = 18;
POOL = 19;
BROOK = 20;
RIVER = 21;
}

Every tile in DF can perfectly be described using one of these three types of enums (that's not how they're stored, but it's how they can be described)

I need to figure out a way to assign tiles to them such that every combination has the best match assigned to it, but the tiles themselves only need to be assigned a partial subset.

Example:

Tile 1 is WALL , with no other definitions.
Tile 2 is WALL, SMOOTH.

In this case, anything with WALL would get tile 1 unless it's also SMOOTH, then it would get tile 2.

Any idea how I could efficiently do this?
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6078 on: July 12, 2014, 04:27:51 am »

I'd suggest the following:
To store your icon representations, you use a Map<Triple<TileTypeShape, TileTypeSpecial, TileTypeMaterial>, Pair<TileIcon, Priority>> or something isomorphic. Then you store all the tiles in there keyed by their properties, each with priorities.
Let's say you have a RAMP_TOP/WET/MINERAL, and want to find its appropriate tile. For that, you get the eight map values (if existing) corresponding to RAMP_TOP/WET/MINERAL, RAMP_TOP/WET/NO_MATERIAL, RAMP_TOP/NO_SPECIAL/MINERAL, RAMP_TOP/NO_SPECIAL/NO_MATERIAL, NO_SHAPE/WET/MINERAL, etc..., and from the tiles you got (not each combination has a tile), use the one with the highest priority.

Note that it's likely you usually won't even need the priority system, instead just taking the first tile you find, as long as you know that, say, if you're looking for SPECIFIC/SPECIFIC/SPECIFIC and you only have SPECIFIC/SPECIFIC/NONE and SPECIFIC/NONE/SPECIFIC, then you'll always pick the SPECIFIC/SPECIFIC/NONE.
« Last Edit: July 12, 2014, 04:32:37 am by MagmaMcFry »
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6079 on: July 12, 2014, 07:48:35 am »

Actually, after thinking it through, I realized I was going through this the wrong way entirely.

How I'm currently planning on doing it:

Have a list of valid tiletypes, and their shapes, specials, and materials. this removes the un-necessary splitting of the values, since they're all describing the various members of the same enum anyway.

Then for each one, I store the assignment, and which of those three were used to assign it. Then for every assignment I get from the configs, I parse through the whole list, and assign the sprites to whichever tiletypes are applicable. For those that already have an assignment, then the higher priority one is kept.

Now the real fun, on the other hand, will be fuzzy matching to this
Logged

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6080 on: July 12, 2014, 03:57:23 pm »

Would you mind helping me choose my uni classes?

Spoiler: What do? (click to show/hide)
Logged

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6081 on: July 13, 2014, 01:34:12 pm »

If I had to pick from those courses (I have no idea how many you get), and I'd never programmed before, I think the ones I'd want most would be MySQL Database 3 and C++, C#, or Java Level One. Web Scripting could be handy too, probably PHP or Javascript because they're fairly standard.
The fundamentals stuff you can learn by research off the internet pretty easily (at least, I could), and I'm not entirely sure what the rest would entail.

Edit: Die, greengrocer's. Die a horrible death.
« Last Edit: July 13, 2014, 01:50:30 pm by Arx »
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6082 on: July 13, 2014, 01:45:35 pm »

UNIX =! Linux.

Linux is an open-source, heavily UNIX-inspired OS. UNIX is a proprietary OS initially developed by AT&T, who gave it out to a bunch of universities for free to run on their timesharing computers.

I recommend looking up UNIX on Wikipedia, it's a fairly interesting read.
« Last Edit: July 13, 2014, 01:47:21 pm by miauw62 »
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Sheb

  • Bay Watcher
  • You Are An Avatar
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6083 on: July 14, 2014, 12:42:34 am »

Does anyone still use UNIX?
Logged

Quote from: Paul-Henry Spaak
Europe consists only of small countries, some of which know it and some of which don’t yet.

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6084 on: July 14, 2014, 02:18:51 am »

No.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

da_nang

  • Bay Watcher
  • Argonian Overlord
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6085 on: July 14, 2014, 02:20:02 am »

If you're being chased by velociraptors...
Logged
"Deliver yesterday, code today, think tomorrow."
Ceterum censeo Unionem Europaeam esse delendam.
Future supplanter of humanity.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6086 on: July 14, 2014, 06:17:42 am »

Was an image until I realized how large it was.

If you're really into Unix, BSD is about as close as you can get. RE Wikipedia, it was originally based on the AT&T source but later rewritten.
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6087 on: July 14, 2014, 12:46:19 pm »

GUNNIN, why so set on cutting out the 'nixes, exactly? What would you actually learn in the Windows classes you don't already know, comparatively?
Logged

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6088 on: July 14, 2014, 03:53:22 pm »

Isn't Windows the most common? I just want to be able to get a job. :c

EDIT: But I need to pick one from each of those clusters as a requirement for my degree.

EDIT2: Bolded the choices according to Arx. What about the rest? I simply don't know what to think.. I just want to do whatever I have to to be able to get a job programming, with the possibility to maybe have a chance to possibly move on to vidja games once I actually learn what I'm doing! ;-;

Spoiler (click to show/hide)
« Last Edit: July 14, 2014, 04:14:31 pm by GUNINANRUNIN »
Logged

darklord92

  • Bay Watcher
  • [CREATURE:SERGALNORTH]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6089 on: July 15, 2014, 09:50:37 am »

Isn't Windows the most common? I just want to be able to get a job. :c

EDIT: But I need to pick one from each of those clusters as a requirement for my degree.

EDIT2: Bolded the choices according to Arx. What about the rest? I simply don't know what to think.. I just want to do whatever I have to to be able to get a job programming, with the possibility to maybe have a chance to possibly move on to vidja games once I actually learn what I'm doing! ;-;

Spoiler (click to show/hide)

1st category: Generally, there are some considerable differences between the operating systems and how you can program for them. Though I've mostly messed with C++ in windows 7, I can say I've run into my own set of issues when moving it back to XP. Mostly incompatible libraries. As well as the version of the c++ standard you can compile for in that system.

2nd: Alright, so this in particular is actually a very major thing depending on what language you take. To make this simple: object oriented programming has objects that can be created and reused on demand to store data, process data, or to be structures of data themselves. C++ being an object oriented language( like java ) has all the abilities of the standard C, but with object capability. Often it's more confusing to start out object oriented, but the payoff can help a lot programming.

3rd: I presume their web scripting course is front end stuff ( stuff a servers client processes, HTML, JavaScript, etc ). However the following courses have to do with things processed on the server, and than sent back to the user as a file.

4th: Looks to be general courses in each one that should go along with your prior choices.

I'm not a huge expert, and don't take what I say as perfect. Take as much advice as you need before you move on into something so you are prepared. When it comes to coding, get a general understanding of how a computer actually works. It helps massively in wrapping your head around what is the fastest and best way to code something:

For instance.

There is no such thing as a text string in any standard of C and C++. Instead strings of characters are an array of chars stored in memory next to each other ending with a terminator.

so when thinking of strings in C, you must think not like this: "hello world" but like this:

char[0] = h; //or more properly the hexadecimal value for h, as everything stores in memory is actually a length of bytes.
char[1] = e;
...
char[10] = d;
char[11] = null;
« Last Edit: July 15, 2014, 11:25:23 am by darklord92 »
Logged
Form walking potato man out of corpse. Absorb anyone else in the house.
We have a successful derail.
The Vilous Mod - Jingle berries!
Pages: 1 ... 404 405 [406] 407 408 ... 796