Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Shaggy

Pages: [1] 2 3 ... 5
1
Yeah, that was my plan was to do an oldschool-style 'text adventure'.  If a couple more people are interested, I'll start thinking about a small-setting story and see what I can do.

2
I really do like this idea. But right now I'm setting up on a new laptop, and I'm having trouble getting things running. Give me a day or two to get everything set up and I'll come back to the idea.

The main concern is it would require at least 3-5 people that wanted to play, and the 'updates' would have to conform to my work schedule.

3
Programming / Re: [Python] Splitting up source code
« on: November 24, 2012, 12:52:53 AM »
I downloaded head of master branch and played around a bit. Looks like a good start to me. I'm watching your repository at GitHub and will try to remember to check back when you have made more progress.

I enjoyed reading through the design document and wouldn't mind visiting the dungeon of blah ;)
Awesome, I'm glad to see someone taking some interest in the project! And yeah, a lot of the text in the design doc is placeholder stuff for ideas I haven't fully fleshed out quite yet. :p

I'm not really fond of using globals and try to avoid them as much as possible. But if you can keep track of what is changing what I guess that's just a personal preference.

Yeah, I've been having that problem a lot as I started splitting the source into multiple files.. I'm still very new to python, and when I started I was following a tutorial. So I've still got a lot to learn.

How would you suggest?

4
Programming / Re: [Python] Splitting up source code
« on: November 21, 2012, 11:39:14 PM »
Yeah, I know my source is going to grow, and I already am bothered by trying to find certain parts of code without Find searching for it  ::)

My main issue right now is the globals section apparently re-writing over certain values, like the player's (x,y) position.. Not sure why it's doing that, considering it checks the objects list first to see if there's already a player before it initializes one.. but now that I say that.. If it's writing over the player value, whos to say it isnt writing over the objects list and clearing it, which would mean there wouldn't be a player in the list.

Sorry, just thinking out loud a little. But that's the kind of issues I've been having. I've figured out how to get a workspace set up in N++ but I can't get the code to behave properly.

Also, I updated the github repo today if anyone is interested. There's a few known bugs, which are listed in readme.md. Take a look at how I split everything up, how its structured, or anything really. C&C would be awesome, just send me a PM.

https://github.com/MisterMoxxie/ItsStillInBeta

5
Programming / Re: [Python] Splitting up source code
« on: November 21, 2012, 10:41:43 AM »
The decision whether to split or not should generally be based on maintainability gain, not on file size.

This.

The same thing happens in Visual Studio, as well as in Eclipse, and I think it's more an ill design than a bug. Certainly it makes the outlining feature completely useless, at least for me. It may be worth a notice that Eclipse has a window titled "Outline" which does similar job, but much better; it allows you to easily navigate through classes / methods / variables / imported declarations that you have in a single file, so that file size does not really matter [that much] any more.

Well I just actually read about two other nice features that N++ has. The first is to be able to have multiple views open of the same file. Any changes made will still be present in all views, as it's the same instance of the file. The other is to place 'bookmarks' at any line of your code. Then, using simple keystrokes, you can move to the previous or next bookmark.

6
Programming / Re: [Python] Splitting up source code
« on: November 21, 2012, 08:50:51 AM »
Yeah, right now my code isn't too long, about 4-5k lines, but I know I'm going to want to split it up eventually, so why not do it now? But I'm getting strange errors and I feel like I'm doing something wrong. I'm getting close though. It's running without crashing now, but it's not creating the map or objects list correctly. We'll see what happens.

It's a good idea to split code into smaller pieces. They are more manageable, easier to understand and faster to navigate.

Your idea of splitting the code looks sound. src_Classes sounds like a module that might end up being quite big though and quite generic. What would it contain?

I took that out and added it to the bottom of src_Globals. It was just the base classes for everything in the game; Object, Fighter, Item, Equipment and Skillset. So in all actuality it wasn't that long.

I think what is important to understand is that while you can look at source organization as a code organization issue, in many ways it is just as much a tooling issue. What you may want to consider is changing (I hesitate to say 'improving' as that is quite subjective :) ) your tooling to reflect your growing codebase.

