Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 3 4 [5] 6 7

Author Topic: Let's make a roguelike, amateur programming at its... finest?  (Read 21472 times)

dennislp3

  • Bay Watcher
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #60 on: October 17, 2012, 01:18:56 am »

2. import tiles
3. import libtcodpy as libtcod

This probably wont help...but try swapping these? Libtcod first?
Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #61 on: October 17, 2012, 07:44:29 am »

Did not help.

Another

  • Bay Watcher
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #62 on: October 17, 2012, 11:45:57 am »

Did not help.
Try to delete "tiles." from line 54 "map = [[ tiles.grass()". It may be that grass is defined in the global namespace.
Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #63 on: October 17, 2012, 03:21:29 pm »

Code: [Select]
NameError: global name 'grass' is not defined

Another

  • Bay Watcher
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #64 on: October 18, 2012, 03:35:45 am »

  Sorry. I tried to reproduce the bug using IDLE but apparently IDLE runs all code in persistent Python shell environment and all class declarations from outdated file variants remained active. I have very little experience with Python and such bugs do not arise with compiled languages.

  Running original unmodified case separately through typing "python main.py" in console prompt (run "cmd" on windows) did not produce any errors. Maybe IDLE environment was partially responsible for the original error?
Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #65 on: October 18, 2012, 06:46:03 am »

I've also tried to do this through a .bat and it produces the same error.

EDIT: HOKAY this is an irritant...  Apparently when I use IDLE and I save a file, it generates a .py sometimes... and sometimes it just generates a generic file with no extension.  Upon suggestion, I stopped using IDLE, and looked closer.  I had a "tiles" and a "tiles.py" in my folder.  When I saved the file using IDLE, it saved to "tiles" while my main code was trying to import "tiles.py" and "tiles.py" was an older version of the file before I "include libtcod" in it.

Fix: Right click "tiles.py" -> Open with Notepad.  If I'm using a .bat to run the code, then IDLE appears to be buggy and do nothing impressive.
« Last Edit: October 18, 2012, 06:51:07 am by Girlinhat »
Logged

Gamerlord

  • Bay Watcher
  • Novice GM
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #66 on: October 18, 2012, 07:23:02 am »

post to watch

Another

  • Bay Watcher
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #67 on: October 18, 2012, 09:02:25 am »

I really suggest using Notepad++ for all small to medium sized projects. Syntax highlighting and auto-identation help to see code structure and it is very easy to execute your code with a single button press. (Look, for example, here http://stackoverflow.com/questions/2392629/how-do-you-run-a-python-script-from-within-notepad ;you may need to open Plugin Manager and select NppAutoIndent and NppExec first.)
Logged

dennislp3

  • Bay Watcher
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #68 on: October 18, 2012, 12:32:21 pm »

I am using Pyscripter myself (http://code.google.com/p/pyscripter/).

Has a look and feel of visual studio and is nice when your making a project. Has debugging and code completion and all that jazz.
Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #69 on: October 18, 2012, 01:25:57 pm »

Now that I'm in Notepad my environment is fine.  You input text, save it, and you're done.

EDIT:
Spoiler (click to show/hide)
It's not much, but I moved around a little and everything works so far!  Map generation is very simple - 25% chance per tile to become a tree.  Map is like 100x100 and the camera follows the player, nothing fancy there.  But I've got some framework set now, like I've got the tiles defined in their own file, and I can make a tile into another tile type with my own set_tile function.  Next, I think, I'll work on handling trees and harvesting them.  Probably gonna start letting the player just collect items off trees, and let them gather things like sticks and berries and stuff.  Once food is in, then I'll add hunger.  It seems cruel to do it the other way around :P
« Last Edit: October 18, 2012, 02:37:58 pm by Girlinhat »
Logged

SethCreiyd

  • Bay Watcher
  • [VESPERTINE]
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #70 on: October 18, 2012, 05:48:41 pm »

Looking good so far.  Map scrolling can be a pain in the neck, so nicely done.

When you're saving a file in IDLE, you have to specifically type the file extension, even if you select the file type.  IDLE is useful for testing modules or snippets of code before you add them to the bigger project (the interactive shell is one of Python's great strengths), but as far as IDEs for actual projects go, there are far better choices out there.

I'm going to echo the suggestion of Notepad++.  It's feature rich, and quite stable.  Even if you don't need the colored syntax, it gives you tabs, multiple views, macros, text-to-text comparison, line numbering, auto-indent, text folding, batch execution, session saving, and column selection, not to mention the Find in / Replace in All Files feature, which is very helpful for managing a project that's split off into several modules.

Regular Notepad is fine for little scripts, but your productivity is almost certain to suffer as the project gets bigger.
Logged

dreadmullet

  • Bay Watcher
  • Inadequate Comedian
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #71 on: October 18, 2012, 09:19:38 pm »

A roguelike, with brutal survival gameplay? And DF style combat? This will be fun to watch.

(I was pretty much on the edge of my seat while reading through this thread hoping there wouldn't be a mention of a simple hit point system. I am pleased.)
Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #72 on: October 18, 2012, 09:22:05 pm »

I've played FAR too much DF to allow HP systems.  Although to be fair I'll probably give individual tissues an HP, so you can damage them, but otherwise no.  In gameplay terms you will never see an HP bar.

Minstrel

  • Bay Watcher
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #73 on: October 20, 2012, 02:50:18 am »

PTW? PTW.

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Let's make a roguelike, amateur programming at its... finest?
« Reply #74 on: October 21, 2012, 12:14:55 am »

So I've been pretending to work on this (read: playing End of Nations) but I got around to making a "gather" command.  Right now you can tap 'g' and then a direction, and it will print the name of one item that could be harvested from that tile.  That is to say, there is no inventory system yet, but the tricky part was getting keystrokes.  Items are relatively easy.

Since gathering items is mostly in place, then, the issue comes to items.  Ideally, I want most item stats to be variable in-game.  On the most basic level, there's 'sword' with an attack power of 5, and then there's 'rusty sword' with an attack power of 4.  This could happen during use though, probably during repair.  If the sword hits, say, 0/15 durability, then you can repair it to 15/15, but it has a chance to lower it to 14/14 or to inflict a poor status, depending on your sharpening skill and the quality of the grindstone.  In this way, items become more fluid.  You don't have "a sword or no sword" you have "an old sword or you can spend your only money to get a shiny new sword" and other such item-specific issues.

Beyond that will be things like item weight.  Once items get individually changing stats, this becomes a neat thing to do.  People familiar with UnReal World will understand this.  Items get a weight to them, and this weight can be changed as you use the item.  Like you might cut down a log with 20 weight.  Craft a straight wooden pole and it turns into a 19 weight log.  Craft a canoe and it consumes all 20 weight because a canoe is big.  When you end up with that awkward bit of .3 weight log, you can burn it or compost is, which is probably how most items will get garbaged.  Metal items can obviously be re-smelted.  Stone items will likely just 'crumble to useless bits' when they reach a certain size.

I think I was going to talk about food and prepared meals too... but I lost my train of thought.  Anyways.  Items being unique as they're generated and as they're used.  Discuss.
Pages: 1 ... 3 4 [5] 6 7