Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4

Author Topic: "Fenrir, Peasant" to "Fenrir, Game Develo  (Read 6870 times)

Fenrir

  • Guest
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #15 on: January 10, 2008, 03:13:00 pm »

I looked into PDCurses a while back, but I didn't use it because the documentation was so confusing. I'm assuming that this is the documentation.
Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #16 on: January 10, 2008, 03:21:00 pm »

It's much easier to just look at the "Bloodcave of Satan" or whatever game here on this site, also sticking to one or two functions that you understood is generally easier than trying to understand all of them.
Also I think the kobolds quest source is wort a look, it's the same basic architecture as DF.
Just remember that it is always easier to write code than to read it.

I sound like I knew what I was talking about but I probably don't.

Edit: for a little training in ASCII game coding try to modify the levels in Bloodcave, then try to create a new kind of enemy.

[ January 10, 2008: Message edited by: Armok ]

Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

nerdpride

  • Bay Watcher
    • View Profile
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #17 on: January 10, 2008, 04:47:00 pm »

try this one instead

NCurses has better introduction material.  I learned from some tutorial I googled, I forget what it's called now.  It's the same thing as PDCurses, the functions don't need to be changed when you switch between them.  That's why people say its portable even though the two are different between Windows and Linux.

And it is hard to explain.  But unless you want to do something really fancy, it works to ignore stuff about making new windows (other than stdscr).  Once I figured it out its just like:

#include <curses> //the library
int main()
{
char input;
struct
{
int y = 0;
int x = 0;
int hp = 1;
} player;
// these are fun, I learned in C
// my compiler didn't like them :*(

initscr(); // start up the curses features
cbreak(); // don't require enters for input
noecho(); // don't write back what is input

while(player.hp > 0) // self explanatory
{
mvaddch(player.y, player.x, '@');
// move() and addch() combined;
// it's not quite cartesian, y goes first

refresh();
// show what's changed

input = getch();  
// should get input from keyboard
// does it wait for the input? I forget.  
// make a while loop for it if it doesn't

mvaddch(player.y, player.x, ' ');
// delete the player symbol
// it's probably going to move every turn, so...
// a new one will be made by the time it refreshes

if (input == KEY_UP) // up arrow
player.y++; //change the variable in the struct
if (input == KEY_DOWN) //down
player.y--;

// and so on...

}
endwin();
//clean up curses stuff
}

It's a silly little game loop, doesn't even allow for collision or monster movement, but it's easier with curses.  And a switch would be better for player commands, once you get enough of them.

So, you get the idea.

Edits:  a few silly mistakes since I haven't done it in a while.

It gets more fun when you use colors.

more edits:  I'm satisfied with it now, I think.  One more silly mistake and I'm good.

finally:  I just realized I didn't want to write a whole scheme for player movement and just a tiny example for curses...

Could've found the same thing linking to that kuro5hin article.  Meh.

[ January 10, 2008: Message edited by: nerdpride ]

[ January 10, 2008: Message edited by: nerdpride ]

Logged

Fenrir

  • Guest
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #18 on: January 10, 2008, 05:09:00 pm »

Many thanks to you all.
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #19 on: January 10, 2008, 05:23:00 pm »

I use C. I think Toady started with C. ADOM, nethack, and andband were all written in C.

C++ addes confusing features, and my "good"(non microsoft) compiler has a windows relate error when trying to compile C++.


Whatever one you use, the important parts are input and output.
Mostly getting either the keystates or input without waiting for the enter key. Or drawing to the window properly.

Logged
Eh?
Eh!

Gulfd'An

  • Guest
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #20 on: January 11, 2008, 12:39:00 pm »

