FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

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 - Jim

Pages: [1] 2
1
Game creators corner / Re: An expanded fiferpg demo
« on: July 23, 2014, 10:17:12 am »
I've updated my expanded demo for fiferpg 0.2, and it now also has an (extremely) rudimentary phase based movement combat system in it. Basically, you start combat, select waypoints and execute the movement pattern by pressing end turn, until the timer runs out after which the "turn" ends.

get it here (same link):

https://app.box.com/s/h321hj7utxzk0e55glsr

As before, there's tons of stuff that could undoubtedly be done in a far more convenient way.

Here's a vid of it in glorious action

https://www.youtube.com/watch?v=4wnZravnCCM

2
Game creators corner / Re: Jim's problems
« on: July 06, 2014, 11:14:00 am »
Aaaaah, thanks so much!

3
Game creators corner / Re: Jim's problems
« on: July 06, 2014, 08:06:31 am »
Fife 3.5 and fiferpg 0.2. Just uninstalled and reinstalled both and the problem stays.

4
Game creators corner / Re: Jim's problems
« on: July 06, 2014, 04:54:28 am »
Sorry, but still can't figure out for the life of me what exactly I'd have to change in the last method to make it work.

Code: (demo's run.py) [Select]

import os
from fife import fife
from fife.extensions.fife_settings import Setting
from fife_rpg import GameSceneView
from fife_rpg import RPGApplication
from fife_rpg.game_scene import SimpleOutliner
from fife_rpg.components import ComponentManager
from fife_rpg.actions import ActionManager
from demo_game_scene import DemoController
from actions import PrintAction

TDS = Setting(app_name="rpg", settings_file="./settings.xml")
world = None
   
def create_entity_dictionary(entity):
    entity_dict = {}
    components_data = entity_dict["components"] = {}
    components = ComponentManager.get_components()
    for name, component in components.iteritems():
        component_values = getattr(entity, name)
        if component_values:
            component_data = None
            for field in component.saveable_fields:               
                if not component_data:
                    component_data = components_data[name] = {}               
                component_data[field] = getattr(component_values, field)
   
    return entity_dict


class DemoOutliner(SimpleOutliner):
   
    def get_data(self, world, identifier):
        if identifier == "PlayerCharacter":
            return (0, 0, 255, 1)
        else:
            return SimpleOutliner.get_data(self, world, identifier)
   
def main():
    global world
    PrintAction.register()
   
    app = RPGApplication(TDS)
    app.load_components("combined.yaml")
    app.register_components()
    app.load_actions("combined.yaml")
    app.register_actions()
    app.load_systems("combined.yaml")
    app.register_systems()
    app.load_behaviours("combined.yaml")
    app.register_behaviours();
    app.create_world()
    world = app.world
    view = GameSceneView(app)
    controller = DemoController(view, app, outliner=DemoOutliner())
    controller.listener.is_outlined = True
    controller.outliner.outline_ignore.append("PlayerCharacter")
    controller.outliner.outline_data = (173, 255, 47, 2)
    app.load_maps()
    world.read_object_db()
    world.import_agent_objects()
    world.load_and_create_entities()
    app.switch_map("Level1")
   
    script_system = getattr(world.systems, "scripting")
    statistic_system = world.systems.character_statistics
    statistic_system.load_statistics_from_file("statistics.yaml")
    player = app.current_map["PlayerCharacter"]
    player.CharacterStatistics.gender = "male"
    player.CharacterStatistics.primary_stats["ST"] = 75
    player.CharacterStatistics.primary_stats["CO"] = 60
    app.push_mode(controller)
    app.run()

Code: (rpg_application.py) [Select]
def switch_map(self, name):
        """Switches to the given map.

        Args:
            name: The name of the map
        """
        old_map = None
        if self.__current_map:
            old_map = self.__current_map.name
            self.__current_map.deactivate()
            self.__current_map = None
        if name is None:
            return
        if name in self.__maps:
            self.load_map(name)
            self.__current_map = self.maps[name]
            self.__current_map.activate()
            for callback in self.__map_switched_callbacks:
                callback(old_map, name)
        else:
            raise LookupError("The map with the name '%s' cannot be found"
                        % (name))

Code: (scriptingsystem.py) [Select]
    def on_map_switched(self, old_map, new_map):
        """Called when the application switches to a new map

        Arguments:

            old_map: The name of the old map

            new_map: The name of the new map
        """
        if GameVariables.registered_as:
            getattr(self.world.systems, GameVariables.registered_as).step(0)
        for script in self.__scripts.itervalues():
            if not "map_switched" in script.__dict__:
                continue
            script_globals = self.prepare_globals()
            script.__dict__.update(script_globals)
            script.map_switched(old_map, new_map)

5
Game creators corner / Re: Jim's problems
« on: July 05, 2014, 12:46:30 pm »
Hey Beliar, thought I'd try and update the demo to 0.2 after almost a year long hiatus, so if you're still up for answering my stupid questions that'd be great!

Code: [Select]
Traceback (most recent call last):
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo\run.py", line 100, in <module>
    main()
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo\run.py", line 70, in main
    app.switch_map("Level1")
  File "C:\Python27\lib\site-packages\fife_rpg\rpg_application.py", line 450, in switch_map
    callback(old_map, name)
TypeError: on_map_switched() takes exactly 1 argument (3 given)

The error you are getting is because i made some breaking changes in the last week, on_map_switched now should take two arguments, old_map and new_map, wich are the names of the old and new map.

This still has me completely stumped. If this is the case, then why is the error:

Code: [Select]
TypeError: on_map_switched() takes exactly 1 argument (3 given)
shouldn't 3 arguments given be the right amount given that:

Code: [Select]
on_map_switched(self, new_map, old_map)
The demo runs fine when I remove the last two arguments required by on_map_switched and the two provided by the callback in switch_map, so I haven't a clue what's going wrong.

6
Thanks man, I'll give it a try based on that thread of yours. Another release would be sweet, yeah, fitting too given that it's 4.0 now I think.

7
Hi, I've been trying for hours to build the latest version of fife, and so far no success. When I use mingw in combination with the April 2012 devkit, I get the same "fifechan.hpp no such file or directory" error as the guy in this thread, and if I use the November 2012 prerelease devkit I get an error I can't find anywhere on this forum:

Code: [Select]
C:\FIFE\build\win32\build_environments\scons>build_engine.bat
scons: Entering directory `C:\FIFE'
scons: Reading SConscript files ...
Checking for tinyxml (using pkg-config)...(cached) no
Checking for tinyxml (using tinyxml-config)... (cached) no
Checking for C++ library tinyxml... (cached) no
Warning: System version of tinyxml not found, using local version as fallback
Building RELEASE binaries...
scons: done reading SConscript files.
scons: Building targets ...
swig -o build\engine\release\swigwrappers\python\fifechan_wrap.cc -outdir "engin
e\python\fife" -Ibuild\engine\release\core -Iengine\core -python -c++ -w511 engi
ne\swigwrappers\python\fifechan.i
g++ -o build\engine\release\swigwrappers\python\py_fifechan_wrap.o -c -O2 -Wall
-Wno-unused -DTIXML_USE_STL -DNDEBUG -DHAVE_OPENGL -DHAVE_ZIP -DLOG_ENABLED -Ibu
ild\win32\includes\libogg -Ibuild\win32\includes\openal -Ibuild\win32\includes\s
dl_image -Ibuild\win32\includes\zlib -Ibuild\win32\includes\boost_1_47_0 -Ibuild
\win32\includes\libvorbis -Ibuild\win32\includes\libpng -Ibuild\win32\includes\s
dl_ttf -Ibuild\win32\includes\sdl -Ibuild\win32\includes\python27 -Ibuild\win32\
includes\unittest++\src -Ibuild\win32\includes\libfifechan -Iengine\core build\e
ngine\release\swigwrappers\python\fifechan_wrap.cc
build\engine\release\swigwrappers\python\fifechan_wrap.cc: In function 'PyObject
* _wrap_Widget_isSetVisible(PyObject*, PyObject*)':
build\engine\release\swigwrappers\python\fifechan_wrap.cc:6891:47: error: 'const
 class fcn::Widget' has no member named 'isSetVisible'
scons: *** [build\engine\release\swigwrappers\python\py_fifechan_wrap.o] Error 1

scons: building terminated because of errors.
15 File(s) copied

I tried adding all the includes and applications in the Environment PATH, but didn't do anything (most likely because I'm an idiot). Problem, like with most people seems to be fifechan in both cases, but I haven't a clue what to begin doing about it. Can anybody help me out?

I also tried building with vs9 and the april 2012 devkit but that didn't achieve much either.

8
Game creators corner / An expanded fiferpg demo
« on: August 17, 2013, 10:54:45 am »
The brilliant fiferpg pre-alpha comes with a demo that (by design) doesn't show off all its features from the get-go, so if you happen to be like me and prefer to have a demo to hold your hand while you're figuring out what you can do, this might be nice. Basically all it does is give examples of most (or at least some) of the stuff that's in fiferpg at the moment and makes it accessible through the pychan UI. So you can pick stuff up, read a description of said stuff, drop it, have a chat, check your character stats, watch a description of those stats, and more incredibly exciting things. In case you're interested you can download it here. I mostly just made it as an exercise for myself as I was (and am) getting to terms with python and fife, so there's probably a lot of easier ways to do many of these things.

In case you want to use it, you need the latest fiferpg release (0.1c) and these three commits updated: (1 2 3). If anyone expresses interest in it, I'll try and update when the next release comes along.

9
Game creators corner / Re: Jim's problems
« on: August 15, 2013, 10:06:37 am »
Got it to work! Thanks immeasurably for the help and patience. I was such an idiot for forgetting that updating to the latest fiferpg version would completely mess up the outdated demo.

Edit: incidentally, if somebody could also find the patience to help out with the non-fiferpg-related widget problem, then that'd be great as well of course.  ;)

Edit: Ah, think I finally figured it out. I should have gone with the Listbox dealio.

10
Game creators corner / Re: Jim's problems
« on: August 15, 2013, 08:12:41 am »
Hmmm... I must be doing something seriously wrong. I downloaded your version of the demo, which still had the same problem, so I thought I'd better just update to the latest version (downloading the batch, run setup.py). Then I got this error right off the bat:

Traceback (most recent call last):
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo\run.py", line 100, in <module>
    main()
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo\run.py", line 70, in main
    app.switch_map("Level1")
  File "C:\Python27\lib\site-packages\fife_rpg\rpg_application.py", line 450, in switch_map
    callback(old_map, name)
TypeError: on_map_switched() takes exactly 1 argument (3 given)

Then reinstalled, feeling I'd done the exact same thing, and now the error has changed (slightly) to:

Traceback (most recent call last):
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo1\run.py", line 266, in <module>
    main()
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo1\run.py", line 70, in main
    app.switch_map("Level1")
  File "C:\Python27\lib\site-packages\fife_rpg\rpg_application.py", line 446, in switch_map
    self.load_map(name)
  File "C:\Python27\lib\site-packages\fife_rpg\rpg_application.py", line 422, in load_map
    game_map = Map(fife_map, name, camera, regions, self)
TypeError: __init__() takes exactly 5 arguments (6 given)


Ugh. I'll just try reinstalling FIFE as a whole in a while (it isn't a problem that I'm using the latest regular FIFE release and not the source, right?).

11
Game creators corner / Re: Jim's problems
« on: August 15, 2013, 05:41:30 am »
Of course! Here it is. These are all the files I've changed/added (plus run.py and actions.py which I didn't change at all). Worked exactly like my own when I overwrote the original fiferpg demo with these files.

And yeah, I just updated that commit (I haven't updated any of the other ones since then).

12
Game creators corner / Re: Jim's problems
« on: August 14, 2013, 04:44:52 pm »
I'm back and ready to be annoying again!

So, two of the three problems I've had still completely elude me. Good news is I finally figured out how to do the fiferpg dialogue thing properly, though I'm admittedly not entirely sure whether it's an unnecessary workaround or not, because I'm still basically just using the keys in the dictionary and not the values. Works fine though, so I'm happy.

The pychan problem is still utterly baffling to me, no matter how many different approaches I try. Maybe I'll just ask it on irc at some point in case nobody responds (unless they're all purposely ignoring me of course). To rephrase the problem a bit: when you populate lists of dialogue options or inventory items or whatever, then you usually need to know which one the player clicked on. For some reason I can't figure out, this is seemingly only possible without carrying over any additional arguments. I.e., to use the way I did the dialogue thing as an example:

        for possible_response in dlg.possible_responses:
            response = pychan.widgets.Label(max_size=(200,1000),wrap_text=True)
            response.text = dlg.dialogue.sections["%s" % possible_response].text
            self.responsesbox.addChild( response )
            response.capture(self.respond)

This works fine, as long as you use a "generic widget" in the called function. But the moment you don't use this generic widget, and try to carry over any information (e.g. use "response.capture(lambda: self.respond(response))" then suddenly the event mapping goes all wrong and pychan can't tell anymore which label in the list you've clicked on (I think it automatically assumes it's the last one). Again, does anyone happen to know how to avoid this?

Quote
For your second question, I pushed a commit that fixes a bug where that would have been impossible.
You will have to set the "new_map", "new_position", and "new_layer" fields of the Agent component.
You could just use the "map", "position", and "layer" fields of the Player Agent component for these.

I still can't get it to work I'm afraid. When I do this (with your commit downloaded of course):

        thing.Agent.new_map = player.Agent.map
        thing.Agent.new_layer = player.Agent.layer
        thing.Agent.new_position = player.Agent.position

Then I get this error:

  Traceback (most recent call last):
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo\run.py", line 266, in <module> main()
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo\run.py", line 251, in main app.run()
  File "C:\Python27\lib\site-packages\fife\extensions\basicapplication.py", line 197, in run retval = self.mainLoop()
  File "C:\Python27\lib\site-packages\fife\extensions\basicapplication.py", line 222, in mainLoop  self._pump()
  File "C:\Python27\lib\site-packages\bGrease\grease_fife\mode.py", line 54, in _pump  self.pump(delta_time)
  File "C:\Python27\lib\site-packages\fife_rpg\rpg_application.py", line 833, in pump self.current_map.update_entitities_agent()
  File "C:\Python27\lib\site-packages\fife_rpg\map.py", line 209, in update_entitities_agent location = fifeagent.behaviour.location
  AttributeError: 'NoneType' object has no attribute 'location'

I tried some (probably stupid) workarounds of forcibly giving the Gold agent a behavior (with the idea of that giving him the error-inducing behavior.location as well), but that just resulted in nothing happening. No clue what's going wrong.


 

13
Game creators corner / Re: Jim's problems
« on: July 09, 2013, 10:40:52 am »
Thanks again! I've already gone over all your tutorials (they're very nice by the way, would be cool if fife had the same type of introductory tutorials), but I'll go over the dialogue one again when I get back from holidays. Like I said, it's probably that I just don't know yet how to handle dictionaries properly; I'll probably just have to go over some general Python tutorials again too.

14
Game creators corner / Re: Jim's problems
« on: July 08, 2013, 08:15:52 am »
Well, I've made my first version of the amazing fiferpg demo, "the enhanced edition". You can now pick up gold, open your inventory and see the gold in it, click on it to remove it from your inventory and open the chest and compare inventories with it in a friendly fashion. You can also have a short dialogue with David, though that's still a bit... odd. There's even a console where the descriptions of the "inspect" action neatly appear. Which brings me to the three things I've really not managed to figure out how to accomplish:

1: I found out how to make a list of labeled inventory items in pychan where if you click on a specific label, it removes it. But as far as I can tell, you can only do this using the generic widget like in the dynamic widgets demo. Because if you don't, then it's impossible to have it tell which label you've clicked (just that you've clicked some label). Now, the problem with this is that I've noticed that you can't carry over variables with this generic widget, i.e. you can do:

item.capture(self.drop) [with "item" being the label, and "drop" being the item removing function]

but you can't do:

item.capture(self.drop(entity)) or item.capture(lambda: self.drop(entity))

and still use the generic widget. While this isn't a problem with, say, dropping an item, it seems to make taking an item from one container to another impossible. Is there maybe another way to tell exactly which label is being "captured"?

2: A more fiferpg specific question: after removing the gold from the inventory I want it to appear on the ground; I'm sure I can create an instance of gold easily, but what I should actually be doing is create a gold entity instead, right? But how would I do that? I know there's a get_or_create_entity function, but that doesn't seem to do anything even when I do something like update_entities after that.

3: Another fiferpg specific question: I have no clue how to make it so that the possible responses of the dialogue appear as the responses themselves, rather than the keys of the dictionary, so in the dialogue I have now, the responses appear as "no_introduce" etc. I probably just don't understand dictionaries well enough, because I assumed the keys would "point" to the text itself, but instead they point to a certain address in the code, which I have no idea how to use.

Again, sorry if one/some/all of these questions is/are really stupid.

15
Game creators corner / Re: Jim's problems
« on: July 05, 2013, 04:35:54 am »
Thanks! I really should've noticed that from the other examples, sorry.

Pages: [1] 2