For example, some editors let you have multiple views of a file and some do not. Some editors allow for an outline mode that lets you organize the source in a way completely different than the way the source is actually saved in files.

That'd be very nice. I use notepad ++, and I like it a lot. It allows me to collapse classes and routines, which is helpful. Although when I open a file it automatically 'opens' all of the collapsed sections, so it's only useful for a short period.

Although now that I say that, I bet there's other options under the hood I could play with. Because when it comes down to it, it's just a personal desire for organization. Whether that is achieved via splitting up the source code, or just finding a tool to make it easier to read/follow, is another point.

7
Programming / [Python] Splitting up source code
« on: November 21, 2012, 02:31:53 AM »
So up until this point, I have been working all from one main.py source file. Now that my code is starting to grow, I've begun trying to split it into seperate code files. However, I've come to realize that this can be a bit of a hastle depending on how things are set up. I followed the code for the python + libtcod tutorial to start off, so there are still some references and such that I'm not 100% aware of.

That being said, how do you suggest splitting up code in a larger project? Currently, my source files are as follows; src_AI, src_Classes, src_DGen, src_Globals, src_Main, and src_Objects. I think that keeps everything separate without having too many source files.

(Also, if anyone is interested in helping, I could explain further the issues that I'm having right now with getting everything working.)

8
Programming / Re: Strange Display Errors
« on: November 19, 2012, 12:40:28 AM »
Did you changed the offset? Is it working now?

It's working, and I didn't need to change the offset. I just wasn't rendering it to the main console in the correct spot  ::)

9
Programming / Re: Trying to implement InfoFiles
« on: November 10, 2012, 12:14:39 PM »
Ahh, I gotcha. Well, it's getting closer to working. It's still returning a few strange errors, such as 'object has no value 'x'' in the following code. But it is recognizing it as a dictionary now rather than a list.

I need to check my rendering code. For some reason, it's drawing the map and items but not the creatures.
Edit :: Nevermind, it renders fine.

One other question I had. The tutorial features a function called 'send_to_back', which set the objects index in the old list to 0. This meant that it would be drawn first, so anything else on that tile would be drawn on top of it. (ie a monster is draw on top of an item). Is there any way to set the position of a specific key in the dictionary?


This is the code producing the 'object has no value x' error. But it seems to register the other values. (char/color for rendering, x,y positions, etc.)

Code: [Select]
...
Edit :: I tracked it down. It was caused by me doing things along the lines of objects[object.real_name] = None
How do I properly remove a key from a dictionary? I tried objects.remove(object.real_name) but it returned a NoMethod error

Ultimately, if your levels are small and contain few objects, then you can probably get away with the current method - but if you expect features like breeding monsters, cloning items, rooms full of treasure, or bosses with lots of minions, then it might be worth considering this alternative method.

Good to know. I think it should be ok for now, but if it ever becomes a problem I will have a solution in mind!

Felt like this would be a good spot to selflessly advertise for my development blog, and newly-opened github repository. If you'd like, you can take a look at how everything is structured. I basically followed the tutorial, and then just started branching off and tweaking/changing things. It's nothing exciting or innovating yet, but I'm still excited.

http://notquiteadom.blogspot.com/
https://github.com/MisterMoxxie/ItsStillInBeta

10
Programming / Re: Trying to implement InfoFiles
« on: November 10, 2012, 09:43:32 AM »
hmm. For some reason, python is thinking it's a list, not a dictionary. (Or at least thats what I get from the error " 'list' object has no attribute 'blocks'")

it's initialized with;
Code: [Select]
objects = {}
and the first value is assigned;
Code: [Select]
objects['player'] = [player]
Everything else is assigned just how you showed me. Sorry for bein such a newb :p Im still pretty new to Python, and Ive never used a dictionary before.


Though again, if this does what I think this does - takes a map location and searches every object in the game to find if there's an object blocking that tile, then I would suggest another solution. Iterating over every object in the game can be very expensive in all but the most simple games, so if you have a lot of objects it might be a good idea to have a mechanism of keeping track of which objects are contained in each location.

This doesnt iterate through every object in the game, just the objects on the current dungeon level. Not nearly as many.

11
Programming / Re: Trying to implement InfoFiles
« on: November 10, 2012, 01:02:44 AM »
That's pretty awesome. The only problem I'm having is figuring out how to iterate through the whole list. The old code was this; which isn't working now.

Code: [Select]
#now check for any blocking objects
    for object in objects:
        if object.blocks and object.x == x and object.y == y:
            return True

12
Programming / Re: Trying to implement InfoFiles
« on: November 08, 2012, 09:05:18 PM »
That sounds like a good approach. My only concern is scalability - what happens if you or a modder make a particularly large number of items and you need to search a list by name for an item?
The solution to that problem is either to sort the list by name and use binary search, or to put the items in a dictionary using names as keys.
I've never really used the dictionary/key setup before. How much faster would that make it?

Is Object.name always going to be unique? Allowing objects to have non-unique display names can give you a lot of flexibility to implement things like mimics, cursed items, secret doors, traps, etc. Not that any game necessarily has to have those things, but it would be smart to separate the display name from the name you search by, just in case.
[/quote]
That's a good point. I'll have to either give them an ID or a GAME_NAME and DISPLAY_NAME.

13
Programming / Re: Trying to implement InfoFiles
« on: November 07, 2012, 11:06:24 PM »
Yeah I think I'm going to do a sort of hybrid of those ideas :p My current solution is this;

I will have two seperate info files, one for Items and one for Fighters. The items file will be loaded first and checked for validation, before being added to an Objects list. Then the fighters file will be loaded. When assigning fighters equipment, it will look for items in the Objects list by name. If an item is not found, it will either assign no item to that equipment slot, or assign some sort of 'debugging' item to that slot.

The code will look something like this
Code: [Select]
def ReadItems(file):
    if file is None: return 'No File'
   
    filename = file + '.txt'
   
    fyle = open(filename)
   
    for lyne in fyle :
        # read the line
        # assign the variables
   
        if lyne == ITEM_END_LINE:
           
            #assign current variables to a new item
            #create the item object
            #add the item object to the Objects list
            #reset variables
   
    fyle.close()

def ReadFighters(file):
    if file is None: return 'No File'
   
    filename = file + '.txt'
   
    fyle = open(filename)
   
    for lyne in fyle :
        # read the line
        # assign the variables
       
        if equipment:
            for slots in equipment:
                object_ThisFighter.equipment = GetEquipment(lyne)
   
        if lyne == FIGHTER_END_LINE:
           
            #assign current variables to a new fighter
            #create the fighter object
            #add the fighter object to the Objects list
            #reset variables
   
    fyle.close()
   
def GetEquipment(Name):
    for Object in Objects:
        if Object.name == Name:
            return object
           
    return None #or return Object_ErrorObject
   
def Main():

    ReadItems('InfoFile')
    ReadFighters('InfoFile')
   
   

14
Programming / Trying to implement InfoFiles
« on: November 07, 2012, 09:39:10 PM »
Hello RogueTemple!

My current step in my project is to try and implement info files (ie text files) that allow for the creation of in-game objects that would then be placed throughout dungeons. For the most part, this is pretty straight forward. Decide a format for the info files, write a sort of line-by-line 'parser' for them, and assign the data.

Here's how my classes are set up right now.



However, the problem comes in when trying to assign data for the Equipment class. The equipment class references to other objects that have weapon or armor properties. So my issue is in trying to assign the data for them.

One way I could do it would be to have the info files formatted in a certain order. IE Items first, then Fighters. That way any references made to fighters equipment could be searched for in data that is already present.

I was just wondering if you guys had any suggestions or could think of any other way to do it?

15
Development Process & non-technical / Got time for a joke?
« on: November 06, 2012, 10:31:40 PM »
While writing the class that handles equipment, I ended up writing this function. First time in a while that I've written code that made me literally laugh out loud. I thought a few of you might enjoy that.

It is meant to return the name of whatever this person is wearing on their head.

Code: [Select]
   def GetHead(self):
        if self.ArmorHead:
            return self.owner.name
        else:
            return 'Nothing'

Edit :: Meant to post this in the other general board! Oops! Could someone move this for me? Thanks  ::)

Pages: [1] 2 3 ... 5