quote:
Originally posted by Kayla:
<STRONG>
Most do not like teams (as teams tend to disolve quickly

(Chances are you won't be able to afford an actual artist or modeler)
</STRONG>


ya teams die fast i am on one makeing a new blockland type game and were going no were (and thanks to one of my brothers who is always trolling and flameing and lieing and stuff most of our team has quit and the guy who had the idea to make the games also thinking of just quiting cause of him 8P)

you don't need to aford one cause ill work for free (that was my job for the team)

as for making a ascii or rouge like i was gona learn c to make one to
try googleing ADOM its probably my most favourite rogue like or ascii game (i like it more than DF but thats not the point) the guy who made ADOM has a open source game called qhack (quick hack) that he made in 6 hours to see how far he could get a rouge like in that amount of time andif you want he says you can use it to make your own game (it has level generation walking i think monsters and a few other simple tings already programed) so if you don't know how to start download qhack and make your own game from it (all he askes is his name in the credits)

Logged

Fenrir

  • Guest
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #21 on: January 13, 2008, 02:16:00 pm »

Urrgh... How do I tell the bloody compiler/linker/whatever where the library is? I'm using Bloodshed Dev-C++.
Logged

nerdpride

  • Bay Watcher
    • View Profile
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #22 on: January 13, 2008, 05:24:00 pm »

Yeah, that fuzzled me too, sorry about not mentioning it.

Dev-Cpp makes it easy with their package system.  You can download libraries or other changes to the compiler.  There are warnings against using the community packs, since the admins can't monitor them so easily, but I'd say it's basically safe.  There are serious people who maintain these things.

So, from the toolbar, go to "Tools"->"Check for Updates/Packages".  Somewhere toward the top of the window that you see, there's a field called "select devpack server".  Change it to "devpacks.org Community Devpacks".  Then click on "Check for Updates" at the lower left.

The rest is pretty straightforward.  Search for PDCurses under the "Text Console" group.

So to actually use it you just make a new project in PDCurses.  It should be under the "other" tab when you start a new one.  And when you do start it up, it gives you a free example of use for the library.

If you don't want to do it that way for any reason, you can say so, and I won't need to type more stuff out than needed.

Logged

Fenrir

  • Guest
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #23 on: January 13, 2008, 05:39:00 pm »

Now I'm getting this "installation problem, cannot exec 'cc1': No such file or directory" crap.
Logged

nerdpride

  • Bay Watcher
    • View Profile
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #24 on: January 13, 2008, 05:48:00 pm »

How far did you get?

It might be best to try uninstalling and reinstalling, but I don't know what the situation is.

[ January 13, 2008: Message edited by: nerdpride ]

Logged

Fenrir

  • Guest
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #25 on: January 13, 2008, 05:50:00 pm »

quote:
Originally posted by nerdpride:
<STRONG>How far did you get?

It might be best to try uninstalling and reinstalling, but I don't know what the situation is.

[ January 13, 2008: Message edited by: nerdpride ]</STRONG>



I did everything you said. I'll reinstall Dev-C++.

Thanks for putting up with my incompetence.

Logged

Fenrir

  • Guest
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #26 on: January 13, 2008, 05:58:00 pm »

I reinstalled the whole thing, but it still says the same thing. Should I try an earlier version of Dev-C++? I'm using 4.9.9.2 and it says it's beta.
Logged

Lazy_Perfectionist

  • Bay Watcher
    • View Profile
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #27 on: January 13, 2008, 06:01:00 pm »

Word of advice #1
Comment. Comment. Comment.
You will not remember what your code does/supposed to do, so comment it. It'll help you later.

Word of advice #2
Consider auditing a couple of community college courses-
Intro to C++
Intro to Object Oriented Programming

I can't guarantee it'll be worth your time/money, but if your teacher is decent, its a wonderful headstart. There will be other things you'll need to learn, but if you've taken on C++, you'll be better prepared to take on most other languages. It's a bit more challenging than contemporary languages like Python. Object Oriented Programming is almost universally handy. It'll promote a lot of good habits and give you a basis for understanding some of the more complex things.

Uhmm.... Books...
C++ in a Nutshell
C++ Pocket Reference

I don't recommend these for teaching yourself programming/C++, but they're invaluable for writing code. If you know exactly what you want to do, but have forgotten how to do it...

Umm... C++ is a fairly arcane language, where you have to deal with memory and such. It's my favorite language, but Python would be a better choice for your first project. Python is a higher-level language where you concern yourself much less with arcane details than you would in C++. C++ has performance advantages if properly written, but Python is a lot quicker to write for, and has fewer pitfalls and is generally more forgiving.

[ January 13, 2008: Message edited by: Lazy_Perfectionist ]

Logged
 Bloat325, ADDITIONAL LIQUID TYPES, (Future): Candidates for new flowing "liquids" include sand, oil, mud, blood of various sorts, slime, farm products like grain and beer for the beer fountain. Only a limited number of materials from plant raws like beer

nerdpride

  • Bay Watcher
    • View Profile
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #28 on: January 13, 2008, 06:17:00 pm »

quote:
Originally posted by Fenrir:
<STRONG>I reinstalled the whole thing, but it still says the same thing. Should I try an earlier version of Dev-C++? I'm using 4.9.9.2 and it says it's beta.</STRONG>

Well it should be working fine.  I remember its been out for a while.

I tried it and I'm getting errors too, but not the same one exactly.  Try compiling a regular program, so we know if its the package or the compiler itself.

So we have a few options:

1.  Quit.  This is my favorite.  Come back another day if you're feeling frustrated, maybe look at some articles or play a relaxing game or something.  This might be a particularly good option because of that comment earlier.  No need to get depressed over dumb computers.

2.  Try a new compiler.  Dev-Cpp is based on MinGW, it's a little bit more like using a Linux machine, which I think is really nice.  Another good one is Code Blocks.  They don't have the devpacks but devpacks are basically a simple download and an option that automatically sets up the linker (part of the compilation process) for you.  Easy to do in any other compiler, especially if it emulates a Linux system.

3.  Try to fix Dev-Cpp.  Ugh.  Actually, if it turns out that something is wrong with the devpack, then you can just uninstall it, download the library yourself, and set up the linker from any given project's options.  I'm just not sure if it will work from there, you might need more than a DOS window.  But the linker options themselves are simple.

4.  Try conio.h instead of PDCurses.  Trying to understand curses might not pay off with this route, but you can still accomplish the same goal in the end, if it works.  Plus it might be easy to try it out with the devpack for that one.

5.  Try to understand how computers work.  Receiving instructions from a random guy on the internet must be a pain, especially since I'm not explaining anything.  There's plenty of useful stuff out there to do that doesn't require PDCurses or even a functioning compiler.  It's just a matter of reading and experimenting.  If something looks to hard, make a note of what it basically was, then look for something else.  There are many, many sources of information out there.

I'm not your boss, so you should pick one.  Or think of something I didn't.

[ January 13, 2008: Message edited by: nerdpride ]

Logged

Fenrir

  • Guest
Re: "Fenrir, Peasant" to "Fenrir, Game Develo
« Reply #29 on: January 13, 2008, 06:40:00 pm »

I'll take "Try to fix Dev-Cpp" for $200...

I got curses to work once before. If that fails, I'll look into conio.h. Hmmm... I actually have some code that uses that library, I got it from an online tutorial that the author never finished.

Logged
Pages: 1 [2] 3 4