Re: [Ohrrpgce] New feature: Achievements

2021-11-18 Thread Mike Caron
> there are still lots more things that can be done after this is merged (you 
> didn't really list them so I will), including our own non-Steam display of 
> achievements, an editor, script commands (as an alternative to toggling 
> tags), and debug facilities.

Yes, you are correct. As it is right now, you have to manually construct the 
achievement lump to get it to work. I figured that this is the absolute minimum 
amount of work to make it viable to merge.

> but I did notice that Steam.run_frame still contains ACH_WIN_ONE_GAME test 
> code

Whoops!

> and a lot of commented out C++ that probably doesn't need to be there anymore

That was left on purpose, but I suppose it doesn’t really need to be there now 
that we’re sure the signatures are correct.

> and also run_frame is not really being called from the right place: it will 
> be called from 0 to 200 times a second depending on how much idle time is 
> available. Should it be called more often than whatever the game's framerate 
> (likely 18fps) is?

Really? I put it there since that’s when we invoke the graphics backend. Is 
there a better place to put it?

(I don’t think it needs to be called all that often, but this is the closest 
thing we have to a main loop, as far as I can tell)

--
Mike Caron

From: Ralph Versteegen<mailto:teeem...@gmail.com>
Sent: November 18, 2021 8:58
To: ohrrpgce<mailto:ohrrpgce@lists.motherhamster.org>
Subject: Re: [Ohrrpgce] New feature: Achievements

Great, at last!
I can't believe that I thought (long ago) that this would be a straightforward 
thing to add since it's "just" calling an external API... there are still lots 
more things that can be done after this is merged (you didn't really list them 
so I will), including our own non-Steam display of achievements, an editor, 
script commands (as an alternative to toggling tags), and debug facilities.

One thing it would be good to get other people's opinion on: there's currently 
a global flag to switch between permanent achievements (the only sort supported 
by Steam) or per-game/save ones. Would anyone ever want to mix the two? 
Consider that non-permanent ones won't be shown with the steam overlay.

I didn't have time tonight to look over and write comments on the code, but I 
did notice that Steam.run_frame still contains ACH_WIN_ONE_GAME test code, and 
a lot of commented out C++ that probably doesn't need to be there anymore, and 
also run_frame is not really being called from the right place: it will be 
called from 0 to 200 times a second depending on how much idle time is 
available. Should it be called more often than whatever the game's framerate 
(likely 18fps) is?

On Thu, 18 Nov 2021 at 18:35, Mike Caron 
mailto:caron.m...@outlook.com>> wrote:
Naturally, I forget to include a link to the Pull Request. I have been a 
professional for a decade now 

https://github.com/ohrrpgce/ohrrpgce/pull/1229

Mike Caron



From: Ohrrpgce 
mailto:ohrrpgce-boun...@lists.motherhamster.org>>
 on behalf of Mike Caron mailto:caron.m...@outlook.com>>
Sent: November 18, 2021 5:33 AM
To: ohrrpgce@lists.motherhamster.org<mailto:ohrrpgce@lists.motherhamster.org> 
mailto:ohrrpgce@lists.motherhamster.org>>
Subject: [Ohrrpgce] New feature: Achievements

Hello friends,

As I mentioned a few weeks ago, I was working on support for Steam achievements 
in the OHRRPGCE. Well, the fateful day has come when I think it's ready to 
release to the wild.

But, that said, I haven't contributed anything for a while, so I wanted to give 
you guys a chance to review my work before merging it in. So, I've opened up a 
Pull Request on GitHub and I would welcome any feedback that anyone would like 
to provide. Don't hold back! I can take it!

Cheers!

Mike Caron

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org<mailto:ohrrpgce@lists.motherhamster.org>
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] New feature: Achievements

2021-11-17 Thread Mike Caron
Naturally, I forget to include a link to the Pull Request. I have been a 
professional for a decade now 

https://github.com/ohrrpgce/ohrrpgce/pull/1229

Mike Caron



From: Ohrrpgce  on behalf of Mike 
Caron 
Sent: November 18, 2021 5:33 AM
To: ohrrpgce@lists.motherhamster.org 
Subject: [Ohrrpgce] New feature: Achievements

Hello friends,

As I mentioned a few weeks ago, I was working on support for Steam achievements 
in the OHRRPGCE. Well, the fateful day has come when I think it's ready to 
release to the wild.

But, that said, I haven't contributed anything for a while, so I wanted to give 
you guys a chance to review my work before merging it in. So, I've opened up a 
Pull Request on GitHub and I would welcome any feedback that anyone would like 
to provide. Don't hold back! I can take it!

Cheers!

Mike Caron

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


[Ohrrpgce] New feature: Achievements

2021-11-17 Thread Mike Caron
Hello friends,

As I mentioned a few weeks ago, I was working on support for Steam achievements 
in the OHRRPGCE. Well, the fateful day has come when I think it's ready to 
release to the wild.

But, that said, I haven't contributed anything for a while, so I wanted to give 
you guys a chance to review my work before merging it in. So, I've opened up a 
Pull Request on GitHub and I would welcome any feedback that anyone would like 
to provide. Don't hold back! I can take it!

Cheers!

Mike Caron

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Achievement implementations

2021-10-28 Thread Mike Caron
It definitely supports all those things, except for the automatic reward part. 
Unless I’m missing it in their documentation:

https://partner.steamgames.com/doc/features/achievements#4

These points in particular:

  *   For achievements that have progress bars use 
ISteamUserStats::IndicateAchievementProgress at significant points to show a 
pop-up with the progress. For instance, if you need 20 wins you may want to 
call this at 10 wins to show that the user has made it halfway.
  *   Whenever one or more achievements are unlocked, call 
ISteamUserStats::SetAchievement for each unlocked achievement and then 
ISteamUserStats::StoreStats to immediately upload them. Your game will see a 
ISteamUserStats::UserStatsStored_t callback, plus one 
ISteamUserStats::UserAchievementStored_t callback for each unlocked 
achievement. The Steam Game Overlay will display a notification panel to the 
user.

It does appear that you could use these stats to persist between saves, but we 
could do that already anyway, and I think a major goal is to be portable, even 
if the user doesn’t have Steam, so I think it makes more sense to keep track 
ourselves. If the stats are visible in Steam (which, if they are, then I’m not 
sure where), the we might want to try and sync them, but that’s a bigger deal, 
and maybe something we do later.

(Also hi Simon!)

--
Mike Caron

From: Simon Bradley<mailto:neworigi...@gmail.com>
Sent: October 28, 2021 12:01
To: ohrrpgce@lists.motherhamster.org<mailto:ohrrpgce@lists.motherhamster.org>
Subject: Re: [Ohrrpgce] Achievement implementations

I thought Steam had a system where you could update user statistics on Stream 
and it could automatically award achievements when they reach a specific value? 
I might be imagining that, or getting it confused with some other achievement 
system. I don't know if you'd need to save anything locally for cross-save 
counters, I think you could just increment a count on steam.

On Thu, 28 Oct 2021 at 15:08, Mike Caron 
mailto:caron.m...@outlook.com>> wrote:
​The tag_updates function is the place to put hooks for when a tag changes.
I assumed there might be a place like that. Thanks!

If achievements are displayed through steam, how does this work? You
can cause Steam to popup a progress notification with text of your
choice? Or does it have to be numerical, or predefined in Steam's
achievement editor?
​You can just tell it to display progress whenever you want, I believe. I was 
thinking that we would just do this whenever "value % interval == 0".

What about achievements that can be progressed towards in separate
saved games? The example you put on the wiki of finding all the ways
to die is one where progress needs to be shared rather than
save-specific.
​I was envisioning a game where these deaths were not 
game-over-and-reloading-your-last-save inducing, but I suppose that's not 
clear. I am not sure how we might want to handle cross-save achievements. Part 
of me wants to not handle it at all and let game creators do that themselves 
(if or when custom IO is a thing), but it also wouldn't be Too​ hard to add it 
now either. On the third hand, I suspect this is a rather more niche feature, 
so maybe we can just punt the issue down the road a bit.

Creating an editor for RELOAD-based data is not yet simple, but I'm
going to make a start on generalising the Purchases editor (most
likely) into a class for defining editable RELOAD trees.
Neat. I haven't actually looked too hard into what editors look like these days 
so I'm not sure how bad "not yet simple" is, but if there's anything I can do 
to help, please let me know.

Pleased that documentation already exists on the wiki, documenting
everything is a big task!
​If I had to pick one lesson that I've learned over the years, it's that 
documenting things first makes implementation easier. It's keeping that 
documentation up to date that is the challenge 


From: Ohrrpgce 
mailto:ohrrpgce-boun...@lists.motherhamster.org>>
 on behalf of Ralph Versteegen mailto:teeem...@gmail.com>>
Sent: October 28, 2021 6:24 AM
To: ohrrpgce 
mailto:ohrrpgce@lists.motherhamster.org>>
Subject: Re: [Ohrrpgce] Achievement implementations

This is going quick!

The permanent data storage you're looking for is
https://rpg.hamsterrepublic.com/ohrrpgce/Persist.reld

The tag_updates function is the place to put hooks for when a tag changes.

> A game may wish to expose the current progress at intervals ("defeat 100 
> goblins: 20/100") to motivate the player to continue progresing the 
> achievement.

If achievements are displayed through steam, how does this work? You
can cause Steam to popup a progress notification with text of your
choice? Or does it have to be numerical, or predefined in Steam's
achievement editor?

What about achievements that can be progressed towards in separate
saved games? The example you put on the wiki of finding all the way

Re: [Ohrrpgce] Achievement implementations

2021-10-28 Thread Mike Caron
​The tag_updates function is the place to put hooks for when a tag changes.
I assumed there might be a place like that. Thanks!

If achievements are displayed through steam, how does this work? You
can cause Steam to popup a progress notification with text of your
choice? Or does it have to be numerical, or predefined in Steam's
achievement editor?
​You can just tell it to display progress whenever you want, I believe. I was 
thinking that we would just do this whenever "value % interval == 0".

What about achievements that can be progressed towards in separate
saved games? The example you put on the wiki of finding all the ways
to die is one where progress needs to be shared rather than
save-specific.
​I was envisioning a game where these deaths were not 
game-over-and-reloading-your-last-save inducing, but I suppose that's not 
clear. I am not sure how we might want to handle cross-save achievements. Part 
of me wants to not handle it at all and let game creators do that themselves 
(if or when custom IO is a thing), but it also wouldn't be Too​ hard to add it 
now either. On the third hand, I suspect this is a rather more niche feature, 
so maybe we can just punt the issue down the road a bit.

Creating an editor for RELOAD-based data is not yet simple, but I'm
going to make a start on generalising the Purchases editor (most
likely) into a class for defining editable RELOAD trees.
Neat. I haven't actually looked too hard into what editors look like these days 
so I'm not sure how bad "not yet simple" is, but if there's anything I can do 
to help, please let me know.

Pleased that documentation already exists on the wiki, documenting
everything is a big task!
​If I had to pick one lesson that I've learned over the years, it's that 
documenting things first makes implementation easier. It's keeping that 
documentation up to date that is the challenge 


From: Ohrrpgce  on behalf of Ralph 
Versteegen 
Sent: October 28, 2021 6:24 AM
To: ohrrpgce 
Subject: Re: [Ohrrpgce] Achievement implementations

This is going quick!

The permanent data storage you're looking for is
https://rpg.hamsterrepublic.com/ohrrpgce/Persist.reld

The tag_updates function is the place to put hooks for when a tag changes.

> A game may wish to expose the current progress at intervals ("defeat 100 
> goblins: 20/100") to motivate the player to continue progresing the 
> achievement.

If achievements are displayed through steam, how does this work? You
can cause Steam to popup a progress notification with text of your
choice? Or does it have to be numerical, or predefined in Steam's
achievement editor?

What about achievements that can be progressed towards in separate
saved games? The example you put on the wiki of finding all the ways
to die is one where progress needs to be shared rather than
save-specific.

Creating an editor for RELOAD-based data is not yet simple, but I'm
going to make a start on generalising the Purchases editor (most
likely) into a class for defining editable RELOAD trees.

Pleased that documentation already exists on the wiki, documenting
everything is a big task!

On Thu, 28 Oct 2021 at 14:03, Mike Caron  wrote:
>
> Hello friends, sorry I’m late. Got sidetracked with a few things 
>
>
>
> As I’ve been discussing with TMC on the Slime Salad discord, I’m working on 
> adding achievements and Steamworks support to the OHRRPGCE. This is based on 
> a post TMC made here just about three years ago: 
> http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/2018-October/004308.html
>
>
>
> I’ve currently made progress on integrating Steamworks itself, thanks in no 
> small part to TMC helping me get my environment set up, and now I’m thinking 
> about how this stuff will work in the engine itself. I’ve been documenting 
> stuff on the wiki, and I would encourage everyone to take a peek and give any 
> feedback they have. Note that this page is not complete, and suggestions to 
> fill in blanks would be appreciated.
>
>
>
> https://rpg.hamsterrepublic.com/ohrrpgce/User:Pkmnfrk/Achievements
>
>
>
> I’m hopeful to get this implemented soon, so I can get back to my next 13 
> year hiatus.
>
>
>
> Cheers!
>
> --
>
> Mike Caron
>
>
>
> ___
> Ohrrpgce mailing list
> ohrrpgce@lists.motherhamster.org
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


[Ohrrpgce] Achievement implementations

2021-10-27 Thread Mike Caron
Hello friends, sorry I’m late. Got sidetracked with a few things 

As I’ve been discussing with TMC on the Slime Salad discord, I’m working on 
adding achievements and Steamworks support to the OHRRPGCE. This is based on a 
post TMC made here just about three years ago: 
http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/2018-October/004308.html

I’ve currently made progress on integrating Steamworks itself, thanks in no 
small part to TMC helping me get my environment set up, and now I’m thinking 
about how this stuff will work in the engine itself. I’ve been documenting 
stuff on the wiki, and I would encourage everyone to take a peek and give any 
feedback they have. Note that this page is not complete, and suggestions to 
fill in blanks would be appreciated.

https://rpg.hamsterrepublic.com/ohrrpgce/User:Pkmnfrk/Achievements

I’m hopeful to get this implemented soon, so I can get back to my next 13 year 
hiatus.

Cheers!
--
Mike Caron

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Mac app bundles build on Windows crash on Mac

2013-04-11 Thread Mike Caron
On Thu, Apr 11, 2013 at 6:03 AM, Ralph Versteegen teeem...@gmail.comwrote:

 Popped in to celebrate with us? :)


Perhaps!


  On 11 April 2013 13:44, James Paige b...@hamsterrepublic.com wrote:
  Hello, Mike!
 
  Actually, maybe we can avoid tar. I know we had reasons in the past, but
  they might have all evaporated by now. Originally I remember only
  wanting to use tools likely to be already installed on Linux/Mac, but
  Windows is the trouble-platform, and we have to bundle/download tools
  anyway. It is worth thinking over.

 I think the two reasons for using tar were to preserve executable file
 bits and to preserve symlinks. Funny enough, tar.exe doesn't do either
 properly.

 I looked through the commandline options that 7za supports and saw
 nothing for file attributes or symlinks. So we're seemingly still
 better off using tar.exe, at least for creating tars. Which maybe we
 don't want to do.


Wait, you're using a Windows binary to create an archive with symlinks and
permission bits on Windows? Where do you get the symlinks in the first
place?? If you're going to do that, you would need cygwin or something,
whose tar command is presumably not broken.



 Or, alternately the tar format doesn't seem that complicated. Maybe a
 highly specialized version is in order?
 
  These sound like the words of a man who hasn't read any tar file format
  docs... or maybe I should say those sound like the words *I* spoke
  before I had read any tar file format docs :)

 Yes, just look at what happened to tar.exe when it tried to read BSD
 tar files! This is an ancient file format seemingly with some weird
 quirks.


I realized, too late of course, that I forgot the ;) I meant to add. I
would never seriously advocate trying to re-implement a program with
such... let's call it legacy.

 ---
  James
 
  On Wed, Apr 10, 2013 at 08:22:24PM -0400, Mike Caron wrote:
 Hi guys, long time no see.
 Is there some reason you're still using tar? Wouldn't it be easier
 to just
 bundle 7zip or something? I understand that it supports tar.
 Probably a
 few other formats too. You can obtain the console version here.
 Or, alternately the tar format doesn't seem that complicated. Maybe a
 highly specialized version is in order?
 
 On Wed, Apr 10, 2013 at 1:29 PM, James Paige 
 b...@hamsterrepublic.com
 wrote:
 
   On Wed, Apr 10, 2013 at 09:52:23AM -0700, James Paige wrote:
I was almost finished releasing beelzebufo, when I was puzzled
 and
displayed to discover that Mac App game bundles build on Windows
 do
   not
work. If you build them on mac, they work fine.
   
Here is the crash message:
   
http://pastebin.com/jhu5H4b8
   
It looks like the problem has something to do with the SDL
 framework,
but I don't understand how this would fail on windows because
 there
   are
no more symlinks.
 
   dismayed not displayed
 
   I took the working app build on a Mac and compared it to the
 broken app
   built on Windows. I discovered that
 
  
 Contents/FrameWorks/SDL_mixer.framework/Versions/A/Frameworks/mikmod.framework
   is empty in the broken app.
 
   I tested tar.exe from the command line, and discovered that when it
   unpacks ohrrpgce-mac.minimal.tar it incorrectly unpacks several of
 the
   subfolders into the current directory, instead of where they belong
   under the OHRRPGCE-Game.app folder heirarchy.
 
   So the short answer is that this bug is, yet again, another
 instance of
   the windows port of tar.exe being a worthless piece of crap :(
   ---
   James
   ___
   Ohrrpgce mailing list
   ohrrpgce@lists.motherhamster.org
 
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
 
 --
 Mike Caron
 
  ___
  Ohrrpgce mailing list
  ohrrpgce@lists.motherhamster.org
  http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
 
  ___
  Ohrrpgce mailing list
  ohrrpgce@lists.motherhamster.org
  http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
 ___
 Ohrrpgce mailing list
 ohrrpgce@lists.motherhamster.org
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org




-- 
Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Mac app bundles build on Windows crash on Mac

2013-04-10 Thread Mike Caron
Hi guys, long time no see.

Is there some reason you're still using tar? Wouldn't it be easier to just
bundle 7zip or something? I understand that it supports tar. Probably a few
other formats too. You can obtain the console version
here.http://sourceforge.net/projects/sevenzip/files/7-Zip/9.20/7za920.zip/download

Or, alternately the tar
formathttp://en.wikipedia.org/wiki/Tar_(computing) doesn't
seem that complicated. Maybe a highly specialized version is in order?


On Wed, Apr 10, 2013 at 1:29 PM, James Paige b...@hamsterrepublic.comwrote:

 On Wed, Apr 10, 2013 at 09:52:23AM -0700, James Paige wrote:
  I was almost finished releasing beelzebufo, when I was puzzled and
  displayed to discover that Mac App game bundles build on Windows do not
  work. If you build them on mac, they work fine.
 
  Here is the crash message:
 
  http://pastebin.com/jhu5H4b8
 
  It looks like the problem has something to do with the SDL framework,
  but I don't understand how this would fail on windows because there are
  no more symlinks.

 dismayed not displayed

 I took the working app build on a Mac and compared it to the broken app
 built on Windows. I discovered that

 Contents/FrameWorks/SDL_mixer.framework/Versions/A/Frameworks/mikmod.framework
 is empty in the broken app.

 I tested tar.exe from the command line, and discovered that when it
 unpacks ohrrpgce-mac.minimal.tar it incorrectly unpacks several of the
 subfolders into the current directory, instead of where they belong
 under the OHRRPGCE-Game.app folder heirarchy.

 So the short answer is that this bug is, yet again, another instance of
 the windows port of tar.exe being a worthless piece of crap :(

 ---
 James
 ___
 Ohrrpgce mailing list
 ohrrpgce@lists.motherhamster.org
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org




-- 
Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/5386 Fix detection of absolute paths to allow unc paths to RPG files

2012-09-17 Thread Mike Caron
Building on this, you should add support for running games over ssh:

   game.exe mcaron@workpc:/home/mcaron/games/gamename.rpg

;)

On Mon, Sep 17, 2012 at 5:05 PM, James Paige b...@hamsterrepublic.com wrote:
 On Mon, Sep 17, 2012 at 02:02:34PM -0700, subvers...@hamsterrepublic.com 
 wrote:
 james
 2012-09-17 14:02:34 -0700 (Mon, 17 Sep 2012)
 64
 Fix detection of absolute paths to allow unc paths to RPG files

 You can now use the command line:

game.exe \\servername\sharename\foldername\gamename.rpg

 and it will just work. This should also fix double-clicking on rpg files
 located at unc paths.

 ---
 James
 ___
 Ohrrpgce mailing list
 ohrrpgce@lists.motherhamster.org
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



-- 
Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] npc copy count

2012-05-22 Thread Mike Caron
On Tue, May 22, 2012 at 1:39 PM, Ralph Versteegen teeem...@gmail.com wrote:
 On 23 May 2012 05:27, Adam Perry arpe...@gmail.com wrote:
 The documentation for this really needs to change. The description
 says that it returns the number of copies of an NPC, but the example
 script shows that it returns the number of copies minus one,

 No it doesn't, the example is wrong. For that matter part of a
 sentence is missing from the description and the rest is full of
 typos! No wonder you decided to trust the example instead. Seems the
 part sentence is my fault. I like to stop mid word and do som

Having npc copy count return the number of /copies/ (that is, all the
duplicates) would be silly. It would raise moral issues about which
NPC is the original, and whether the copies are actually NPCs at all.
I mean, do they have the same rights as the original? They share
palettes, appearance and behaviour, sure, but they can move
independently.

What measure is a copy NPC?

 which I
 believe is the correct behavior. I can never remember, though, and
 every time I look it up, I am disappointed anew.
 ___
 Ohrrpgce mailing list
 ohrrpgce@lists.motherhamster.org
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



-- 
Mike Caron
Tale of the Cave
http://taleotc.com
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/5135 Add Jay's suggested workaround for bug 956 Mangled graphics on startup

2012-04-28 Thread Mike Caron
 Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\

 Then I can type cl at the command line and see the usage, or cl -help
 and see the help screen.

 However, scons still says it can't find cl.exe

 ---
 James

 OK, I was wrong, cl.exe isn't meant to be in your path (delete all
 that). Instead, scons uses the VS90COMNTOOLS environmental variable to
 see that VS is installed, and where. I certainly didn't set this
 variable; it should have been added when VS was installed.

 On my system it's
 VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\

That environment variable is meant to be set by running the Microsoft
Visual Studio - Visual Studio Tools - Visual Studio Command
Prompt tool, which opens up cmd.exe, but with a bunch of extra stuff
set up to let you run the command line tools.

It's actually just a batch file that lives, on my system, at
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat

So, basically, you just need to run this batch file before running
scons, and you should be golden.


-- 
Mike Caron
Tale of the Cave
http://taleotc.com
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/5146 Prompt to download ar+tar+gzip the first time you try to distribute as a

2012-04-26 Thread Mike Caron
On Thu, Apr 26, 2012 at 6:55 PM, James Paige b...@hamsterrepublic.com wrote:
 On Thu, Apr 26, 2012 at 3:26 PM, James Paige b...@hamsterrepublic.com wrote:
 On Thu, Apr 26, 2012 at 03:17:47PM -0700, subvers...@hamsterrepublic.com 
 wrote:
 james
 2012-04-26 15:17:47 -0700 (Thu, 26 Apr 2012)
 210
 Prompt to download ar+tar+gzip the first time you try to distribute as a 
 debian linux package on Windows
 (I am reasonably confident that tar.exe and gzip.exe work standalone, but I 
 have my doubts about ar.exe)

 My reason for thinking so is that tar.exe and gzip.exe are both taken
 from UnxUtils which all seems to be designed with standalone usage in
 mind, but ar.exe is taken from MinGW, so I don't know yet whether it
 depends on any MinGW dll files, and if so, which ones.

 Okay! I figured it out. There were indeed three mingw .dll files that
 ar.exe required. Yay for Dependency Walker!

 I tested Export Debian Linux Package on a pristine Windows XP
 virtualbox, and it all seems to work great (aside from my previously
 mentioned file permission lamentations)

 I am almost feeling bold enough to tackle Export Mac OS X app bundle
 but I guess there isn't a whole lot of point to doing that one until
 we figure out a nightly build method for the Mac port.

 I was trying to get Mac OS X running in a virtualbox, but I ended up
 frustrated pretty quick :(

I would advise against further attempts at trying to get OSX running
in a VM. That way list the sort of madness that ends with trying to
summon an eldritch abomination an an attempt to cleanse the world of
people who would invent hardware locks.

Not fun for anyone involved.

-- 
Mike Caron
Tale of the Cave
http://taleotc.com
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Teach me some git

2012-04-18 Thread Mike Caron
The thing to remember about git is that it's all about branches. You
are always on a branch, usually called master (but that varies, of
course). So, I will use master as the branch name below.

To update your repo, you need to do this:

git fetch #pulls changes from origin
git merge origin/master #updates working copy

To commit changes, you just need to do this:

git add path/to/file   #adds a file
git add -u   #adds all changed files
git add -a   #adds all non-ignored files
git commit -m your message goes here

(obviously, pick whatever add command is most appropriate)

Lastly, to push your changes back to origin, just do this:

git push origin master

(if your branch is not up to date, you will need to refresh it as above)

That's all you need to know to get started. However, I strongly
suggest you learn git's branching mechanics, because they are really
powerful and really useful. At my work, we use a branch per
ticket/bugfix, and it works beautifully.

Sent from my iPad

On 2012-04-18, at 12:56 PM, James Paige b...@hamsterrepublic.com wrote:

 I figure if I am ever going to learn to use git, I need to learn how to
 replicate my existing svn usgae patterns with git. I have been told many
 times that git's functionality is a superset of svn's so this should be
 no problem.

 My trouble is that every tutorial I can find, even the ones that are
 supposedly intended for recent converts from svn seem to want me to jump
 right in to gits more advanced features, and discard my old workflows.

 I would much rather first get used to using git exactly thew same way I
 use svn, and then when I am confortable with that, I can start learning
 the new fancy things that make git special.

 I have two different workflows for svn repositories

 1) I have read only access, and I am not changing anything. All I want
 to do is keep my local copy up-to-date with upstream. With svn I just
 do:

  svn cleanup
  svn update

 in a cron job, and all is happy. However, I am not clear on how to do
 this in git. I assume it is simple, but I get confused when I search for
 git equivalent for svn update and every single search result tells me
 something different, and none of them are trying to do the uber-simple
 case that I care about anyway.

 2) Committing my local changes back to a remote server. This is what I
 would want to do if I was working on the ohrrpgce using git. I know I
 that local branches are a big deal with git, and that disconnected
 operation without an internet connection is a big deal with git, but for
 my purposes I want to treat a centralized repsitory on a server as the
 master, and use it to sync any assorted workstations I might happen to
 be sitting in front of at the moment.

 ---
 James, Curious
 ___
 Ohrrpgce mailing list
 ohrrpgce@lists.motherhamster.org
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Teach me some git

2012-04-18 Thread Mike Caron
Whoops, I am remiss, and forgot a few things:

 - origin is what is known as a remote. This might be a
colleague's computer, or it might be a central server (I only have
experience with the latter). By default, the remote is named origin.
So, when you're dealing with remote branches that live on origin,
they will be prefixed with origin/

 - a branch in your local repo (master) is independant of the branch
on origin (origin/master). This makes sense, because you can commit
to your local branch without affecting others, and vice-versa. But, it
was non-obvious for me.

 - because of this, when you update your local repo (git merge),
you're performing the exact same operation as merging a branch into
your branch (because you are). This includes nastiness like merge
conflicts, but also good things like updating history.

 - adding a file (git add) does not have the same semantics as it does
in subversion. Specifically, adding a file only marks it for staging.
That is, it says next time I commit, include this file. Already
existing files still need to be added when you want to commit their
changes. Conversely, if you don't want to commit certain files, you
can just not add them.

 - Other useful git commands:

git diff   #show uncommitted changes
git diff --cached  #show staged, but uncommitted changes (i.e., only
what you've added)
git blame path/to/file  #see who done what when
git log   #review older commits
git reset path/to/file  #un-add a file
git reset --hard  #nuke your changes from orbit (make everything clean again)


On Wed, Apr 18, 2012 at 2:00 PM, Mike Caron caron.m...@gmail.com wrote:
 The thing to remember about git is that it's all about branches. You
 are always on a branch, usually called master (but that varies, of
 course). So, I will use master as the branch name below.

 To update your repo, you need to do this:

 git fetch #pulls changes from origin
 git merge origin/master #updates working copy

 To commit changes, you just need to do this:

 git add path/to/file   #adds a file
 git add -u   #adds all changed files
 git add -a   #adds all non-ignored files
 git commit -m your message goes here

 (obviously, pick whatever add command is most appropriate)

 Lastly, to push your changes back to origin, just do this:

 git push origin master

 (if your branch is not up to date, you will need to refresh it as above)

 That's all you need to know to get started. However, I strongly
 suggest you learn git's branching mechanics, because they are really
 powerful and really useful. At my work, we use a branch per
 ticket/bugfix, and it works beautifully.

 Sent from my iPad

 On 2012-04-18, at 12:56 PM, James Paige b...@hamsterrepublic.com wrote:

 I figure if I am ever going to learn to use git, I need to learn how to
 replicate my existing svn usgae patterns with git. I have been told many
 times that git's functionality is a superset of svn's so this should be
 no problem.

 My trouble is that every tutorial I can find, even the ones that are
 supposedly intended for recent converts from svn seem to want me to jump
 right in to gits more advanced features, and discard my old workflows.

 I would much rather first get used to using git exactly thew same way I
 use svn, and then when I am confortable with that, I can start learning
 the new fancy things that make git special.

 I have two different workflows for svn repositories

 1) I have read only access, and I am not changing anything. All I want
 to do is keep my local copy up-to-date with upstream. With svn I just
 do:

  svn cleanup
  svn update

 in a cron job, and all is happy. However, I am not clear on how to do
 this in git. I assume it is simple, but I get confused when I search for
 git equivalent for svn update and every single search result tells me
 something different, and none of them are trying to do the uber-simple
 case that I care about anyway.

 2) Committing my local changes back to a remote server. This is what I
 would want to do if I was working on the ohrrpgce using git. I know I
 that local branches are a big deal with git, and that disconnected
 operation without an internet connection is a big deal with git, but for
 my purposes I want to treat a centralized repsitory on a server as the
 master, and use it to sync any assorted workstations I might happen to
 be sitting in front of at the moment.

 ---
 James, Curious
 ___
 Ohrrpgce mailing list
 ohrrpgce@lists.motherhamster.org
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



-- 
Mike Caron
Tale of the Cave
http://taleotc.com
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/5109 gfx_console, the curses-based graphics backend!

2012-03-23 Thread Mike Caron
When I clicked on this email, I was really expecting something like...
well, see the attachement ;)

On Fri, Mar 23, 2012 at 6:03 AM, Seth Hetu seth.h...@gmail.com wrote:
 Modern technology is amazing.
 --Seth


 On Fri, Mar 23, 2012 at 4:44 PM, Ralph Versteegen teeem...@gmail.com wrote:
 On 23 March 2012 21:27,  subvers...@hamsterrepublic.com wrote:
 teeemcee
 2012-03-23 01:27:38 -0700 (Fri, 23 Mar 2012)
 273
 gfx_console, the curses-based graphics backend!

 Only text is displayed.
 Keyboard support is pretty bad (Ctrl, Shift, and Alt ignored), no mouse or 
 joystick support.

 Also, using the -d option causes ?_debug.txt to be printed instead, at the 
 cost of display and user input.
 ---
 U   wip/SConscript
 U   wip/allmodex.bas
 U   wip/backends.bas
 U   wip/common.bas
 U   wip/common.bi
 U   wip/gfx.bi
 A   wip/gfx_console.bas
 U   wip/gfx_sdl.bas
 U   wip/ohrbuild.py

 Here are some samples:

 Editing a textbox!

 Return to Main Menu            + to copy
 Text Box 2              ALT+C copy style
 Edit Text
 Edit Conditionals
 Edit Choice
 Box Appearance
 Next: None Selected
 Text Search:
 Connected Boxes...
 Export text boxes...
 Import text boxes...

  Hello, World!


  Text input working nicely



 Here's me drawing some graphics!







                                Pal0









 Enemy (facing right)
 Tool:Draw            UNDO
 x=0 y=1      F ROAS MC  IE  ROTATE


 Playing autotest.rpg!

           Freki 10/10      SelfStab
           Helga 10/10      Item
            Olaf 10/10
          Frumpy 10/10







                 9
 ___
 Ohrrpgce mailing list
 ohrrpgce@lists.motherhamster.org
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
 ___
 Ohrrpgce mailing list
 ohrrpgce@lists.motherhamster.org
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



-- 
Mike Caron
Tale of the Cave
http://taleotc.com
attachment: soj.png___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Slice based menus

2012-02-21 Thread Mike Caron
On 2012-02-21, at 12:36 PM, James Paige b...@hamsterrepublic.com wrote:
 On Tue, Feb 21, 2012 at 07:47:06PM +1300, Ralph Versteegen wrote:
 On 21 February 2012 06:46, Jay Tennant hierand...@crazyleafgames.com wrote:
 From: James Paige b...@hamsterrepublic.com
 Sent: Monday, February 20, 2012 10:00 AM

 I have been reading this whole thread, and I have to admit, I am totally
 confused. I am not sure at all what you are working on. Would you mind
 explaining this project to me?

 ---
 James

 Of course. I'll explain the problem, goal, and implementation of
 this project.

 I'll chip in as well...

 1. Problem: the OHRRPGCE GUI lacks a uniform implementation

 I like the OHRRPGCE's interface, but it is difficult to upgrade
 it to be point-and-clickable. Additional monitoring would be
 necessary to capture the mouse coordinates and button presses.

 While that can be done for one menu, the lack of uniform
 implementation makes it troubling to monitor each menu. And
 if there was interest to adding more buttons later on,
 understanding context and rewriting the monitoring code
 could become daunting.

 It would be easier if the menu items were objects that could
 respond to operations performed on them--encapsulation. It
 would be easier if all menu objects interfaced the same way.
 It would be easier if there was a manager that uniformly
 passed messages to the appropriate menu objects that are the
 focus of the user's input.

 2. Goal: create a GUI system that brings uniformity and
 flexibility to the rendering, interfacing, and management of
 menu's in the engine.

 This is for the graphical menus in Custom, of which there aren't
 many currently: font, sprite, tile, and map editors. The others are
 just lists of menu items and aren't included in this.

 The map and sprite editors have lots of different widgets visible
 onscreen, and the code for them is a mess because we have these
 monolithic functions that handle everything instead of splitting
 things up.

 The map editor and sprite editor code is terrible because it is some of
 the oldest code in the engine, and because I knew nothing about good
 design when I wrote it :)

 There is nothing inherently difficult about creating a complex irregular
 screen layout that prevents the code from being well organized-- it just
 doesn't happen to be that way right now :)

 I love the idea of being able to add callbacks to slices. Consider the
 sprite editor. I like the idea of having button slices that run a
 callback if you click on them. They could also have a key shortcut
 callback so that the existing keyboard shortcuts for them could continue
 to work.

 I also like the idea of mouse-down and mouse-up callbacks for the sprite
 drawing area. I was originally thinking that we would just use a slice
 to specify the position where the drawing area is located on the screen,
 and hand-code the rest, but it would be much better if the slice could
 recieve mouse and keyboard events and pass them on to
 appropriate sprite-drawing handlers.

 This is a non-OS specific goal. Everything is rendered inside
 the engine, as it is now. The objective is to make widgets
 that are intuitive for users. It is a native implementation.

 native implementation? What does native mean anyway? I always
 thought it meant provided by/tightly dependent on the platform
 (OS/hardware).

 There was also another goal: look into whether it would be possible to
 abstract different GUI frameworks. Maybe we could draw widgets using
 either slices, or something like wxWidgets (which I was especially
 interested in, due to my gfx_wx attempt)

 A GUI manager can create, destroy, and pass messages to
 widgets. A widget can optionally process the messages, or
 delegate the message processing to another widget. All
 widgets have a message procedure.

 Functionally, this is very similar to Window's design.
 Messages generated by the GUI manager are added to a queue,
 then processed in the order they are added.

 Why queue messages instead of dispatching them immediately? So that
 widgets can peek ahead?

 3. Implementation: GuiManager, GuiObject, GUI_* messages,
 input synthesis, and rendering

 I've already been working on this since October of last year,
 though I stopped somewhere in late December (work, etc.). I
 developed a GuiManager object, which provides methods for
 sending and posting messages, changing focus, and synthesizing
 input to appropriate GuiObject's. A GuiObject is an implementation
 of a widget. I successfully created a Button and Text widget,
 and a custom widget to test the button and text on.

 Jay mentioned that he was working on a GUI framework written in C++;
 not directly OHR-related at the time, but I believe built on
 gfx_directx? I said that the OHR needed such a thing to clean up the
 map and sprite editors, so I'd like to see whether we could reuse any
 of his code.

 Jay's uses message passing instead of callbacks/methods like GTK+ and
 wxWidgets do (actually I think 

Re: [Ohrrpgce] Was anybody using websvn?

2011-11-15 Thread Mike Caron

On 15/11/2011 1:39 PM, Adam Perry wrote:



On Tue, Nov 15, 2011 at 10:31 AM, James Paige b...@hamsterrepublic.com
mailto:b...@hamsterrepublic.com wrote:

Was anybody using the websvn interface to the ohrrpgce repository on
gilgamesh? I only occasionally used it myself because it was nice to be
able to use the blame feature to figure out when a specific line was
last changed.


I use it occasionally. I don't suppose you can just disable blame?



Better yet, why not just add it to robots.txt so MSN bot doesn't even 
try to go there?


--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Was anybody using websvn?

2011-11-15 Thread Mike Caron

On 15/11/2011 1:58 PM, Ralph Versteegen wrote:

On 16 November 2011 07:42, James Paigeb...@hamsterrepublic.com  wrote:

On Tue, Nov 15, 2011 at 10:39:25AM -0800, Adam Perry wrote:

On Tue, Nov 15, 2011 at 10:31 AM, James Paigeb...@hamsterrepublic.com
wrote:

  Was anybody using the websvn interface to the ohrrpgce repository on
  gilgamesh? I only occasionally used it myself because it was nice to be
  able to use the blame feature to figure out when a specific line was
  last changed.

I use it occasionally. I don't suppose you can just disable blame?



But that is the best feature!

I updated my robots.txt file to tell msnbot to chill out, but it might
take a day or two before it re-fetches my robots.txt. After that, I will
re-enable websvn and hopefully it will be okay after that.

---
James


Doesn't the commandline svn tool have a blame feature? It's been so
long since I used SVN. Back when I used to, I used TortoiseSVN's blame
feature a lot and loved the GUI.

However, now that I use Git, I just read blames on the commandline.
The difference between blame in svn and in git is that building a
blame in svn used to take a minute, while in git it's milliseconds,
and there's a vast collection of options for tweaking it! And I find
the convenience of using a pager makes up for not using a GUI, so I
haven't even bothered looking for one.

I sometimes use websvn when I want to look at something in the games
or tools portions of the repository when on a machine where I don't
have those checked out.
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Warning: Not necessarily typical results.

We use git at work, and running a git blame command usually takes about 
10 seconds. Now, granted, we have lots of history, branches and 
altogether nastiness. I assume that runtime is directly proportional to:


1. How recently the oldest line was touched, and
2. How complex the history is between now and that point.

(Of course, adding a graphical tool on top won't speed any of that up, 
but that's beside the point)


--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/4729 linkgcc is now the default on Windows, and it now links libgcc_s, libstd

2011-09-05 Thread Mike Caron

On 05/09/2011 2:06 PM, Ralph Versteegen wrote:

(Also, I never realised that Mike created
music_native_subs.bas by porting MIDI code from SDL_Mixer to FB... I
plan to replace that with the original C (hopefully containing new
bugfixes))


I did what now?

On forever ago, music_native_subs.bas wrote:
 ' Many subs in this file are ported from SDL_Mixer (used under the GPL):
 ' /*
 ' native_midi:  Hardware Midi support for the SDL_mixer library
 ' Copyright (C) 2000,2001  Florian 'Proff' Schulze
 ' */
 '
 ' Ported to FreeBasic by Mike Caron

Oh. You know, I have absolutely no recollection of this. Why in the heck 
would I use SDL_mixer as a base?? I remember looking at allegro, but not 
SDL...


--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/4555 Timer triggers were NEVER being triggered inside battle

2011-07-07 Thread Mike Caron

On 7/7/2011 20:45, subvers...@hamsterrepublic.com wrote:

james
2011-07-07 17:45:37 -0700 (Thu, 07 Jul 2011)
779
Timer triggers were NEVER being triggered inside battle
(in spite of the fact that timers were always running in battle even if you 
didn't want them to be)

The only reason timers in battle actually got triggered
in random battles was because the timer code would get
re-called for one more tick after the battle ended.
I have no idea why this was happening for random battles
but not for fight formation battles.

Now timers that run out in battle call their trigger
immediately, it just wont execute until after battle
because scripts don't run in battle


Hmm, I don't remember exactly, but I think that at the time, that was 
not a viable solution (don't quote me on that).


I suspect that what I would have done would be to set an extra flag on 
the timer to indicate that hey, this timer expired at a time we 
couldn't execute scripts, please run me. This may be the one more 
time behaviour you were experiencing.


I suspect that this was still the case, but when you use fight 
formation, the script interpreter is not actually in a wait state. 
Thus, the timer script would not have an opportunity to run right then, 
and would subsequently be forgotten.


This theory may be jossed by the presence of after battle scripts, which 
I assume still run after fight formation battles.



I might possibly have broken instead-of-battle and
after-battle scripts by doing this... more tests coming
soon to verify that I didn't.

autotest.rpg now checks six different combinations of
timer/battle interactions.


I think the edge cases for this particular interaction would be:

1. Timer fires on same tick as battle
2. Timer fires during battle start (if there was any animation at the 
start of battle...)

3. Timer fires while waiting in battle
4. Timer fires while animating
5. Timer fires during victory dance
6. Timer fires tick after battle

And, of course, all that again with the timer aborts battle flag.


---
U   wip/game.bas
U   wip/testgame/autotest.hss
U   wip/testgame/autotest.rpg
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Strange bug in Wandering Hamster

2011-06-14 Thread Mike Caron

On 14/06/2011 4:10 PM, James Paige wrote:

On Mon, Jun 13, 2011 at 04:52:14PM -0500, Mike Caron wrote:

The other day, I fired up Wandering Hamster to check out the parallaxing
effect on Troll Mountain (very neat, incidentally). Afterwards, my party
was a bit beat up, so I went to the nearest inn, which was Broaste's
castle.


There was a bug in the parallax script that should have caused the world
map to be broken when you exited the mountain. I just fixed it today. I
have no idea how you avoided it.


Hmm, I may have gone to the inn first, and THEN the mountains. Actually, 
that's almost certainly the case. So, had I not simply exited from the 
mountain, then it would likely have triggered.



As soon as I entered the interior of the castle, however, the menu
beeping sound started looping continuously, and continued to play
forever, even when I went out side.


Is this repeatable? Can you get it to happen every time you visit that
map?


Yes. I tried it several times, and it happened every time. I did not try 
restarting the program, but I will try tonight.



I was able to make it stop by opening the real menu, and moving the
cursor a few times until I managed to preempt the sound.

I did not test any other interior maps, but since there is no such
distinction in the OHR, I doubt that means anything. It did not occur on
the World Map, the castle exterior or the mountain.

(incidentally, you should add a category to bugzilla for Wandering
Hamster and other official games)


I have a page on the Wiki for Wandering Hamster bugs... and I was about
to link to it when I saw you had already commented on it before, so i
guess you know where it is :)


This cannot have been any time in the last 3 years _

That said, I probably should have checked there first (though, how 
quickly would it have been spotted?)



I would rather not put non-engine game bugs on bugzilla. (although what
you describe does sound more like an engine bug)


Fair enough.


---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


[Ohrrpgce] Strange bug in Wandering Hamster

2011-06-13 Thread Mike Caron
The other day, I fired up Wandering Hamster to check out the parallaxing 
effect on Troll Mountain (very neat, incidentally). Afterwards, my party 
was a bit beat up, so I went to the nearest inn, which was Broaste's castle.


As soon as I entered the interior of the castle, however, the menu 
beeping sound started looping continuously, and continued to play 
forever, even when I went out side.


I was able to make it stop by opening the real menu, and moving the 
cursor a few times until I managed to preempt the sound.


I did not test any other interior maps, but since there is no such 
distinction in the OHR, I doubt that means anything. It did not occur on 
the World Map, the castle exterior or the mountain.


(incidentally, you should add a category to bugzilla for Wandering 
Hamster and other official games)

--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Pixel Shaders

2011-06-11 Thread Mike Caron

Ugh, why do these threads get so long. Selective quoting, go!

On 6/11/2011 1:22, Ralph Versteegen wrote:

Pixel shaders 101:

A pixel shader is a function applied to every pixel in a scene that can
modify pixels. Some of these can be done purely with pixel shaders
(bloom, colour inversion, etc), others need the assistance of vertex
shaders (outlines, glowing, etc).


Not to be ungrateful for the explanation... but a pixel shader is
something that can often be accomplished with just a pixel shader?
There are two completely different meanings of the word?


No no, let me rephrase:

A pixel shader is a function applied to every pixel in a scene that can 
modify pixels. **Certain effects are possible purely** with pixel 
shaders (bloom, colour inversion, etc), **while other effects require** 
the assistance of vertex **or other geometry shaders (outlines, glowing, 
etc).



What are the general thoughts on using shaders?


Well, they must be portable between different backends, but exact
result doesn't matter. It sounds like these would be all implemented
in a not-backend-specific way (unless a backend wanted to go the extra
mile to provide a D3D shader language implementation, I guess).


Or, just use the standard HLSL that compiles to both major chipset
shader implementations?


Didn't know there was such a thing: I've heard of HLSL but thought it
was just the D3D shader language.


Oh, you know what, my mistake. I had assumed for some reason that the 
schism between shader languages was between chipsets, and not APIs, and 
as a result, my quick glance completely parsed this line from wikipedia 
wrong:


Popular high-level shader languages include DirectX's HLSL and
OpenGL's GLSL, along with Cg, which can compile to both OpenGL and
DirectX shader instructions.

I am suitably embarrassed.


I think the most critical argument here (and the most restrictive)
is the shaders will exponentially increase rendering time. So it's
a feature that should be carefully considered by the user.


An abuse of the term exponential. Shader effects are always linear
time in the number of pixels, right? But probably want to stay away
from really slow effects, as these days the speed difference between a
brand new fast CPU and a slow one is more than an order of magnitude;
many people won't notice if they're doing something that kills
performance for other people.


To be perfectly pedantic, in modern cpus, the speed difference is almost 
completely irrelevant. Modern cpus are faster by incorporating multiple 
cores. Of course, if your software doesn't take advantage of that...


(The OHR does, but only in the backends. Eg, SDL and DirectX use threads 
internally. I don't know if or how the OHR would use threads in the 
front end.)



--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Pixel Shaders

2011-06-10 Thread Mike Caron

On 10/06/2011 2:21 AM, Ralph Versteegen wrote:

On 10 June 2011 17:31, Jay Tennanthierand...@crazyleafgames.com  wrote:

As most everyone is already familiar, a pixel shader is
a piece of code that calculates a color of a pixel on a
surface that is being drawn to.


Then I didn't know what a pixel shader is. I thought they were
programmable parts of GPU hardware pipelines, but apparently we're
talking about software here.


At what point did he say that a shader doesn't run on GPU?


The pixel shaders on the rasterizer right now are simply
pass-through shaders, doing no calculation besides
possibly sampling a texture.


So normal texture sampling counts as a pixel shader, but there's only
one such sampler currently. I don't know why you're pluralising.


There are many cool effects that can be achieved with
shaders, such as negative, blur, bloom, fire, water,
frosted glass, glow, etc.


I don't see how many of these fit your definition of pixel shaders, as
they seem to be functions for drawing something onto a surface, in a
possibly arbitrary shape (eg. a blurred triangle), rather than
calculating the colour of each pixel of a polygon. (OK, I'm just being
difficult.) What do you mean by fire and water effects?


Are you serious? I can't tell.

Pixel shaders 101:

A pixel shader is a function applied to every pixel in a scene that can 
modify pixels. Some of these can be done purely with pixel shaders 
(bloom, colour inversion, etc), others need the assistance of vertex 
shaders (outlines, glowing, etc).


By fire and water effects, I assume he's talking about wavy textures, 
like water and fire in many video games. Don't be obtuse.



Can you think of more effects?


Do the enemy dissolve effects count as shaders? They aren't
necessarily computed per-destination pixel, which I'm guessing is a
requirement. But anyway, there are many more enemy death/dissolve
effects I'd love to implement: some specifically for enemy death
animations, others more generally useful effects. Transparency,
tinting, and transformed quads are going to enable quite a few death
animations I had in mind. But I've also been thinking of a few
disintegration-type effects, like turning to dust from the top down or
bottom up, or being blown away by the wind, or splintering. It would
be a good idea to move the code for these out of allmodex.bas and into
a C file, because the melt effect for one is really expensive to
compute. In general, it seems it doesn't make sense to try to stick
effects like melt in the rasteriser, because they're not
rotation-invariant.

Sephy requested being able to use dissolve effects on sprite slices,
and I've been meaning to get around to implementing that.

So it sounds like you're proposing a generalisation of dissolve effects.


You could do this with pixel shaders, although I don't know exactly how. 
But, dissolve effects are hardly the only use for them, so I'm not sure 
why you would claim that.



What are the general thoughts on using shaders?


Well, they must be portable between different backends, but exact
result doesn't matter. It sounds like these would be all implemented
in a not-backend-specific way (unless a backend wanted to go the extra
mile to provide a D3D shader language implementation, I guess).


Or, just use the standard HLSL that compiles to both major chipset 
shader implementations?



I imagine that some of the effects you mentioned won't work well for
low resolution pixel art. If so, it might be a bad idea to provide
(and thus encourage people to use) such shaders rather than making
them draw the effects themselves better than an algorithm could hope
to accomplish.


This is perhaps the most critical thing you've said thus far.

Unless, of course, there was a way to specify that the shader should run 
on the target screen buffer, rather than on the source textures!


--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] how to force a gdb traceback?

2011-06-10 Thread Mike Caron

On 10/06/2011 1:18 PM, James Paige wrote:

I wondered if, for debugging purposes, there was an easy way to make gdb
stop and produce a trackeback on a particular line?

Back in the bad old days of ... some other language, don't even remember
which one now, I remember I would type 1/0 to force a devision by zero
error, that would give me a stack trace. That doesn't work here because
division by zero is a compile time error, not a runtime error.

Is there a nice elegant way to force a crash on a specific line? Right
now my workaround is this klunky bit of code:

   DIM foo(0) AS INTEGER
   DIM bar AS INTEGER
   bar = 1
   debug crash here  foo(bar)

---
James


Sub Crash()
dim as integer i = 0; 'this will almost certainly fool the compiler.
i = 1 / i
End Sub

Crash() 'boom

--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] The parallax problem

2011-06-07 Thread Mike Caron

On 6/7/2011 19:49, Ralph Versteegen wrote:

On 8 June 2011 07:34, Mike Caroncaron.m...@gmail.com  wrote:

On 07/06/2011 10:44 AM, James Paige wrote:


Well, solved in the sense that I can add six more rows and 10 more
columns to my background layer and it will look okay, but I still really
want to understand the math needed to make the parallax work with the
1/3 size layer, since that is the same math that will be required when
parallax scrolling is a built-in feature on different-sized map layers
in the future.


I meant solved in the sense that Mike (Willis) already gave the
formula for that.


First, let us suppose a few things:

MapWidth := 3000
LayerWidth := 1000
ScreenWidth := 320

You want the layer to butt up against the left side of the map when the
camera is at X = 0, and to butt up against the right side of the map when
the camera is as X = (MapWidth - ScreenWidth).

When on the left side of the map, the camera's X, the map's X and the
layer's X are all 0. This case is easy.

On the right side of the map, however, it's not so easy. The camera stop at
2680 (MapWidth - ScreenWidth), while the layer needs to stop at 2000
(MapWidth - LayerWidth).


You mean the layer needs to stop at LayerWidth - ScreenWidth = 680.
You get marks for correcting working-through, but this makes the rest
of your post wrong.


Huh? If the layer stops at 680, that means its right edge is at 1680, 
which puts it squarely off the screen. I thought the idea was to have 
the right edge stop at 3000, like the other right edges.



To get a smooth interpolation, you simply need to map the camera's X%
(defined as CameraX / (MapWidth - ScreenWidth)) to the layer's X% (defined
as LayerX / (MapWidth - LayerWidth)).

This formula is most easily expressed as:

LayerX = (CameraX / (MapWidth - ScreenWidth)) * (MapWidth - LayerWidth)


Correction (what msw already said):
LayerX = (CameraX / (MapWidth - ScreenWidth)) * (LayerWidth - ScreenWidth)


We know that when the CameraX% is 50% (1340), the LayerX should be at 1000.
Let's verify that:

LayerX = (1340 / (3000 - 320)) * (3000 - 1000)
LayerX = (1340 / 2680) * 2000
LayerX = 0.5 * 2000
LayerX = 1000

I can't seem to find the original email in which I presume you listed the
script, but if you plug that formula in, it should work.

--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] The parallax problem

2011-06-07 Thread Mike Caron

On 6/7/2011 20:46, James Paige wrote:

On Wed, Jun 08, 2011 at 12:43:12PM +1200, Ralph Versteegen wrote:

On 8 June 2011 11:52, Mike Caroncaron.m...@gmail.com  wrote:

On 6/7/2011 19:49, Ralph Versteegen wrote:


On 8 June 2011 07:34, Mike Caroncaron.m...@gmail.comwrote:


On 07/06/2011 10:44 AM, James Paige wrote:


Well, solved in the sense that I can add six more rows and 10 more
columns to my background layer and it will look okay, but I still really
want to understand the math needed to make the parallax work with the
1/3 size layer, since that is the same math that will be required when
parallax scrolling is a built-in feature on different-sized map layers
in the future.


I meant solved in the sense that Mike (Willis) already gave the
formula for that.


First, let us suppose a few things:

MapWidth := 3000
LayerWidth := 1000
ScreenWidth := 320

You want the layer to butt up against the left side of the map when the
camera is at X = 0, and to butt up against the right side of the map when
the camera is as X = (MapWidth - ScreenWidth).

When on the left side of the map, the camera's X, the map's X and the
layer's X are all 0. This case is easy.

On the right side of the map, however, it's not so easy. The camera stop
at
2680 (MapWidth - ScreenWidth), while the layer needs to stop at 2000
(MapWidth - LayerWidth).


You mean the layer needs to stop at LayerWidth - ScreenWidth = 680.
You get marks for correcting working-through, but this makes the rest
of your post wrong.


Huh? If the layer stops at 680, that means its right edge is at 1680, which
puts it squarely off the screen. I thought the idea was to have the right
edge stop at 3000, like the other right edges.


It looks like we were talking about completely different things: I was
talking about the camera position on the parallax map layer, and you
about the offset of the parallax map layer to the map root slice.


Either way, I am still completely confused. My attempt to use Mike's
suggested formula resulted in the parallax layer being correctly placed
at the bottom and right edges of the map, and being at 0,0 for
all other camera positions :(

set slice x(sl, (camera pixel x / (mapw -- screenw)) * (mapw -- layerw))
set slice y(sl, (camera pixel y / (maph -- screenh)) * (maph -- layerh))


Hmm, this is a thing that I didn't think about until just now.

At which points does the script engine round off decimals? You may need 
to add a few (x * 10) and (y / 10)s in there...



---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: jay/4381 Getting it closer to actually working (doesn't crash anymore, but it isn

2011-06-03 Thread Mike Caron

On 03/06/2011 2:34 PM, Jay Tennant wrote:

From: Ralph Versteegenteeem...@gmail.com
Sent: Friday, June 03, 2011 11:47 AM

On 3 June 2011 06:00, Jay Tennanthierand...@crazyleafgames.com  wrote:

From: subvers...@hamsterrepublic.com
Sent: Thursday, June 02, 2011 12:45 PM
To: ohrrpgce@lists.motherhamster.org
Subject: [Ohrrpgce] SVN: jay/4381 Getting it closer to actually working 
(doesn't crash anymore, but it isn

jay
2011-06-02 10:45:09 -0700 (Thu, 02 Jun 2011)
94
Getting it closer to actually working (doesn't crash anymore, but it isn't 
drawing right yet).


Oh, it's drawing *mostly* correct. That's encouraging! :)


Sounds good! So do you have a test program? Actually, I'll add a
function to allmodex.bas to draw transformed rects, and can stick a
test of it in the 'secret_menu' in custom.


I'm running a test program of it right now, but it's so disappointing: the
overflow problem. If I have a fixed point number divided by a very small
fraction (say 1/65536th) I get a terribly inaccurate number. I don't want
to switch to floating point, but I don't think I have much choice. Is there
a solution to this that I'm not getting?

Where the issue arises: the rasterizer evaluates a surface to be drawn to
one line at a time. The first pass is simply to figure what range of pixels
on each line is to be evaluated. The second pass (after all line's pixel
ranges are figured) is to interpolate the edge values across the line for
each pixel. The error is occurring during the first pass, in figuring the
left-most and right-most boundary of a line of pixels to be rasterized.

For each line, I take the slope of the edges of the triangle and find all
x-intercepts. The left-most intercept and the right-most intercept
(as long as they're within range of the triangle) are the boundaries of
the pixels.

I realize they're some optimizations I could perform (like calculating the
edge slopes once), but the error occurs when an edge is almost completely
vertical. The fixed point integer can't represent +/- infinite, so an
overflow/underflow occurs in determining slope (dy / almost 0).

I think the solution is using floating point math for this section. Can
you think of another solution? Other than that, the rasterizer's working
pretty nicely. I'll commit the code when I'm able to.


Does you algorithm allow for swapping axes? Eg,

if(dy  dx) {
//swap values, and flip the result turn-ways
}

I don't know if this is possible in your case, however.


--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Proposals: Vector and Matrix math, Per-vertex computations

2011-05-30 Thread Mike Caron
 can rotate an object, what stops you from rotating a
  clipping rect? I guess that's more or less like a mask.

 I thought you said that DirectX could only clip to a non-rotated
 rectangle on the render surface? That's what I was referring to.

 Ah, I see. It is possible to clip other shaped objects using
 another surface as the clip mask. I don't have time to think
 about it right now, though.

It's not possible to clip a rotated object, then obviously you just
need to clip first, THEN rotate!

   Frames, which need to be changed to Surface's and Frame views, will 
   need new surface interfaces to access from the backend. The 
   Plan_for_gfx_directx, sketched interfaces, listed a suggested set. To 
   write those into loading, termination, copying, updating, and other 
   calls, I estimate about 15-25 hours.
  
   Implementing the backends will take about 10 hours each. I think the 
   first goal should be the SDL backend, and I'd like it in C/C++. OpenGL 
   will be used to accelerate the rendering.
 
  Would like to stress again that we should retrofit the existing
  backends... or actually, probably just gfx_sdl, I'm not sure anyone
  actually uses gfx_fb or gfx_alleg. Speaking of which, would it be
  possible to get download stats of the alternative backend nightlies?
 
  It'd be fine to do that, but it's also very easy to convert it to c/c++.
  I guess it's just my preference, but it doesn't need to be c/c++.
  However, I could guarantee I'd get OpenGL working in c/c++, can't say
  the same for fb.

 I was thinking about retrofitting gfx_fb/gfx_sdl without using OpenGL,
 keeping them very close to their current state, meaning their
 behaviour is unlikely to change. If you switch them to OpenGL, they'll
 surely start behaving different for some people -- I wanted gfx_sdl
 around as a backup for people with OpenGL problems. By all means,
 write the new SDL 1.3 backend in C++.

 Actually, using external libraries from FB is problematic, because you
 have to use headers that have been translated from C to FB either
 automatically or by hand. Often there are differences (macros missing,
 type names changed), or the headers are out of date (SDL_mixer.bi for
 example), and the system headers in particular are terrible because
 they're system specific (and anyway the translation is mostly broken).



 ___
 Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting
              http://www.doteasy.com
 ___
 Ohrrpgce mailing list
 ohrrpgce@lists.motherhamster.org
 http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org




-- 
Mike Caron
Tale of the Cave
http://taleotc.com
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] 16-color Palette manipulation with scripts

2011-05-27 Thread Mike Caron

On 5/27/2011 20:20, David Gowers (kampu) wrote:

On Sat, May 28, 2011 at 1:17 AM, James Paige b...@hamsterrepublic.com
mailto:b...@hamsterrepublic.com wrote:


This makes a lot of sense to me now. I wrote up a summary of it here:
http://rpg.hamsterrepublic.com/ohrrpgce/Types_of_Palettes


There are four types of palettes.. (describes three)

Are you trying to make a Monty Python reference? ;) 'Type four, there IS
NO type four..'


First thou shalt take out the holy colours, then thou shalt count to 
three, no more, no less. Three is the palette thou shalt count, and the 
number of thy palettes shall be three. Four thou shalt not count, 
neither count thou two, excepting that thou then proceed to three. Five 
is right out. Once the palette three, being the third palette, be 
reached, then lobbest thou thy Master palette towards thy game, which, 
being made of sprites and such, shall be coloured.

--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] 16-color Palette manipulation with scripts

2011-05-26 Thread Mike Caron
On Thu, May 26, 2011 at 12:47 PM, Jay Tennant
hierand...@crazyleafgames.com wrote:
 From: Ralph Versteegen teeem...@gmail.com
 Sent: Thursday, May 26, 2011 11:32 AM

  My concern here, is what kind of problems a feature like this could
  cause in the future?

 Actually, wait, I'm not sure that a change to a pallete should affect
 all other sprites. I think it makes sense to only allow changing the
 palette for a single sprite (slice): use copy-on-write.

 Wait, what? Create a new 16-color palette just for one sprite? I think a
 16-color palette change should affect all objects that use the 16-color
 palette.

  We already have to keep supporting 16 color palette changes on sprites,
  even when 256 color sprites are enabled in the future--

 I wouldn't want to treat them separately at all.

 Neither would I, but one is like a pointer, and the other is a pointer to a
 pointer. The 16-color will have to be dereferenced to its 256-color palette.
 I haven't heard a complete solution to the 16-to-256 palette problem yet,
 nor have I solved it.

Don't use indices, but use actual colours instead?

set pal color ( 123, make rgb(255, 0, 0))

-- 
Mike Caron
Tale of the Cave
http://taleotc.com
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] 16-color Palette manipulation with scripts

2011-05-26 Thread Mike Caron
On Thu, May 26, 2011 at 1:01 PM, Jay Tennant
hierand...@crazyleafgames.com wrote:
We already have to keep supporting 16 color palette changes on 
sprites,
even when 256 color sprites are enabled in the future--
  
   I wouldn't want to treat them separately at all.
  
   Neither would I, but one is like a pointer, and the other is a pointer 
   to a
   pointer. The 16-color will have to be dereferenced to its 256-color 
   palette.
   I haven't heard a complete solution to the 16-to-256 palette problem yet,
   nor have I solved it.
 
  Don't use indices, but use actual colours instead?
 
  set pal color ( 123, make rgb(255, 0, 0))

 Yes, but with any changes to the master palette, all the 16-color palettes
 will have to be changed as well. So the distinction between a master 
 (256-color)
 palette and a 16-color is still there.

 Wait a second... are master palettes ever altered during runtime?

Anytime there's a fade, for example.

However, I wasn't suggesting changing 16-colour palette to use 24-bit
colours, I meant having the set pal color command look up the colour
in the master palette, and using that.

Of course, if you change Red to Blue because the party switched sides
or something, this would still break.

I guess the other alternative is to let 256-colour sprites use
256-colour palettes, which index into the master palette.

(There is no problem that can't be solved by adding another level of
indirection ;)


-- 
Mike Caron
Tale of the Cave
http://taleotc.com
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] No, THIS is how Parallax should work

2011-05-24 Thread Mike Caron
On Tue, May 24, 2011 at 12:46 PM, James Paige b...@hamsterrepublic.com wrote:
 On Tue, May 24, 2011 at 01:06:26AM -0400, Mike Caron wrote:
 On 5/24/2011 0:21, James Paige wrote:
 Okay, so eventually, it would be cool if we could allow certain map
 layers to have a size that is different than the map size, and they
 would automatically parallax scroll.

 Completely implementing that will be pretty tricky, because of the map
 file format changes that would have to be implemented, and the
 complexity of making the map editor handle layers of different sizes.

 However, on the map display side of things in game, the implementation
 would actually be pretty simple and straightforward.

 The plotscript interface for parallaxing map layer 0 could be as simple
 as:

    parallax map layer(layer number, width, height)

 And the rest could happen internally through fairly simple magic.

 This would assume that the layer you want to parallax has tiles only in
 the upper left width x height tiles, and that tiles outside that range
 wouldn't show up through normal scrolling.

 Of course this wouldn't automatically handle wrapping... actually I am
 not sure what to think about parallax on a wrapping map...

 The way I see it, there are two kinds of parallaxing effects one might
 want to use:

 1. The treetop kind. The parallaxing layers (hence forth, the
 paralayer) are relatively small, but tile to fill up the screen. Some
 times, they have a constant movement vector (clouds), sometimes they
 scroll with the camera (leaves), sometimes they do both (rain). However,
 in all cases, they don't need more than a screen's worth of graphics.

 Wrapping is irrelevant, as the paralayer's location is not tied the
 camera's location.

 Ah, interesting. I had only been thinking of type 2, I had neglected
 thinking about type 1.

 2. The scenic background kind. The paralayer never scrolls
 automatically, and always scrolls at a fixed multiplier to the camera
 speed. This is when the graphics on the paralayer are supposed to
 correspond to graphics on other layers. A classic example is a cliff
 with a castle or something in the background that only reveals itself
 when the camera pans up.

 The size of the paralayer is directly proportional to the movement speed
 multiplier. If the paralayer moves twice as fast as the camera, then it
 needs to be twice as big (along each axis).

 I was thinking you would only specify the size of the paralayer, and
 then it would automatically figure out the correct movement speed... but
 this would only work for a background layer that is smaller than the map
 size. It would not work for a foreground layer that is smaller than the
 map size, like the type 1 forest layer you described above.

Type 1 isn't necessarily foreground. A Link to the Past, for example,
uses such a layer on Death Mountain in the Dark World to do lavafloes
in certain places by having the lava in the background scroll, and
having rocks and such in the foreground with transparent areas, making
it look like the lava is coming from the rocks.

The defining feature of Type 1 is that it doesn't really have a size
-- for all intents and purposes, it's unbounded.

Anyway, as long as you allow for speeds  1.0, then there shouldn't be
a problem supporting layers of any size:

Consider a base map of size 64x64. A paralayer of this size will have
a scroll factor of 1. Now, consider a paralayer that's 32x32. This
layer will scroll at a speed of 0.5 (slower). A third paralayer,
128x128, would scroll at a speed of 2 (faster).

Essentially, as long as the layers scroll such that each edge lines up
when the camera is 1/2 screen distance away from that side of the map,
it should be okay.

 Wrapping can be handled the same way as normal map wrapping, but the
 game maker needs to ensure that it wraps properly (just like with any
 other map layer).

 Yeah... that seems sensible. I think the map drawing code would already
 be capable of drawing some layers wrapping even if the rest of the map
 was not wrapping.

 --

 While I think that it would be possible to unify the two kinds, I wonder
 if it is necessary? I remember way back (circa 2006ish) having a
 discussion about the first kind of parallaxing, using Backdrops as the
 graphics. I guess that it would be pretty easy to simulate it with a
 slice and some scripting, so I guess we can ignore it.

 The second kind would be a bit more difficult, so it should definitely
 get engine support.

 I don't think that the editor should need to support editing multiple
 layer sizes: It would get very messy and confusing (for everyone
 involved) if two layers were not tile-aligned, for example.

 I was thinking the editor could just align itself with the layer you
 were currently working on.

Right, but if the scroll factor is not a whole number, then the layers
will not be tile aligned, creating confusion (especially since the map
editor does not scroll smoothly!)

 Instead, editing a paralayer should

Re: [Ohrrpgce] No, THIS is how Parallax should work

2011-05-23 Thread Mike Caron

On 5/24/2011 0:21, James Paige wrote:

Okay, so eventually, it would be cool if we could allow certain map
layers to have a size that is different than the map size, and they
would automatically parallax scroll.

Completely implementing that will be pretty tricky, because of the map
file format changes that would have to be implemented, and the
complexity of making the map editor handle layers of different sizes.

However, on the map display side of things in game, the implementation
would actually be pretty simple and straightforward.

The plotscript interface for parallaxing map layer 0 could be as simple
as:

   parallax map layer(layer number, width, height)

And the rest could happen internally through fairly simple magic.

This would assume that the layer you want to parallax has tiles only in
the upper left width x height tiles, and that tiles outside that range
wouldn't show up through normal scrolling.

Of course this wouldn't automatically handle wrapping... actually I am
not sure what to think about parallax on a wrapping map...


The way I see it, there are two kinds of parallaxing effects one might 
want to use:


1. The treetop kind. The parallaxing layers (hence forth, the 
paralayer) are relatively small, but tile to fill up the screen. Some 
times, they have a constant movement vector (clouds), sometimes they 
scroll with the camera (leaves), sometimes they do both (rain). However, 
in all cases, they don't need more than a screen's worth of graphics.


Wrapping is irrelevant, as the paralayer's location is not tied the 
camera's location.


2. The scenic background kind. The paralayer never scrolls 
automatically, and always scrolls at a fixed multiplier to the camera 
speed. This is when the graphics on the paralayer are supposed to 
correspond to graphics on other layers. A classic example is a cliff 
with a castle or something in the background that only reveals itself 
when the camera pans up.


The size of the paralayer is directly proportional to the movement speed 
multiplier. If the paralayer moves twice as fast as the camera, then it 
needs to be twice as big (along each axis).


Wrapping can be handled the same way as normal map wrapping, but the 
game maker needs to ensure that it wraps properly (just like with any 
other map layer).


--

While I think that it would be possible to unify the two kinds, I wonder 
if it is necessary? I remember way back (circa 2006ish) having a 
discussion about the first kind of parallaxing, using Backdrops as the 
graphics. I guess that it would be pretty easy to simulate it with a 
slice and some scripting, so I guess we can ignore it.


The second kind would be a bit more difficult, so it should definitely 
get engine support.


I don't think that the editor should need to support editing multiple 
layer sizes: It would get very messy and confusing (for everyone 
involved) if two layers were not tile-aligned, for example.


Instead, editing a paralayer should take place in its own map editor 
with only the paralayer visible.


To make editing easier, there could be a paralayer preview that /did/ 
allow the maker to scroll around the map and make sure everything was okay.


Other random thoughts that I'm not sure how to put in prose format since 
it's 1:00 am and I have to be up at 6:30 am:


- Since the scroll speed and the required paralayer size are directly 
related, setting one should also set the other.


- Because of this, I don't think allowing a script to parallaxize an 
existing layer would be useful. It would, in effect, either create a 
paralayer with the wrong dimensions (either it will need to draw the 
blank area past the edge of the map, or some will never be seen [which 
would wreak havoc with wrapping!]), or create paralayer with a 1:1 
scroll ratio, which is pointless


- Maybe allow other maps to be used as paralayers? That would handily 
solve the editor problem, at the expense of having to wrangle multiple 
maps at once. Also, would the NPCs on the parallaxed map be meaningful, etc?


- Otherwise, the paralayers can be stored as additional blobs of tilemap 
data.


- etc




--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Frame type

2011-05-20 Thread Mike Caron

On 5/20/2011 23:51, Ralph Versteegen wrote:

On 21 May 2011 14:29, Jay Tennanthierand...@crazyleafgames.com  wrote:

Then the backend
will enqueue a render order (though will probably render
immediately right now for testing purposes). Any time a frame
needs to be drawn to, the procedure that handles that will finish
by copying the data to the backend's surface.


Ah, somehow this seems too simple :) You didn't mention 16-colour palettes!


It's funny you should mention this. Here's a suggestion to mitigate the 
effects of 16-colour palettes:


Why not have anything that might have a 16-colour sprite keep a handle 
to a second sprite, which is a 256-colour version of the 16-colour 
sprite? Then, whenever the whatever changes palettes, just create a 
new sprite with the updated palette.


For normal usage (i.e., palette changes happening once at creation and 
then never again), this would be a great memory vs speed trade off.


The downside would be that if someone decides to emulate the Mario 
starman and cycle palettes rapidly, this would be an equal slowdown. 
This might be mitigated by using _another_ cache that remembers [sprite, 
palette] pairs.


It would also be possible to take this a step further, and do the same 
thing at the master palette level, 'compiling' everything into desktop 
colour depth-bit sprites, but this would make fades and other (very 
common) master palette changes very messy.



___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/4242 Remove Streaming from the sound effects import menu, because it doesn'

2011-04-27 Thread Mike Caron

On 4/27/2011 12:46, subvers...@hamsterrepublic.com wrote:

james
2011-04-27 09:46:05 -0700 (Wed, 27 Apr 2011)
135
Remove Streaming from the sound effects import menu, because it doesn't do 
anything, and I can't figure out what it was meant to do.
---
U   wip/menus.bas


Odds are, it was meant to allow one to select between Streaming (where 
the sound is streamed from disk) and Static (where the sound is loaded 
into memory completely). The former is more appropriate for large sounds 
(eg, Music) while the latter is more appropriate for short sounds.


--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/4242 Remove Streaming from the sound effects import menu, because it doesn'

2011-04-27 Thread Mike Caron

On 4/27/2011 13:02, James Paige wrote:

On Wed, Apr 27, 2011 at 12:52:26PM -0400, Mike Caron wrote:

On 4/27/2011 12:46, subvers...@hamsterrepublic.com wrote:

james
2011-04-27 09:46:05 -0700 (Wed, 27 Apr 2011)
135
Remove Streaming from the sound effects import menu, because it doesn't do 
anything, and I can't figure out what it was meant to do.
---
U   wip/menus.bas


Odds are, it was meant to allow one to select between Streaming (where
the sound is streamed from disk) and Static (where the sound is loaded
into memory completely). The former is more appropriate for large sounds
(eg, Music) while the latter is more appropriate for short sounds.


I wasn't aware of the backends being able to handle that distinction.

Maybe someone was planning to try and add it but never got around to it?

Anyway, if we need a streaming option later, it can easily be added
back.


They probably can't. Fortunately, it's not a big deal these days. After 
all, what's 10 Megs of Ram between you or me? :P



--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Build system pruning

2011-04-26 Thread Mike Caron

On 4/25/2011 1:19, James Paige wrote:

On Sat, Apr 23, 2011 at 01:22:58PM +1200, Ralph Versteegen wrote:

We have 15 build scripts, and certain changes require updating almost
all of them. It's time to get rid of some of this ridiculous
redundancy.

I like the fact that the *.bat scripts and Makefile don't require gcc,
python, and scons on top of freebasic, because that's a lot to
install. (These use pre-compiled objects at win32/*.o, though that
could be added to scons of course) However, it looks like make
actually requires mingw or msys anyway, make.exe won't run by itself.

Should we get rid of Makefile (once I add Mac support to scons), or
the *.sh and *.bat build scripts, or both? I vote for starting by
removing most of the *.sh, *.bat scripts, since it's too many files to
maintain and test. makegame.bat, makeedit.bat are especially nasty.


I am trhilled with scons, and have been using it exclusively for a
while. I would be happy to say goodbye to the .bat and .sh scripts.


It's probably about time to make mingw a requirement on Windows as the
number of C/C++ source files grows, also the script interpreter is
written in C.


I concur.


With two alternatives, makegame.sh, makeedit.sh, makeutil.sh,
makereload.sh may be safely deleted. (Though I notice there's some
FreeBSD-specific code in there)

What's check.bat? That doesn't seem to be used.
No need for mid2bam.bat or mid2bam.sh since you hardly ever want to
build that: mid2bam.sh hasn't even worked since FB 0.16!


Judging by the svn log there is no need to keep check.bat

---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


I am probably the last person to offer advice on build scripts, but has 
anyone looked into using CMake (http://www.cmake.org/)?


The deal with CMake is that it's sort of like automake, but it generates 
build scripts for several different platforms and compilers. For 
example, it can generate Visual Studio projects, Makefiles for mingw, etc.


Personally, I would prefer to have the option to build the C/++ stuff 
with Visual Studio, since I have never been able to install MinGW for 
some reason. Plus, Visual Studio Express is free 
(http://www.microsoft.com/express/Windows/).


Of course, I don't know how hard it would be to teach it about 
FreeBasic, but I imagine it's not that difficult.

--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Zenzizenzic nightly crash - Animation test

2011-04-18 Thread Mike Caron

On 4/17/2011 4:06, Matthew Boyd wrote:

I downloaded the latest nightly on April 17, 2011, and it's been doing
okay so far.
When I went to check out the new enemy dissolve animations in the enemy
editor, I got this error message; it occurs every time I play a dissolve
animation, even the old ones. I haven't tested this in an actual battle yet.
After backing up my game and pressing random keys to get out of the
error message, my palette got screwed up. The error also kept
re-appearing on every frame of the animation till it was done.

On a whim, I went to the master palette editor - the visit alone seems
to have fixed the palette problem.
 Baconlabs from the forums


Could I point out that that's a terrible error message? It took me three 
reads to figure out what it's asking the user to do.


In my opinion, it would be worded better like this:

An error has occurred! Press Escape to quit, or
any other key to try and continue.

If you quit now, when you run Custom again, it
will ask if you want to recover your game. Please
back up your Game before you do this, as the
internal state may be corrupt.

If this error is unexpected, please send an email
to ohrrpgce-cr...@hamsterrepublic.com.

That reads a lot cleaner to me, and has less redundant technical 
information.


--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/4171 compile hspeak using Euphoria4.

2011-02-25 Thread Mike Caron

On 2/25/2011 17:15, subvers...@hamsterrepublic.com wrote:

james
2011-02-25 14:15:32 -0800 (Fri, 25 Feb 2011)
233
compile hspeak using Euphoria4.
WARNING: this only works if hspeak.exw is located in a folder that has no 
spaces.
If you try to compile from C:\Documents And Settings\Homer J Simpson\My 
Documents\src\ohr\wip\ you will be disapointed
---
U   wip/makehspeak.bat


I looked at makehspeak.bat, expecting to find Oh, maybe he just needs a 
pair of quotes.


I was wrong.

WTF? Why would euphoria bomb if a file contains spaces in its path? It 
would be different if you called


  euc -gcc %CWD%\hspeak.exw

Since that might expand to something like

  euc -gcc c:\ohr source\hspeak.exw

which rightfully would be parsed as two arguments. I can't conceive of 
what insane things they must be doing with their command line 
processing. Expanding the file path inline? That's so much more work 
than the alternative!


Argh, this broke my brain.


--
- Mike Caron
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Nightly Missing gver.txt

2011-02-22 Thread Mike Caron
gver.txt (and cver.txt) are generated by verprint.exe, and its sole 
purpose is to provide the version string in custom's main menu. It 
doesn't do anything at runtime.


If you're compiling the OHR from source, using makegame/edit.bat should 
compile verprint.exe for you, so that it can generate these files.


On 2/22/2011 23:10, Tim Bell wrote:

About 30 minutes ago, I downloaded the nightly build zipfile from the
wiki (it's currently 11:07 PM EST), and when I went to start compiling
what I've changed, I discovered that I'm missing gver.txt (called in
compat.bi). While I do have one that I could use as a backup, it's
OHRRPGCE wip 20080308 fb/sdl.

Since this particular build I'm making is just for personal amusement,
will anything be horribly broken if I don't have the official gver.txt?
And why was it missing from the nightly in the first place?
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james changed revision 25 log comment by james

2011-01-20 Thread Mike Caron

On 1/20/2011 20:22, subvers...@hamsterrepublic.com wrote:

--- tmp/james-25-old2011-01-20 17:22:19.0 -0800
+++ tmp/james-25-new2011-01-20 17:22:19.0 -0800
@@ -1 +1 @@
-Journaled about trip to New York.
+James Mangled this commit log message by accident and doesn't know what it 
used to say :(
\ No newline at end of file
---
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Hmm, 25 was before you set up the emailing thing. However, according to 
your first log mangling message:


-applied Simon Bradley's patch to move assembly declares into allmodex.bi
+Journaled about trip to New York.
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/4101 diriswriteable wasn't really working properly on Windows when a director

2011-01-12 Thread Mike Caron

On 1/12/2011 11:55, subvers...@hamsterrepublic.com wrote:

teeemcee
2011-01-12 08:55:46 -0800 (Wed, 12 Jan 2011)
371
diriswriteable wasn't really working properly on Windows when a directory on 
writeable media is made read-only, so I added a kludge for that.

Doesn't Windows have a proper concept of unwriteable directories?


Not really. The best way to check is to try writing to a file, and see 
if it fails.


You could try explicitly checking security, media, etc., but that would 
be a lot of code and you'd definitely miss stuff.



(Also, I'm aware that Game will immediately crash if trying to play a game from 
read-only media, due to trying to write g_debug.txt. I have a branch for 
that...)



---
U   wip/util.bas
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/4077 Rewrite inefficient looping with halirious comment in guessdefaultpals

2011-01-03 Thread Mike Caron

On 1/3/2011 12:56, subvers...@hamsterrepublic.com wrote:

teeemcee
2011-01-03 09:56:57 -0800 (Mon, 03 Jan 2011)
299
Rewrite inefficient looping with halirious comment in guessdefaultpals
Here is the amazing comment:

   FOR j = 0 TO gen(genMaxHero) 'I reversed the loops, because it's more 
efficient
FOR i = 0 TO sets   'to do the file I/O in the outer loop
 loadherodata @her, j
 ...
NEXT
   NEXT


Whoops! Judging by the diff between 1188 and 1189 (when that change was 
made), I did that at the same time I rewrote everything to use the hero 
UDT instead of arrays.


To be fair, the comment /is/ accurate. It simply didn't reflect reality. :)


---
U   wip/common.bas
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/4077 Rewrite inefficient looping with halirious comment in guessdefaultpals

2011-01-03 Thread Mike Caron

On 1/3/2011 14:01, Mike Caron wrote:

On 1/3/2011 12:56, subvers...@hamsterrepublic.com wrote:

teeemcee
2011-01-03 09:56:57 -0800 (Mon, 03 Jan 2011)
299
Rewrite inefficient looping with halirious comment in guessdefaultpals
Here is the amazing comment:

FOR j = 0 TO gen(genMaxHero) 'I reversed the loops, because it's more
efficient
FOR i = 0 TO sets 'to do the file I/O in the outer loop
loadherodata @her, j
...
NEXT
NEXT


Whoops! Judging by the diff between 1188 and 1189 (when that change was
made), I did that at the same time I rewrote everything to use the hero
UDT instead of arrays.

To be fair, the comment /is/ accurate. It simply didn't reflect reality. :)


And, actually, just looking at the code now, I see the inner loop 
actually isn't needed at all (as you rewrote)



---
U wip/common.bas
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org




___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/4072 Updated DT0 and HeroDef for percentage based elementals.

2011-01-01 Thread Mike Caron

On 1/1/2011 14:30, Ralph Versteegen wrote:

On 2 January 2011 08:25, Mike Caroncaron.m...@gmail.com  wrote:

On 1/1/2011 14:16, Ralph Versteegen wrote:


On 2 January 2011 08:09,subvers...@hamsterrepublic.comwrote:


teeemcee
2011-01-01 11:09:07 -0800 (Sat, 01 Jan 2011)
367
Updated DT0 and HeroDef for percentage based elementals.
-DT0 is binsize-sized now
-Changed return value from percent_grabber
-Added SINGLE overloads for percent_grabberpercent_format, and changed
their handling of sig. fig.s
-Changed Yorgo's resists in test.rpg. Note that interference from the
default weapon prevents values higher than 200% on the Status screen


The default weapon is a nuisance, but I think I'll fix it by adding
a popup warning to the hero elemental resists menu warning the user to
change to a different equip merging scheme, once they're available.

However, the default weapon would still be quite a nuisance for some
merging schemes, like taking the average difference from 100% of all
equipment and the native values. Maybe a per-hero bit ignore
elemental resistances of default weapon


It's possible that I am missing something, but what about the default
weapon, exactly, is causing problems?

Or, maybe a better question is, how are you figuring out effective
resistance?

The intuitive method would be to multiply all equipment together. That way,
if you're equipped with the paper armour and oil sword, each with a weakness
to fire (200% damage), you take 400% damage from fire. Conversely, if you
equip the asbestos armour (with 50% fire damage) instead of the paper
armour, it would cancel out the oil sword.

Immunity would work the same (* 0 is always 0), and so would absorbtion.


You missed it, but we have to provide compatibility with older
versions. And in older versions, two items with 200% damage from fire
(weak bits set) equals a total of 200% damage from fire (weak bit
set). I will definitely add multiplication of values as an
alternative, but I thinking about instead using
sum-of-differences-from-100% as the new default (so 200% and 200%
becomes 300%). That way an immunity item plus an absorption item give
you absorption. Or perhaps geometric-sum-of-differences, so that 50%
and 200% still cancel each other out... but that's difficult to
understand.


Right, I read that. But, the way you phrased it above, it sounds like 
the default weapon is somehow interfering with the formula.


Either way, good luck with that!


---
U   wip/bmod.bas
U   wip/bmodsubs.bas
U   wip/common.bas
U   wip/common.bi
U   wip/const.bi
U   wip/customsubs.bas
U   wip/customsubs.bi
U   wip/loading.bas
U   wip/menustuf.bas
A   wip/ohrhelp/hero_elementals.txt
U   wip/subs.bas
U   wip/testgame/test.rpg
U   wip/udts.bi


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/4052 Add developer menu (type 'spam' at Custom's top level menu), replacing i

2010-12-29 Thread Mike Caron

Perhaps I am a bit late on this, but...

Why not just add it normally, but wrap it with something like #ifdef 
SHOWDEVMENU and add -D SHOWDEVMENU to your personal build script? That 
way, it's kept out of the nightly, but present in a test build.


Or, if you want it accessible for other people to test (but, only if 
they know the danger), make it a command line parameter.


On 12/29/2010 23:01, subvers...@hamsterrepublic.com wrote:

teeemcee
2010-12-29 20:01:12 -0800 (Wed, 29 Dec 2010)
227
Add developer menu (type 'spam' at Custom's top level menu), replacing 
individual key combinations for different menus (eg. Ctrl+R for the RELOAD 
editor).

My initial passphrase choice was 'spiffy', but that was too much typing
---
U   wip/custom.bas
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] FB arrays: extend or scrap?

2010-11-26 Thread Mike Caron

On 11/26/2010 5:34, Ralph Versteegen wrote:

QB/FB arrays are the worst designed feature in any programming
language I know of (except for *possibly* some of the stuff in MUMPS
http://thedailywtf.com/Articles/A_Case_of_the_MUMPS.aspx)
(A quick rant:
-not 1st class: you can't return them or even place them in types!
-uninitialised dynamic arrays are indistinguishable and will crash
your program. You must initialise them.
-to figure out whether an array is static or dynamic you have to check
the dialect, the OPTION statements in effect, and whether the index in
the DIM statement is a variable or a constant
-unlike the rest of the language, arrays aren't properly statically
typed: the compiler will let you REDIM a static array and crash your
program
-zero-length arrays not supported
-almost zero support for arrays in the standard library: just REDIM,
LBOUND, UBOUND, ERASE. You can't even copy an array, or get a pointer
to the array descriptor.
)
A couple days ago I had finally had enough, and started on a library
of array utility functions written in C, effectively extending libfb
(addressing just the last 2 complaints above). The idea is they act on
1D arrays starting at -1, with the -1 element ignored so we can have
zero-length arrays. Here are a few prototypes (you use a macro to
declare overloaded versions for each type T you want to support):

   declare sub array_copy overload (array() as T, source() as T)
   'Append an element or an array
   declare sub array_append overload (array() as T, value as T)
   declare sub array_append overload (array() as T, appendlist() as T)
   'Removes index n from array
   declare sub array_delete overload (array() as T, byval n as integer)
   'Insert a value/array at an index. Negative indices count from end
(-1 appends)
   declare sub array_insert overload (array() as T, byval insertbefore
as integer, value as T)
   declare sub array_insert overload (array() as T, byval insertbefore
as integer, insertlist() as T)
   declare sub array_sort overload (array() as T)

A couple nights into implementing them (expected to be done by now,
but the libfb array code is horribly over-complex, eg. there are about
8 different implementations of REDIM) I suddenly realised: if FB
arrays are so horrible, why am I using them at all? It would be FAR
easier to create a new array structure and write an extensive library
for it in C. The code would be much simple, faster, there'd be no
worry about keeping up with changes to libfb, and I can fix more of
the problems with FB arrays. The disadvantages would be having to
manually allocate and free them, and no bounds checking when compiled
with -exx. However when we finally switch to -lang fb we'll get those
back.

I would implement these arrays like this: array objects would just be
pointers of the desired type, which can be indexed like a normal
pointer. The array descriptor (containing length and other stuff)
would be stored before the 0th element. These pointers can of course
be embedded in UDTs or returned from functions. Because code should be
self documenting, to avoid confusion with normal pointers I'd do this:
#define array ptr
Example code:

FUNCTION generate_test_array() as string array
   DIM arr as string array
   array_new arr' allocate zero-length array
   array_append arr, test
   array_append arr, array_of(foo, bar)   ' I think I'll manage this
   array_sort arr
   RETURN arr
END FUNCTION

DIM arr as string array
arr = generate_test_array  ' Can only do this as arr is a NULL pointer
array_set arr, generate_test_array  ' Safe way to assign an array
print arr[length(arr) - 1]
array_free arr

So the question to the other developers is: would you rather have a
library for FB arrays, or use these new arrays? I am definitely in
favour of the new arrays, and would start using them and, where
beneficial, converting code I'm working on to use them as soon as
possible (tomorrow?).


I'm curious about one thing. Would these new arrays be dynamic or 
statically sized? I assume the former. In which case, you do you handle 
the realloc()/Reallocate() semantics?


Specifically, when you use realloc(), you have to use the return value 
as the new pointer (if it's not null), since the memory block may have 
moved to accommodate the new size.


However, the syntax you're proposing does not allow for the 
re-assignment of the variable containing the array. (Unless you intend 
for some preprocessor trickery, in which case foo on you.)


The best way to replace FB's arrays would be to create an array object 
which overloads the [] operator, and keeps the memory buffer internal. 
Ideally, it supports templates for maximum efficiency.


Class ArrayT
length as uinteger
data as T ptr
Public Constructor Array(size as uinteger)
length = size
data = new T[size]
End Constructor

Public Operator[](index as uinteger) as T ref
if index  0 or index = length throw new ArgumentException()

return 

Re: [Ohrrpgce] FB arrays: extend or scrap?

2010-11-26 Thread Mike Caron

On 11/26/2010 7:49, Ralph Versteegen wrote:

On 26 November 2010 23:59, Mike Caroncaron.m...@gmail.com  wrote:

On 11/26/2010 5:34, Ralph Versteegen wrote:


QB/FB arrays are the worst designed feature in any programming
language I know of (except for *possibly* some of the stuff in MUMPS
http://thedailywtf.com/Articles/A_Case_of_the_MUMPS.aspx)
(A quick rant:
-not 1st class: you can't return them or even place them in types!
-uninitialised dynamic arrays are indistinguishable and will crash
your program. You must initialise them.
-to figure out whether an array is static or dynamic you have to check
the dialect, the OPTION statements in effect, and whether the index in
the DIM statement is a variable or a constant
-unlike the rest of the language, arrays aren't properly statically
typed: the compiler will let you REDIM a static array and crash your
program
-zero-length arrays not supported
-almost zero support for arrays in the standard library: just REDIM,
LBOUND, UBOUND, ERASE. You can't even copy an array, or get a pointer
to the array descriptor.
)
A couple days ago I had finally had enough, and started on a library
of array utility functions written in C, effectively extending libfb
(addressing just the last 2 complaints above). The idea is they act on
1D arrays starting at -1, with the -1 element ignored so we can have
zero-length arrays. Here are a few prototypes (you use a macro to
declare overloaded versions for each type T you want to support):

   declare sub array_copy overload (array() as T, source() as T)
   'Append an element or an array
   declare sub array_append overload (array() as T, value as T)
   declare sub array_append overload (array() as T, appendlist() as T)
   'Removes index n from array
   declare sub array_delete overload (array() as T, byval n as integer)
   'Insert a value/array at an index. Negative indices count from end
(-1 appends)
   declare sub array_insert overload (array() as T, byval insertbefore
as integer, value as T)
   declare sub array_insert overload (array() as T, byval insertbefore
as integer, insertlist() as T)
   declare sub array_sort overload (array() as T)

A couple nights into implementing them (expected to be done by now,
but the libfb array code is horribly over-complex, eg. there are about
8 different implementations of REDIM) I suddenly realised: if FB
arrays are so horrible, why am I using them at all? It would be FAR
easier to create a new array structure and write an extensive library
for it in C. The code would be much simple, faster, there'd be no
worry about keeping up with changes to libfb, and I can fix more of
the problems with FB arrays. The disadvantages would be having to
manually allocate and free them, and no bounds checking when compiled
with -exx. However when we finally switch to -lang fb we'll get those
back.

I would implement these arrays like this: array objects would just be
pointers of the desired type, which can be indexed like a normal
pointer. The array descriptor (containing length and other stuff)
would be stored before the 0th element. These pointers can of course
be embedded in UDTs or returned from functions. Because code should be
self documenting, to avoid confusion with normal pointers I'd do this:
#define array ptr
Example code:

FUNCTION generate_test_array() as string array
   DIM arr as string array
   array_new arr' allocate zero-length array
   array_append arr, test
   array_append arr, array_of(foo, bar)   ' I think I'll manage this
   array_sort arr
   RETURN arr
END FUNCTION

DIM arr as string array
arr = generate_test_array  ' Can only do this as arr is a NULL pointer
array_set arr, generate_test_array  ' Safe way to assign an array
print arr[length(arr) - 1]
array_free arr

So the question to the other developers is: would you rather have a
library for FB arrays, or use these new arrays? I am definitely in
favour of the new arrays, and would start using them and, where
beneficial, converting code I'm working on to use them as soon as
possible (tomorrow?).


I'm curious about one thing. Would these new arrays be dynamic or statically
sized? I assume the former. In which case, you do you handle the
realloc()/Reallocate() semantics?


I forgot to mention? Yeah, always dynamic.


Specifically, when you use realloc(), you have to use the return value as
the new pointer (if it's not null), since the memory block may have moved to
accommodate the new size.

However, the syntax you're proposing does not allow for the re-assignment of
the variable containing the array. (Unless you intend for some preprocessor
trickery, in which case foo on you.)


BYREF BYREF BYREF


Well, *expletive*. I guess I've been using other languages too long.


Don't worry, there's preprocessor trickery involved. However there's
less than required for extending FB arrays. Also, I am aware that my
attempts at inheritance, hash tables, and lists using macros turned
into a disgusting mess; I promise I won't do that again. In fact I 

Re: [Ohrrpgce] plotscript dictionary down

2010-11-20 Thread Mike Caron

On 11/20/2010 13:35, Jeremy Bursey wrote:

Just tried to use the nightly plotscript dictionary and I got this error:

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error
and then click the Refresh javascript:location.reload() button, or try
again later.



End tag 'li' does not match the start tag 'ul'. Error processing
resource 'http://hamsterrepublic.com/ohrrpgce/docs/plotdic...

likey:Left Win Logo  # equal to key:Left Command/li/li
...


All fixed. It was simply an extra /li tag...
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] plotscript dictionary down

2010-11-20 Thread Mike Caron

On 11/20/2010 20:18, Jeremy Bursey wrote:

/All fixed. It was simply an extra /li tag.../

You may want to double-check that fix because the error still shows up.
I closed out of IE8 just to make sure, and it still showed an error.


Did you update your working copy? Or, if you're trying to test it in a 
nightly build, you need to wait until tomorrow, since I only committed 
it this afternoon.

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Grievances with gfx_directx?

2010-11-11 Thread Mike Caron

On 11/11/2010 15:06, Jay Tennant wrote:

From: Ralph Versteegenteeem...@gmail.com

I'd like the hotswapping-of-displays crashes to be
resolved.


This seems to be impossible to detect. I've searched all over
the docs and the internet, but I only found that Windows
does not send notifications about monitor connection state. It
seems to know about it, but will not raise an event for the
rest of the system.

http://social.msdn.microsoft.com/Forums/en/etw/thread/01373322-30ea-4abc-b7ca-0e698febe39d

Maybe by checking for connected monitors once every 3 seconds?


I've done a bit of playing around, and discovered that it is possible to 
get monitor notifications.


WARNING: WIN32 CODE AHEAD, LINUX USERS AVERT YOUR EYES

#include windows.h
#include dbt.h

//this is normally defined in the Driver Development Kit, which I don't have
const GUID GUID_MONITORS = { 0xe6f07b5f, 0xee97, 0x4a90, {0xb0, 0x76, 
0x33, 0xF5, 0x7B, 0xF4, 0xEA, 0xA7} };


void RegisterNotification(HWND hWnd) {
DEV_BROADCAST_DEVICEINTERFACE flt;
ZeroMemory(flt, sizeof(flt));

flt.dbcc_size = sizeof(flt);
flt.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
flt.dbcc_classguid = GUID_MONITORS;

RegisterDeviceNotification(hWnd, flt, DEVICE_NOTIFY_WINDOW_HANDLE);
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM 
lParam)

{

switch (message) {
//other messages, etc
case WM_CREATE:
RegisterNotification(hWnd);

case WM_DEVICECHANGE:
{
PDEV_BROADCAST_DEVICEINTERFACE b = 
(PDEV_BROADCAST_DEVICEINTERFACE) lParam;


switch(wParam) {
case DBT_DEVICEARRIVAL:
LogMsg(Device arrival: %S, b-dbcc_name);
break;
case DBT_DEVICEREMOVECOMPLETE:
LogMsg(Device removal: %S, b-dbcc_name);
break;
}

return DefWindowProc(hWnd, message, wParam, lParam);
}
}
}

END OF WIN32 CODE

With this code (and, obviously, the glue I omitted), I get this when 
unplugging and replugging my monitor:


Device removal: 
\\?\DISPLAY#HSD0019#5b07f9880UID1048833#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}
Device arrival: 
\\?\DISPLAY#HSD0019#5b07f9880UID1048833#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}


Obviously, the name is irrelevant, but this is a good place to enumerate 
displays, etc.

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/3886 a work-in-progress editor definition file

2010-10-14 Thread Mike Caron

On 10/14/2010 0:07, James Paige wrote:

On Wed, Oct 13, 2010 at 08:27:34PM -0700, Jay Tennant wrote:

From: James Paigeb...@hamsterrepublic.com
Sent: Wednesday, October 13, 2010 9:36 PM

On Wed, Oct 13, 2010 at 07:23:23PM -0700, subvers...@hamsterrepublic.com wrote:

james
2010-10-13 19:23:23 -0700 (Wed, 13 Oct 2010)
42
a work-in-progress editor definition file


I am pretty happy with the RELOAD Editor. Has anybody else tried it yet?
(CTRL+R from the main menu in custom)

However, I am seriously considering making an actual
editor-editor-editor. It would be similar to the RELOAD editor except it
would strictly enforce the structure of a .editor file, and would
automate the creation of each widget type.


Forgive my nescience, but why do you need or want an editor-editor-editor?
Isn't that like a pointer to a pointer to a pointer?


Thank you for making me google nescience. I am now that much less
nescient.

I know the idea of an editor-editor-editor *sounds* crazy, especially
since I have not actually started the editor-editor yet, but in the
course of planning and preparing the editor-editor, I have come to
believe that an editor-editor-editor might be exactly the right amount
of indirection to trigger a cascade of awesomeness.

Although maybe I am confusaing things by calling it the
editor-editor-editor. In my mind I have been calling the interpreter for
the editor definition files the editor-editor so a tool to create
those files is the editor-editor-editor, but really I should drop a
level of the indirection in my *name* of this thing.

just simply editor-editor is a better description of what I have been
talking about when I say editor-editor-editor


I was thinking about the RELOAD format today, and I realized that it 
could be made more efficient, if we produced a manifest of sorts, 
describing the valid contents of a RELOAD document. We could use it to 
optimize and validate certain operations.


I think we could use JSON to describe it... Actually, no. It would be 
more efficient if we created a new binary format for this. Maybe... 
Markup Extra Transcription of Additions. Yes, that should work.


And, of course, you can add a new editor-editor-editor editor to edit it.

Oh, but how are we going to mark that up? Hmm... Editor Language DRaft 
Information Transcription CHannel, edited in the 
editor-editor-editor-editor editor of course!



And yes, the idea of using the editor-editor to create the
editor-editor-editor has occured to me, but then an 80-year-old version
of Ralph with a long silver beard and robotic arms appeared in a time
machine and beat me senseless before disappearing in a flash of light.
...S I decided not to attempt that in this particular timeline.


Hmm. Have you tried installing magnets inside the walls? I have nagging
relatives, and to avoid them I've installed neodymium magnets all over
the house. Because they have metal fillings, their faces are naturally
drawn to the walls when they pass by them.

Of course, the side effects include rainbow colored crt's, the wall
gnomes have become magnetized (or at least that's their excuse for taking
all my change!), and I occasionally wake up pointing northwards.


I would try that, but I am concerned about how it might interact with my
tinfoil hat.


Don't listen to this hippie crap. All you need is a spell of warding 
against extra-planar travellers. Man, doesn't anyone take levels in 
sorcerer these days?



---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/3886 a work-in-progress editor definition file

2010-10-14 Thread Mike Caron

On 10/14/2010 22:13, James Paige wrote:

On Thu, Oct 14, 2010 at 10:07:03PM -0400, Mike Caron wrote:

On 10/14/2010 0:07, James Paige wrote:

On Wed, Oct 13, 2010 at 08:27:34PM -0700, Jay Tennant wrote:

From: James Paigeb...@hamsterrepublic.com
Sent: Wednesday, October 13, 2010 9:36 PM

On Wed, Oct 13, 2010 at 07:23:23PM -0700, subvers...@hamsterrepublic.com wrote:

james
2010-10-13 19:23:23 -0700 (Wed, 13 Oct 2010)
42
a work-in-progress editor definition file


I am pretty happy with the RELOAD Editor. Has anybody else tried it yet?
(CTRL+R from the main menu in custom)

However, I am seriously considering making an actual
editor-editor-editor. It would be similar to the RELOAD editor except it
would strictly enforce the structure of a .editor file, and would
automate the creation of each widget type.


Forgive my nescience, but why do you need or want an editor-editor-editor?
Isn't that like a pointer to a pointer to a pointer?


Thank you for making me google nescience. I am now that much less
nescient.

I know the idea of an editor-editor-editor *sounds* crazy, especially
since I have not actually started the editor-editor yet, but in the
course of planning and preparing the editor-editor, I have come to
believe that an editor-editor-editor might be exactly the right amount
of indirection to trigger a cascade of awesomeness.

Although maybe I am confusaing things by calling it the
editor-editor-editor. In my mind I have been calling the interpreter for
the editor definition files the editor-editor so a tool to create
those files is the editor-editor-editor, but really I should drop a
level of the indirection in my *name* of this thing.

just simply editor-editor is a better description of what I have been
talking about when I say editor-editor-editor


I was thinking about the RELOAD format today, and I realized that it
could be made more efficient, if we produced a manifest of sorts,
describing the valid contents of a RELOAD document. We could use it to
optimize and validate certain operations.

I think we could use JSON to describe it... Actually, no. It would be
more efficient if we created a new binary format for this. Maybe...
Markup Extra Transcription of Additions. Yes, that should work.

And, of course, you can add a new editor-editor-editor editor to edit it.

Oh, but how are we going to mark that up? Hmm... Editor Language DRaft
Information Transcription CHannel, edited in the
editor-editor-editor-editor editor of course!


I... can't... tel if you are teasing me or not!...


I'm teasing both of us :D


And yes, the idea of using the editor-editor to create the
editor-editor-editor has occured to me, but then an 80-year-old version
of Ralph with a long silver beard and robotic arms appeared in a time
machine and beat me senseless before disappearing in a flash of light.
...S I decided not to attempt that in this particular timeline.


Hmm. Have you tried installing magnets inside the walls? I have nagging
relatives, and to avoid them I've installed neodymium magnets all over
the house. Because they have metal fillings, their faces are naturally
drawn to the walls when they pass by them.

Of course, the side effects include rainbow colored crt's, the wall
gnomes have become magnetized (or at least that's their excuse for taking
all my change!), and I occasionally wake up pointing northwards.


I would try that, but I am concerned about how it might interact with my
tinfoil hat.


Don't listen to this hippie crap. All you need is a spell of warding
against extra-planar travellers. Man, doesn't anyone take levels in
sorcerer these days?


I'm still single-classing Barbarian, sorry.


Fair enough. You need it to wrangle with all those Pythons.


---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/3886 a work-in-progress editor definition file

2010-10-14 Thread Mike Caron

On 10/14/2010 22:23, James Paige wrote:

On Thu, Oct 14, 2010 at 10:15:30PM -0400, Mike Caron wrote:

On 10/14/2010 22:13, James Paige wrote:

On Thu, Oct 14, 2010 at 10:07:03PM -0400, Mike Caron wrote:

On 10/14/2010 0:07, James Paige wrote:

On Wed, Oct 13, 2010 at 08:27:34PM -0700, Jay Tennant wrote:

From: James Paigeb...@hamsterrepublic.com
Sent: Wednesday, October 13, 2010 9:36 PM

On Wed, Oct 13, 2010 at 07:23:23PM -0700, subvers...@hamsterrepublic.com wrote:

james
2010-10-13 19:23:23 -0700 (Wed, 13 Oct 2010)
42
a work-in-progress editor definition file


I am pretty happy with the RELOAD Editor. Has anybody else tried it yet?
(CTRL+R from the main menu in custom)

However, I am seriously considering making an actual
editor-editor-editor. It would be similar to the RELOAD editor except it
would strictly enforce the structure of a .editor file, and would
automate the creation of each widget type.


Forgive my nescience, but why do you need or want an editor-editor-editor?
Isn't that like a pointer to a pointer to a pointer?


Thank you for making me google nescience. I am now that much less
nescient.

I know the idea of an editor-editor-editor *sounds* crazy, especially
since I have not actually started the editor-editor yet, but in the
course of planning and preparing the editor-editor, I have come to
believe that an editor-editor-editor might be exactly the right amount
of indirection to trigger a cascade of awesomeness.

Although maybe I am confusaing things by calling it the
editor-editor-editor. In my mind I have been calling the interpreter for
the editor definition files the editor-editor so a tool to create
those files is the editor-editor-editor, but really I should drop a
level of the indirection in my *name* of this thing.

just simply editor-editor is a better description of what I have been
talking about when I say editor-editor-editor


I was thinking about the RELOAD format today, and I realized that it
could be made more efficient, if we produced a manifest of sorts,
describing the valid contents of a RELOAD document. We could use it to
optimize and validate certain operations.

I think we could use JSON to describe it... Actually, no. It would be
more efficient if we created a new binary format for this. Maybe...
Markup Extra Transcription of Additions. Yes, that should work.

And, of course, you can add a new editor-editor-editor editor to edit it.

Oh, but how are we going to mark that up? Hmm... Editor Language DRaft
Information Transcription CHannel, edited in the
editor-editor-editor-editor editor of course!


I... can't... tel if you are teasing me or not!...


I'm teasing both of us :D


And the fact that I had to ask means you did it well :)


The sad part is that it only took me a few moments to come up with the 
acronyms... Maybe my destiny is to make meta-file formats?! Nooo



---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] better palette options

2010-10-10 Thread Mike Caron

On 10/10/2010 7:04, Ralph Versteegen wrote:

On 9 October 2010 14:39, David Gowers (kampu)00a...@gmail.com  wrote:

On Sat, Oct 9, 2010 at 5:07 AM, Ralph Versteegenteeem...@gmail.com  wrote:

On 9 October 2010 02:48, David Gowers (kampu)00a...@gmail.com  wrote:

On Fri, Oct 8, 2010 at 11:42 PM, David Gowers (kampu)00a...@gmail.com  wrote:

http://bpaste.net/show/10001/
^
The format proposition



Generally this looks good. Aside from the following long string of criticisms ;)

I'm not sure, but I believe you're suggesting using a plain binary
lump instead of Reload for animation? If Reload is actually part of
it, I don't see much point in a separate lump per animation.


RELOAD was not part of it (well, honestly RELOAD vaguely annoys me,
the way it replicates XML's weird data model. So it's not the first
thing I would think of.)


What about RELOAD (or, I guess, XML's) data model don't you like? I'm 
not trying to defend it, I honestly want to know what you don't like. 
Perhaps something could be improved?



But it is now.


I wasn't actually requesting it. RELOAD as container for animation
data, as in your proposal, seems like a fairly good idea. RELOAD as
container for pixel data may be overly heavy.


I agree that pixel data should not be stored in a RELOAD container.

Rather, all the animation data should be stored in a single RELOAD 
document, and the images separate from that.


 RELOAD annoys me a
 little too, due to much increased complexity of read/writing.

But, surely, you agree that the benefits of having a strongly typed and 
named data format outweigh the complexity, right?


Honestly, I think the lump resizing scheme for older lumps is a lot more 
complex than RELOAD...




I notice that separate image size and bounding box size/offset are
missing. Intentionally?


Missing?
I understood the base bounding box size and location as being
immutable (and based off say, a manually definable box - see slice
editor). While this was a bit annoying, it made some amount of sense.
I'm not sure how to avoid confusing the user if they are not
immutable.

Please, explain further how you conceive of the interaction of
bounding boxes and image offsets?


It's a conflation of two (or three) different ideas. Perhaps they
should be separated. A srcrect is just a reference point (offset)
plus width and height equal to the existing frame size limits. I
called these bounding boxes because in the current tile-based
movement system (and also somewhat in in-battle movement and
positioning) the frame size is effectively a bounding box. But if/when
we add pixel-based movement one may well want the bounding box to
depend on the current frame.


I think that's a really bad idea. The point of bounding boxes is that 
they are independent of the graphic on screen. Case in point:


What if, on a frame with a small bounding box, a character moves up 
against a wall. Then, on the next frame, he has a large bounding box, 
which now intersects with the wall. Which of the following happens?


1. The character can now move into the wall?
2. The character is ejected (a la super mario bros)?
3. The character can only move out from the wall?
4. The character can't move at all?
5. The character is disintegrated since two particles cannot share the 
same quantum state?


If the bounding boxes are fixed (or, at least, independent of sprites),



I don't understand the difference between the 'animset' command, and
chaining to another animation using 'end'.

animset != anim.
it doesn't set the anim, it sets the animset.
Anyway I removed that by allowing varlength tuples.


What varlength tuples?



You're also missing animation names. I think naming animations is
better than numbering them.
Then you can add a attackee flinch
animation to an enemy, say, just by adding an animation and naming it
hurt.

+1. I was thinking about this problem and couldn't figure out how to
do it nicely, but this is excellent.


But there's a complication, referring to animations by name may not
always be appropriate. Quoting from the 'text tags' thread, where I
proposed embedding tags in textboxes which trigger portrait
animations:


Maybe animations should get both a name and a number. The name can be
used everywhere that it makes sense to use a name, and the number can be
used in whatever small number of places a name isn't practical (like
here)


OK, sounds practical. But I wonder whether the ID number should be an
index into the big global table of animation names (shared by all
spritesets of any sort), or refer to the n-th animation currently
defined for this spriteset. I'd prefer the first, since it might make
sense to sort animations, say alphabetically.






The check/setctr codes seem to be very inefficient for creating loops:

setctr ctr0 = x
label 1
...loop contents
setctr ctr0 -= 1
checkctr ctr0 == 0
goto label 2
goto label 1
label 2

Those last 5 instructions could be replaced with a loop(ctr,label)
code: decrement ctr and goto label if 

[Ohrrpgce] Sprites, animation food for thought

2010-10-10 Thread Mike Caron
First off, a disclaimer: This is not an actual proposal for a data 
format for the OHR. This is something I've cooked up for another project 
which may or may not ever see the light of day (hopefully, it will, but 
it's immaterial to this discussion).


This is how I've implemented sprites and animations in this other project:

First, all pixel data is stored in sprite sheets. These are PNGs that 
contain all the sprites for a given on-screen entity. Technically, as I 
am writing it in .NET, nothing is stopping them from being BMP or JPG or 
something, but I prefer PNG for its true-colour and transparency support.


Then, with each sprite sheet, there is an XML document that describes it:

spriteset xmlns=http://mike-caron.com/za; name=link1 file=link.png
frame x=33 y=1 width=16 height=22 ox=8 oy=19
name=stand-down /

frame x=3 y=31 width=16 height=22 ox=8 oy=19 
name=walk1-down /
frame x=33 y=31 width=16 height=22 ox=8 oy=19 
name=walk2-down /


!-- etc. --

Each frame has a name, a position and size on the sheet, and an origin. 
The origin is aligned up with the actual entity's origin (which, ATM is 
always their (x,y) position, but that may be customizable later on)


Then, after the frame definitions, we have the animation definitions:

animation name=stand deftime=1 loop=no
dir dir=down
framestand-down/frame
/dir
dir dir=up
framestand-up/frame
/dir
dir dir=right
framestand-right/frame
/dir
dir dir=left
framestand-left/frame
/dir
/animation

This is mostly self explanitory. Every frame has either one or four 
directions defined, depending on if the sprite has meaningful directions 
(an item on the ground, for example, probably only has one direction. An 
NPC, on the other hand, will have all four).


Each frame in a direction can have a time parameter, which describes how 
many ticks the frame is displayed for. deftime is just the default such 
value. Obviously, as well, if loop is yes, the animation will start from 
the beginning. If no, it will just stop on the last frame forever.


Finally, every entity in the game references both a sprite sheet and an 
animation. The idea is that you could change one or the other. For 
example, if you get a better shield, the sprite sheet changes from 
link1 to link2. And, obviously, the animation changes based on what 
is happening in the game.


A few notes on this structure:

 - There is no accounting for palettes. If you wanted to use a paletted 
sprite, then by all means you are able, but don't expect to be able to 
change that palette in game. The canonical way to add palette swaps is 
to have a different sprite sheet with the same animations (and, I may 
add some way to automate this. Eg, this sprite sheet is exactly the 
same as this other sprite sheet, so use those definitions)


 - There is also no way to get any fancier animations. I.e, there's no 
way to automatically oscillate or go backwards or whatever. The way to 
achieve these effects would be to duplicate the frames in the animation.

   - I may or may not add sprite flipping.

 - The way the images are laid out on the sheet has absolutely nothing 
to do with how they are animated or displayed. If you wanted the same 
frame, but offset by 5 pixels or whatever, you just modify the origin. 
No muss, no fuss.


 - Also, there are no inherent limitations on how large or small the 
sprite is. If you want to make a 2d version of Shadow of the Colossus, 
then be my guest! (just, don't expect the video card to necessarily play 
along ;)


So... yeah. Make of that what you will, I'm just adding ideas to the 
pot. I am aware that this format, as is, is unsuitable for the OHR. It's 
just my two cents.

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


[Ohrrpgce] Sprites, animation food for thought

2010-10-10 Thread Mike Caron
First off, a disclaimer: This is not an actual proposal for a data 
format for the OHR. This is something I've cooked up for another project 
which may or may not ever see the light of day (hopefully, it will, but 
it's immaterial to this discussion).


This is how I've implemented sprites and animations in this other project:

First, all pixel data is stored in sprite sheets. These are PNGs that 
contain all the sprites for a given on-screen entity. Technically, as I 
am writing it in .NET, nothing is stopping them from being BMP or JPG or 
something, but I prefer PNG for its true-colour and transparency support.


Then, with each sprite sheet, there is an XML document that describes it:

spriteset xmlns=http://mike-caron.com/za; name=link1 file=link.png
frame x=33 y=1 width=16 height=22 ox=8 oy=19
name=stand-down /

frame x=3 y=31 width=16 height=22 ox=8 oy=19 
name=walk1-down /
frame x=33 y=31 width=16 height=22 ox=8 oy=19 
name=walk2-down /


!-- etc. --

Each frame has a name, a position and size on the sheet, and an origin. 
The origin is aligned up with the actual entity's origin (which, ATM is 
always their (x,y) position, but that may be customizable later on)


Then, after the frame definitions, we have the animation definitions:

animation name=stand deftime=1 loop=no
dir dir=down
framestand-down/frame
/dir
dir dir=up
framestand-up/frame
/dir
dir dir=right
framestand-right/frame
/dir
dir dir=left
framestand-left/frame
/dir
/animation

This is mostly self explanitory. Every frame has either one or four 
directions defined, depending on if the sprite has meaningful directions 
(an item on the ground, for example, probably only has one direction. An 
NPC, on the other hand, will have all four).


Each frame in a direction can have a time parameter, which describes how 
many ticks the frame is displayed for. deftime is just the default such 
value. Obviously, as well, if loop is yes, the animation will start from 
the beginning. If no, it will just stop on the last frame forever.


Finally, every entity in the game references both a sprite sheet and an 
animation. The idea is that you could change one or the other. For 
example, if you get a better shield, the sprite sheet changes from 
link1 to link2. And, obviously, the animation changes based on what 
is happening in the game.


A few notes on this structure:

 - There is no accounting for palettes. If you wanted to use a paletted 
sprite, then by all means you are able, but don't expect to be able to 
change that palette in game. The canonical way to add palette swaps is 
to have a different sprite sheet with the same animations (and, I may 
add some way to automate this. Eg, this sprite sheet is exactly the 
same as this other sprite sheet, so use those definitions)


 - There is also no way to get any fancier animations. I.e, there's no 
way to automatically oscillate or go backwards or whatever. The way to 
achieve these effects would be to duplicate the frames in the animation.

   - I may or may not add sprite flipping.

 - The way the images are laid out on the sheet has absolutely nothing 
to do with how they are animated or displayed. If you wanted the same 
frame, but offset by 5 pixels or whatever, you just modify the origin. 
No muss, no fuss.


 - Also, there are no inherent limitations on how large or small the 
sprite is. If you want to make a 2d version of Shadow of the Colossus, 
then be my guest! (just, don't expect the video card to necessarily play 
along ;)


So... yeah. Make of that what you will, I'm just adding ideas to the 
pot. I am aware that this format, as is, is unsuitable for the OHR. It's 
just my two cents.

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


[Ohrrpgce] Sprites, animation food for thought

2010-10-10 Thread Mike Caron
First off, a disclaimer: This is not an actual proposal for a data 
format for the OHR. This is something I've cooked up for another project 
which may or may not ever see the light of day (hopefully, it will, but 
it's immaterial to this discussion).


This is how I've implemented sprites and animations in this other project:

First, all pixel data is stored in sprite sheets. These are PNGs that 
contain all the sprites for a given on-screen entity. Technically, as I 
am writing it in .NET, nothing is stopping them from being BMP or JPG or 
something, but I prefer PNG for its true-colour and transparency support.


Then, with each sprite sheet, there is an XML document that describes it:

spriteset xmlns=http://mike-caron.com/za; name=link1 file=link.png
frame x=33 y=1 width=16 height=22 ox=8 oy=19
name=stand-down /

frame x=3 y=31 width=16 height=22 ox=8 oy=19 
name=walk1-down /
frame x=33 y=31 width=16 height=22 ox=8 oy=19 
name=walk2-down /


!-- etc. --

Each frame has a name, a position and size on the sheet, and an origin. 
The origin is aligned up with the actual entity's origin (which, ATM is 
always their (x,y) position, but that may be customizable later on)


Then, after the frame definitions, we have the animation definitions:

animation name=stand deftime=1 loop=no
dir dir=down
framestand-down/frame
/dir
dir dir=up
framestand-up/frame
/dir
dir dir=right
framestand-right/frame
/dir
dir dir=left
framestand-left/frame
/dir
/animation

This is mostly self explanitory. Every frame has either one or four 
directions defined, depending on if the sprite has meaningful directions 
(an item on the ground, for example, probably only has one direction. An 
NPC, on the other hand, will have all four).


Each frame in a direction can have a time parameter, which describes how 
many ticks the frame is displayed for. deftime is just the default such 
value. Obviously, as well, if loop is yes, the animation will start from 
the beginning. If no, it will just stop on the last frame forever.


Finally, every entity in the game references both a sprite sheet and an 
animation. The idea is that you could change one or the other. For 
example, if you get a better shield, the sprite sheet changes from 
link1 to link2. And, obviously, the animation changes based on what 
is happening in the game.


A few notes on this structure:

 - There is no accounting for palettes. If you wanted to use a paletted 
sprite, then by all means you are able, but don't expect to be able to 
change that palette in game. The canonical way to add palette swaps is 
to have a different sprite sheet with the same animations (and, I may 
add some way to automate this. Eg, this sprite sheet is exactly the 
same as this other sprite sheet, so use those definitions)


 - There is also no way to get any fancier animations. I.e, there's no 
way to automatically oscillate or go backwards or whatever. The way to 
achieve these effects would be to duplicate the frames in the animation.

   - I may or may not add sprite flipping.

 - The way the images are laid out on the sheet has absolutely nothing 
to do with how they are animated or displayed. If you wanted the same 
frame, but offset by 5 pixels or whatever, you just modify the origin. 
No muss, no fuss.


 - Also, there are no inherent limitations on how large or small the 
sprite is. If you want to make a 2d version of Shadow of the Colossus, 
then be my guest! (just, don't expect the video card to necessarily play 
along ;)


So... yeah. Make of that what you will, I'm just adding ideas to the 
pot. I am aware that this format, as is, is unsuitable for the OHR. It's 
just my two cents.

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] better palette options

2010-10-10 Thread Mike Caron
On Sun, Oct 10, 2010 at 6:20 PM, David Gowers (kampu) 00a...@gmail.com wrote:
 On Mon, Oct 11, 2010 at 3:36 AM, Mike Caron caron.m...@gmail.com wrote:
 What about RELOAD (or, I guess, XML's) data model don't you like?
 That nodes with children can also have values.
 That's a pretty extraordinary behaviour for a tree data model, IMO.

 Unless you expect people to XSLT their XML source data,
 I think a model like YAML or JSON is much simpler while still
 supporting the basic data model.

 (you can currently convert YAML or JSON to RELOAD with a bit of work.
 I'm just arguing that the nodes with children can also have values
 is a specific, and probably unneeded, accommodation for XML's strange
 behaviour.)

Oh. I see. Originally, it was such that nodes could have either
children or a value. However, TMC suggested we do it this way as an
optimization.

  I'm not
 trying to defend it, I honestly want to know what you don't like. Perhaps
 something could be improved?

 But it is now.

 I wasn't actually requesting it. RELOAD as container for animation
 data, as in your proposal, seems like a fairly good idea. RELOAD as
 container for pixel data may be overly heavy.

 I agree that pixel data should not be stored in a RELOAD container.

 Rather, all the animation data should be stored in a single RELOAD document,
 and the images separate from that.

 RELOAD annoys me a
 little too, due to much increased complexity of read/writing.

 But, surely, you agree that the benefits of having a strongly typed and
 named data format outweigh the complexity, right?

 Honestly, I think the lump resizing scheme for older lumps is a lot more
 complex than RELOAD...



 I think that's a really bad idea. The point of bounding boxes is that they
 are independent of the graphic on screen. Case in point:

 What if, on a frame with a small bounding box, a character moves up against
 a wall. Then, on the next frame, he has a large bounding box, which now
 intersects with the wall. Which of the following happens?

 1. The character can now move into the wall?
 2. The character is ejected (a la super mario bros)?
 3. The character can only move out from the wall?
 4. The character can't move at all?
 5. The character is disintegrated since two particles cannot share the same
 quantum state?

 If the bounding boxes are fixed (or, at least, independent of sprites),


 ..?? Hello sentence which is not there.

:\ I have no idea how that happened, but I think the rest of the
sentence was something like:

If the bounding boxes are fixed (or, at least, independent of
sprites), then you don't have to worry about this.


 I don't understand the difference between the 'animset' command, and
 chaining to another animation using 'end'.

 animset != anim.
 it doesn't set the anim, it sets the animset.
 Anyway I removed that by allowing varlength tuples.

 What varlength tuples?


 You're also missing animation names. I think naming animations is
 better than numbering them.
 Then you can add a attackee flinch
 animation to an enemy, say, just by adding an animation and naming it
 hurt.

 +1. I was thinking about this problem and couldn't figure out how to
 do it nicely, but this is excellent.

 But there's a complication, referring to animations by name may not
 always be appropriate. Quoting from the 'text tags' thread, where I
 proposed embedding tags in textboxes which trigger portrait
 animations:

 Maybe animations should get both a name and a number. The name can be
 used everywhere that it makes sense to use a name, and the number can be
 used in whatever small number of places a name isn't practical (like
 here)

 OK, sounds practical. But I wonder whether the ID number should be an
 index into the big global table of animation names (shared by all
 spritesets of any sort), or refer to the n-th animation currently
 defined for this spriteset. I'd prefer the first, since it might make
 sense to sort animations, say alphabetically.




 The check/setctr codes seem to be very inefficient for creating loops:

 setctr ctr0 = x
 label 1
 ...loop contents
 setctr ctr0 -= 1
 checkctr ctr0 == 0
 goto label 2
 goto label 1
 label 2

 Those last 5 instructions could be replaced with a loop(ctr,label)
 code: decrement ctr and goto label if ctr  0. A relative frame change
 code would also be very useful for loops.

 oh right, ctr and label can fit into 16 bits easily(3+8)
 Good idea. (note that I'm leaving in the original ops -- they have a
 specific use that cannot be readily attained by a loop command :
 interleaving instructions, like 'wait 1' that only execute eg on=
 second loop through a particular area
 of code.

 Your definition of loop isn't correct.

 The actual encoding of the bytestring, bits per opcode and argument,
 isn't specified. Making them all 16 bit signed is easy, but we if want
 to cram multiple arguments into the same short, maybe it would just be
 simpler to same that opcodes are 8 bit, and arguments are either 8 or
 16 bit

[Ohrrpgce] Fwd: Sprites, animation food for thought

2010-10-10 Thread Mike Caron
Yikes, I fail at email forever. This was meant to go to the rest of the list.


-- Forwarded message --
From: Mike caron.m...@gmail.com
Date: Sun, Oct 10, 2010 at 11:35 PM
Subject: Re: [Ohrrpgce] Sprites, animation food for thought
To: Seth Hetu seth.h...@gmail.com


(Oops, I figured it would. Thunderbird claimed the email didn't send
the first two times)

Anyway, yes. As I mentioned below the relevant snippet, each frame in
an animation can have its own delay. deftime simply specified the
default delay for that animation as a whole.
--
Mike Caron

-Original Message-
From: Seth Hetu seth.h...@gmail.com
Date: Mon, 11 Oct 2010 11:32:41
To: ohrrpgce@lists.motherhamster.org; caron.m...@gmail.com
Subject: Re: [Ohrrpgce] Sprites, animation food for thought

3 times, but nevermind that. I've got a question about animations.

Is it possible to add a delay value, which delays the next frame in
the animation? Like:
     animation name=stand deftime=1 loop=no
         dir dir=down
             framestand-down/frame
         /dir
         dir dir=up delay=3ms
             framestand-up/frame
         /dir
         dir dir=right
             framestand-right/frame
         /dir
         dir dir=left
             framestand-left/frame
         /dir
     /animation


Then the person remains standing for 3s longer than the other directions?

The reason I ask is that I like your idea of defining the animation by
wrapping a PNG sheet with XML. So maybe it would be possible/easy to
add more tags and options to an animation to increase its power. Then,
it's all described in the XML+PNG combo, which makes it really easy to
edit external to the OHR.

Just throwing out ideas, since your first email seemed to encourage
it. Cool system overall.
--Seth



On Mon, Oct 11, 2010 at 2:01 AM, Mike caron.m...@gmail.com wrote:
 Shoot, if this email went out multiple times, I apologise.

 If not, please disregard this.
 --
 Mike Caron

 -Original Message-
 From: Mike Caron caron.m...@gmail.com
 Date: Sun, 10 Oct 2010 13:37:53
 To: ohrrpgce@lists.motherhamster.org
 Subject: Sprites, animation food for thought

 First off, a disclaimer: This is not an actual proposal for a data
 format for the OHR. This is something I've cooked up for another project
 which may or may not ever see the light of day (hopefully, it will, but
 it's immaterial to this discussion).

 This is how I've implemented sprites and animations in this other project:

 First, all pixel data is stored in sprite sheets. These are PNGs that
 contain all the sprites for a given on-screen entity. Technically, as I
 am writing it in .NET, nothing is stopping them from being BMP or JPG or
 something, but I prefer PNG for its true-colour and transparency support.

 Then, with each sprite sheet, there is an XML document that describes it:

 spriteset xmlns=http://mike-caron.com/za; name=link1 file=link.png
     frame x=33 y=1 width=16 height=22 ox=8 oy=19
 name=stand-down /

     frame x=3 y=31 width=16 height=22 ox=8 oy=19
 name=walk1-down /
     frame x=33 y=31 width=16 height=22 ox=8 oy=19
 name=walk2-down /

     !-- etc. --

 Each frame has a name, a position and size on the sheet, and an origin.
 The origin is aligned up with the actual entity's origin (which, ATM is
 always their (x,y) position, but that may be customizable later on)

 Then, after the frame definitions, we have the animation definitions:



 This is mostly self explanitory. Every frame has either one or four
 directions defined, depending on if the sprite has meaningful directions
 (an item on the ground, for example, probably only has one direction. An
 NPC, on the other hand, will have all four).

 Each frame in a direction can have a time parameter, which describes how
 many ticks the frame is displayed for. deftime is just the default such
 value. Obviously, as well, if loop is yes, the animation will start from
 the beginning. If no, it will just stop on the last frame forever.

 Finally, every entity in the game references both a sprite sheet and an
 animation. The idea is that you could change one or the other. For
 example, if you get a better shield, the sprite sheet changes from
 link1 to link2. And, obviously, the animation changes based on what
 is happening in the game.

 A few notes on this structure:

  - There is no accounting for palettes. If you wanted to use a paletted
 sprite, then by all means you are able, but don't expect to be able to
 change that palette in game. The canonical way to add palette swaps is
 to have a different sprite sheet with the same animations (and, I may
 add some way to automate this. Eg, this sprite sheet is exactly the
 same as this other sprite sheet, so use those definitions)

  - There is also no way to get any fancier animations. I.e, there's no
 way to automatically oscillate or go backwards or whatever. The way to
 achieve these effects would be to duplicate the frames in the animation.
    - I may or may not add sprite

Re: [Ohrrpgce] SVN: teeemcee/3847 Windows builds were completely broken when using FB 0.21 or later.

2010-10-08 Thread Mike Caron

On 10/8/2010 2:01, subvers...@hamsterrepublic.com wrote:

teeemcee
2010-10-07 23:01:32 -0700 (Thu, 07 Oct 2010)
380
Windows builds were completely broken when using FB 0.21 or later.

Turns out that __FB_UNIX__ is *always* defined, to either true or false, unlike 
all the other __FB_*__ defines. Good work, FB devs. Actually I'd already 
complained about this on the forum... to the guy who wrote the patch for this 
when he was asking for feedback. He fixed all the other problems I pointed out 
:(


Dude, you need to get with the times. Don't you know that #ifdef is SO 
last decade. Modern programs do this:


IF __FB_WINDOWS__ THEN
#include whatever
ELSEIF __FB_UNIX__ THEN
#include whateverx
END IF

Sheesh. ;)


---
U   wip/compat.bi
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] better palette options

2010-10-07 Thread Mike Caron

On 10/8/2010 0:23, Ralph Versteegen wrote:

On 8 October 2010 14:59, David Gowers (kampu)00a...@gmail.com  wrote:

On Fri, Oct 8, 2010 at 9:44 AM, Jeremy Burseyzippywi...@hotmail.com  wrote:

I'm only subscribed to the mailing digest, not the individual alerts, so I
have to cut and paste those comments related to the palette discussion I
introduced last night. Hopefully this doesn't come out all messy.


Did james modify my palette in that way? I know he changed it slightly
before
installing as the new default. That's a shame if so; I specifically
designed
it to not waste a single entry.


The game I'm updating actually started 10 years ago on the old palette, so I
am using most of the original colors. I just had to move all my yellows to
the
top row to make room for all my sand tiles. So that's the specific issue
I'm
facing. At the moment, using my updated palette turns all the UI colors
yellow.

I'd like to use yours at some point, actually, but the time it would take me
to convert 160 palettes, 300 backdrops, over 1,000 sprites, and so on to the
compatable colors would cause me unthinkable pain, and I'm not ready to take
that plunge yet. An update to how palettes are handled would certainly make
the effort more desirable.

i wrote an app which does that automatically (CHGPAL). have you tried
it on a copy of your rpg?
http://rpg.hamsterrepublic.com/ohrrpgce/Graphics_Utilities


CHGPAL doesn't handle box borders, portraits or UI colours, and it
uses the old master palette format instead of the new one, but it
shouldn't be much work to update it if desired.


It's a simple enough procedure that CUSTOM  could conceivably
implement it as an option on the master palette screen.


Yes, it would be good. I don't know how to best pick the nearest match
in the new palette for a colour (and should you let the user override
this somehow, as they can when importing backdrops?), but in this case
Jeremy just wants to move colours around the palette.



That's the part that made me question whether this was worth discussing.


have you seen
http://rpg.hamsterrepublic.com/ohrrpgce/Plan_for_256_color_sprites


I have, actually. But it was my understanding that this was still light
years
away from becoming reality, if it was ever meant to become reality.


I'm working on some formal YAML propositions regarding sprite
upgrades. They have the property of being very succint, so hopefully
that will help things to happen


What is a formal YAML proposition?? A proposal for a new graphics
format? I'm keen to have that agreed upon.


Just to add my two cents, I think PNG would be a good format for 
sprites. As a bonus, you can embed whatever metadata you might need 
directly in the image.



___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/3838 Oops! I was using Reload.rli* constants instead of Reload.rlt* constants

2010-10-06 Thread Mike Caron

On 10/7/2010 0:56, James Paige wrote:

On Wed, Oct 06, 2010 at 09:55:07PM -0700, subvers...@hamsterrepublic.com wrote:

james
2010-10-06 21:55:07 -0700 (Wed, 06 Oct 2010)
74
Oops! I was using Reload.rli* constants instead of Reload.rlt* constants!


Ha ha ha! You feel for my devious trap!


...

Honestly, though, I probably could have come up with a better name. 
And/or not put them in reload.bi, since they don't belong there.



Could anybody explain the difference between these to me? I see that the
rlt constants only have one integer type, what is the purpose of the rli
constants and their small multitude of different integer types?


rli (ReLoad Internal) are the types as stored on disk. Those constants 
are only used during loading/saving.


rlt (ReLoad Types) are the logical types as seen by clients (number, 
string, etc). They correspond to the GetInteger(), etc functions.



---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/3838 Oops! I was using Reload.rli* constants instead of Reload.rlt* constants

2010-10-06 Thread Mike Caron

On 10/7/2010 1:00, Mike Caron wrote:

On 10/7/2010 0:56, James Paige wrote:

On Wed, Oct 06, 2010 at 09:55:07PM -0700,
subvers...@hamsterrepublic.com wrote:

james
2010-10-06 21:55:07 -0700 (Wed, 06 Oct 2010)
74
Oops! I was using Reload.rli* constants instead of Reload.rlt*
constants!


Ha ha ha! You feel for my devious trap!


...

Honestly, though, I probably could have come up with a better name.
And/or not put them in reload.bi, since they don't belong there.


Could anybody explain the difference between these to me? I see that the
rlt constants only have one integer type, what is the purpose of the rli
constants and their small multitude of different integer types?


rli (ReLoad Internal) are the types as stored on disk. Those constants
are only used during loading/saving.

rlt (ReLoad Types) are the logical types as seen by clients (number,
string, etc). They correspond to the GetInteger(), etc functions.


Also, just looking at the editor's code, I noticed that you cap integers 
to be 16-bit signed. Is this a function of the grabber not supporting 
higher, or something else (since, RELOAD supports up to 64-bit integers)?



---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org




___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/3790 Attack queue is actually used now. (although non-blocking attacks are no

2010-09-27 Thread Mike Caron

On 9/27/2010 12:31 PM, James Paige wrote:

On Sun, Sep 26, 2010 at 07:45:13PM +1200, Ralph Versteegen wrote:

On 26 September 2010 17:53, James Paigeb...@hamsterrepublic.com  wrote:

On Sat, Sep 25, 2010 at 10:12:11PM -0700, subvers...@hamsterrepublic.com wrote:
=The way it WILL work eventually=
* An attack will be targetted and confirmed
* The attack and targetting and delay state will be stored
directly in the queue without ever going in bslot()
* When the delay runs out on the queued attack, the attack and
targetting stat will be copied directly to BattleState
* The attack will animate, using targetting state from BattleState, not
bslot()


Odd question: no possibility of multiple simultaneous attacks in
future? I understand that attack info is copied into BattleState for
convenience and because that was the easiest cleanup path, but that
precludes simultaneous attacks.


I am not ruling out the possibility of multiple simultaneous attacks in
the future, but I would consider that to be a separate transition. That
is all about cleaning up the attack animation code, whereas the attack
queue is all about cleaning up the attack targetting and delaying code.


The main reason I suggest supporting them is if people have
multitasking battlescripting, and might like have simultaneous
attacks, and use real attacks to do so rather than slice hackery.
Of course, it would hardly be easy to support; it'd present a whole
lot of problems to be solved.


I am having difficulty thinking of RPG games that allow simultaneous
attacks.

Not talking about combo-attacks, or other cases of multi-attacker attack
animations, which is certainly something we want to allow eventually.

What I am talking about is fully asynchronous simultaneous attacks. What
RPG does that? (so I can play it to get a better feel for it ;)


The only one that I can think of is SaGa Frontier. Although I've never 
played it, it seems that you can chain together normal attacks into 
pseudo combos to execute simultaneously? Or something? Man, the SaGa 
games are weird :S


http://www.youtube.com/watch?v=8Y_n1xcgusM

(spoilers if you can read japanese, I guess)


---
James Paige
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/3790 Attack queue is actually used now. (although non-blocking attacks are no

2010-09-27 Thread Mike Caron

On 9/27/2010 1:08 PM, James Paige wrote:

On Mon, Sep 27, 2010 at 12:51:40PM -0400, Mike Caron wrote:

On 9/27/2010 12:31 PM, James Paige wrote:

On Sun, Sep 26, 2010 at 07:45:13PM +1200, Ralph Versteegen wrote:

On 26 September 2010 17:53, James Paigeb...@hamsterrepublic.com   wrote:

On Sat, Sep 25, 2010 at 10:12:11PM -0700, subvers...@hamsterrepublic.com wrote:
=The way it WILL work eventually=
* An attack will be targetted and confirmed
* The attack and targetting and delay state will be stored
directly in the queue without ever going in bslot()
* When the delay runs out on the queued attack, the attack and
targetting stat will be copied directly to BattleState
* The attack will animate, using targetting state from BattleState, not
bslot()


Odd question: no possibility of multiple simultaneous attacks in
future? I understand that attack info is copied into BattleState for
convenience and because that was the easiest cleanup path, but that
precludes simultaneous attacks.


I am not ruling out the possibility of multiple simultaneous attacks in
the future, but I would consider that to be a separate transition. That
is all about cleaning up the attack animation code, whereas the attack
queue is all about cleaning up the attack targetting and delaying code.


The main reason I suggest supporting them is if people have
multitasking battlescripting, and might like have simultaneous
attacks, and use real attacks to do so rather than slice hackery.
Of course, it would hardly be easy to support; it'd present a whole
lot of problems to be solved.


I am having difficulty thinking of RPG games that allow simultaneous
attacks.

Not talking about combo-attacks, or other cases of multi-attacker attack
animations, which is certainly something we want to allow eventually.

What I am talking about is fully asynchronous simultaneous attacks. What
RPG does that? (so I can play it to get a better feel for it ;)


The only one that I can think of is SaGa Frontier. Although I've never
played it, it seems that you can chain together normal attacks into
pseudo combos to execute simultaneously? Or something? Man, the SaGa
games are weird :S

http://www.youtube.com/watch?v=8Y_n1xcgusM


I have that game. I am not 100% certain, but what i think is happening
there is just a combo-attack.


I should have said, most of it is where one animation begins before the 
last one has ended.


However, I can distinctly recall a game where each party member jumps 
forward and does their attack in quick succession, so that the 
animations line up something like:


---A---
---B
---C
---D
---E

I thought it was Suikoden 1 or 2, but I couldn't find any relevant clip...

Fakeedit: Yeah, it is Suikoden 2. Although each attack happens serially, 
the (non-flashy) unrelated animations overlap.


http://www.youtube.com/watch?v=UpmAltLjwF8


To get the same effect in the OHR, we would have a system like this:

* Attacker A does combo part 1
* Attacker B does combo part 2 before the delay runs out for Combo part 1
* Combo part 2 detects that combo part 1 is already queued by a valid
team member, and replaces its queue entry with a FullCombo attack.
* FullCombo would animate both attackers

At no time would we be simultaneously animating to unrelated attack
animations.

---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: kampu/3758 SConstruct based build system. Builds game, custom, and bam2mid currentl

2010-09-20 Thread Mike Caron

On 9/21/2010 1:56 AM, Seth Hetu wrote:

One more bit of info, from the scons wiki:

If possible on the platform, the duplication is performed by linking
rather than copying; see also the --duplicate command-line  option.
Moreover, only the files needed for the build are duplicated; files
and directories that are not used are not present in variant_dir.

So the files are _linked_ under Linux, which is why they compile
properly after svn up. Which is why we only see this bug on Windows.


The section you quoted seems to suggest that if linking is not possible 
(i.e., on Windows (actually, you can, but it's a pain)), it should copy, 
rather than fail. Just throwing that in there.



It might be relevant to say that I'm using Windows Vista 32-bit
Business Edition. Also, I have never used variant_dir before, so I am
unfamiliar with its effects.

--Seth



On Tue, Sep 21, 2010 at 1:52 PM, Seth Hetuseth.h...@gmail.com  wrote:

I may have found the source of both problems.

First, I updated to 0.21.1. (Just FYI). No noticeable change.

Next, I checked. Yes, udts.bi is in build/. HOWEVER, it does not
contain the definition of ZoneMap. And even stranger, the udts.bi in
the wip/ folder DOES.

This was especially odd, as I'd just done a scons -c. As reported
before, though, -c only cleans binary files. This _should_ have been
ok, though, since the source would have been copied into build/ and
then re-compiled. But it obviously was not.

So, my guess is that your scons script is failing to copy new source
changes to the build/ folder. Everything else works ok, since no
source file has changed in the build folder.

So something's wrong with the MD5 check on copying everything to the
build folder. Sure enough, deleting build and running scons
completed the build.

I'll have a look at the script; just wanted to give you guys a heads up.

--Seth




On Tue, Sep 21, 2010 at 8:59 AM, Ralph Versteegenteeem...@gmail.com  wrote:

On 21 September 2010 12:51, David Gowers (kampu)00a...@gmail.com  wrote:

On Tue, Sep 21, 2010 at 9:59 AM, Ralph Versteegenteeem...@gmail.com  wrote:

OK, now the killer problem: it doesn't rebuild anything when I edit a
file!!
Even if I run scons -c, it doesn't rebuild anything afterwards
(but maybe -c is completely unsupported?)

-c works fine for me.
Did you change the *content*, not just edit something in and out again?


Yes, I changed something.


To clarify : if I add a comment to game.bas, game.o will be rebuilt,
because I altered the MD5 sum. then ohrrpgce-game will *not* be
rebuilt, because game.o will have the same MD5 sum as before.
If your result differs from this, I agree it's a problem.


I should have said: I changed something significant.
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org




___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/3756 Last minute change to the zonemap file format: switch to a span-based fo

2010-09-16 Thread Mike Caron

On 9/16/2010 11:43 PM, subvers...@hamsterrepublic.com wrote:

teeemcee
2010-09-16 20:43:54 -0700 (Thu, 16 Sep 2010)
372
Last minute change to the zonemap file format: switch to a span-based format 
(as already documented on the Wiki)

This format is easier to write, but surprising slower to read and write (about 
half), and the file size is now mostly RELOAD overhead (wish Mike hadn't 
rejected my suggestions for better space efficiency).


Which ones were those? :S


Also finally added zonemap support to map resizing.
---
U   wip/loading.bas
U   wip/loading.bi
U   wip/mapsubs.bas
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/3756 Last minute change to the zonemap file format: switch to a span-based fo

2010-09-16 Thread Mike Caron

On 9/17/2010 12:01 AM, Ralph Versteegen wrote:

On 17 September 2010 15:46, Mike Caroncaron.m...@gmail.com  wrote:

On 9/16/2010 11:43 PM, subvers...@hamsterrepublic.com wrote:


teeemcee
2010-09-16 20:43:54 -0700 (Thu, 16 Sep 2010)
372
Last minute change to the zonemap file format: switch to a span-based
format (as already documented on the Wiki)

This format is easier to write, but surprising slower to read and write
(about half), and the file size is now mostly RELOAD overhead (wish Mike
hadn't rejected my suggestions for better space efficiency).


Which ones were those? :S


-Use a VLI instead of an INT for node size. Even if you reserve 4
bytes whenever the node has any children, and then write the size
later, you can probably use a single byte for leaf nodes.


Except, the reason I use four bytes is because:

1. It's very difficult to slide the rest of the file over to get rid 
of the extra space. Even if that were easy,

2. It would create a cascading effect on the sizes of all other nodes.

Both those problems would be solved if we rendered the file into memory 
first, but I'm not particularly enthused about writing this code.



-Add a bit to the type byte that indicates whether or not there are
any children, so that you can skip the VLI for number of children for leaves.


This is reasonable, since I don't foresee having to add any new types.


Those reduce the overhead from 7 bytes per leaf to 3. So if the
average size of a .Z 'spans' data node is 3 bytes (guessing), it's a
significant saving.



 I forgot that strings also have a size VLI, so it's actually 8 vs. 4.

I agree that it's significant.

An alternative, however, might be to forgo the size counts entirely. The 
reason they exist is to allow efficient scanning of the file in cases 
where you only care about part of the file. However, this is impossible 
with the current API, so...


Proposal: Bump the version to 2 and omit the size parameters entirely. 
Thoughts?



Also finally added zonemap support to map resizing.
---
U   wip/loading.bas
U   wip/loading.bi
U   wip/mapsubs.bas

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/3756 Last minute change to the zonemap file format: switch to a span-based fo

2010-09-16 Thread Mike Caron

On 9/17/2010 12:23 AM, Ralph Versteegen wrote:

On 17 September 2010 16:11, Mike Caroncaron.m...@gmail.com  wrote:

On 9/17/2010 12:01 AM, Ralph Versteegen wrote:


On 17 September 2010 15:46, Mike Caroncaron.m...@gmail.comwrote:


On 9/16/2010 11:43 PM, subvers...@hamsterrepublic.com wrote:


teeemcee
2010-09-16 20:43:54 -0700 (Thu, 16 Sep 2010)
372
Last minute change to the zonemap file format: switch to a span-based
format (as already documented on the Wiki)

This format is easier to write, but surprising slower to read and write
(about half), and the file size is now mostly RELOAD overhead (wish Mike
hadn't rejected my suggestions for better space efficiency).


Which ones were those? :S


-Use a VLI instead of an INT for node size. Even if you reserve 4
bytes whenever the node has any children, and then write the size
later, you can probably use a single byte for leaf nodes.


Except, the reason I use four bytes is because:

1. It's very difficult to slide the rest of the file over to get rid of
the extra space. Even if that were easy,
2. It would create a cascading effect on the sizes of all other nodes.


You misunderstood. I meant: if the node has no children, determining
the size is easy; otherwise reserve 4 bytes (27 bits: 134MB) and come
back and write the VLI later.


Both those problems would be solved if we rendered the file into memory
first, but I'm not particularly enthused about writing this code.


We do already write the file to memory first, but of course it's not
designed to do this.


The technique I've used in the past (albeit, in C# with MemoryStreams) 
is to create a buffer for the node's children, render the children 
(passing this buffer), and then rendering the node itself + the buffer 
into the parent's buffer.


The advantages are that you can do nice optimizations like the VLI 
thing. The downside is that it's a lot of memory management (especially 
without a garbage collector working behind the scenes!)



-Add a bit to the type byte that indicates whether or not there are
any children, so that you can skip the VLI for number of children for
leaves.


This is reasonable, since I don't foresee having to add any new types.


You'd still be able to have up to 128 types.


Yup, I was agreeing with you


Those reduce the overhead from 7 bytes per leaf to 3. So if the
average size of a .Z 'spans' data node is 3 bytes (guessing), it's a
significant saving.


I forgot that strings also have a size VLI, so it's actually 8 vs. 4.


I agree that it's significant.

An alternative, however, might be to forgo the size counts entirely. The
reason they exist is to allow efficient scanning of the file in cases where
you only care about part of the file. However, this is impossible with the
current API, so...


Huh? The sizes are used to skip over nodes when using delay loading.
Wasn't that exactly their intention? And that seems worth keeping.


Oh, yeah. Wow it's been a while. But, now I remember...

Hmm...


Another option would be to only include the sizes if the node has
children, but that's getting a bit messy.


Unfortunately, you don't know in advance whether a node has children or not.


Proposal: Bump the version to 2 and omit the size parameters entirely.
Thoughts?


I figured we would eventually create a new version, and that I would
not let my suggestions be excluded again; however there's no hurry to
do so now. I guess it's it wouldn't be much work though.


Honestly, though, does it really matter that much that there's 8 bytes 
of overhead instead of 4? I think the law of diminishing returns is 
kicking in here...



Also finally added zonemap support to map resizing.
---
U   wip/loading.bas
U   wip/loading.bi
U   wip/mapsubs.bas


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] BYREF

2010-09-14 Thread Mike Caron

On 9/14/2010 3:56 AM, Seth Hetu wrote:

I'd definitely avoid this situation with gusto. Consider passing '3'
(just the number) as by ref into the parameter 'x'  ---what happens
if the compiler inlines that variable, copying it to each place the
variable is used inside the function? That becomes problematic for,
e.g.,:
 x = 10
which becomes:
3 = 10


That's not how function inlining works. And fbc is miles off doing any
optimisations as significant as function inlining anyway.


I was under the impression that function inlining (e.g., inline
expansion) included constant propagation as one of its steps.



That, at least, is the reason it's illegal in C++ ---not sure what
the FB compiler says if you try this.


I don't think so. C++ can pass other types of temporary values by
reference, so I assume the reason it's illegal is that if you're
passing 3 by reference, it's probably an unintentional bug. Passing
by reference indicates that you want to pass a *variable* instead of a
value.

And like I said, it works in FB.


What you said makes more sense in this case. But then if passing by
reference always works in FB, what happens if you pass '3' as a
parameter by reference? Does it push a temporary variable to the stack
and store '3' in there? Does it declare a temporary variable on the
heap and pass its memory address to the function?


Why is there so much confusion by this? Variable allocation is trivial 
to do at compile time. If FB needs a temporary variable to pass to a 
BYREF argument, it just adds sizeof(thatvariable) to the stack size and 
calls it a night.


Or, looking at it from a different angle, why are you NOT surprised that 
you can do this in C?


myfunction(Literal string: omg no variable!);


I'm just curious how FB manages this without corrupting memory. It
seems like such a weird design choice.


Consider this. In QB, everything was BYREF by default. So, this had to 
be legal:


sub mysub(myparam as integer)
REM whatever
end sub

mysub 1

If it weren't legal, you'd get an error on a seemingly standard BASIC 
program.



--Seth
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] BYREF

2010-09-12 Thread Mike Caron

On 9/12/2010 10:31 PM, Seth Hetu wrote:

I have a feeling that this should be illegal in FB. I could totally see
FB forgetting that it stored a variable in its nondeclared variable
storage and overwriting it in a later function.


I'd definitely avoid this situation with gusto. Consider passing '3'
(just the number) as by ref into the parameter 'x'  ---what happens
if the compiler inlines that variable, copying it to each place the
variable is used inside the function? That becomes problematic for,
e.g.,:
 x = 10
which becomes:
3 = 10

That, at least, is the reason it's illegal in C++ ---not sure what
the FB compiler says if you try this. (Of course, in early Fortran
dialects, side-effecting 3 to 10 was completely possible... but that's
a whole different can of worms (and I've been told it doesn't work in
newer compilers).)


I imagine that any sane compiler would turn that situation into this:

dim temp as integer = 3

byrefsub(temp)



--Seth
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] BYREF

2010-09-12 Thread Mike Caron

On 9/13/2010 12:37 AM, Keith Gable wrote:

On Mon, 2010-09-13 at 00:33 -0400, Mike Caron wrote:

I imagine that any sane compiler would turn that situation into this:

dim temp as integer = 3

byrefsub(temp)



This is FreeBASIC we're talking about.  I'd be worried that it would
assume that memory is freed up when the goto/gosub/function/sub
finishes.


Who was talking about FreeBASIC? I said *sane* compiler. ;)


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] BYREF

2010-09-11 Thread Mike Caron

On 9/11/2010 4:27 PM, James Paige wrote:

I keep forgetting about BYREF. I know when to use it on ints, and I know
never to use it on strings, and I know it is utterly and completely
irrelvant on arrays

But what I can't remember is whether it matters for UDTs


You generally want to pass UDTs BYREF, especially if you want to modify 
the UDT in the sub. You can pass them BYVAL, but:


1. They will be read only (it passes a copy)
2. If the UDT is big and passed around frequently, it will be 
considerably slower than passing BYREF.



---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] BYREF

2010-09-11 Thread Mike Caron

On 9/11/2010 8:18 PM, Ralph Versteegen wrote:

On 12 September 2010 09:16, James Paigeb...@hamsterrepublic.com  wrote:

On Sat, Sep 11, 2010 at 05:06:22PM -0400, Mike Caron wrote:

On 9/11/2010 4:27 PM, James Paige wrote:

I keep forgetting about BYREF. I know when to use it on ints, and I know
never to use it on strings, and I know it is utterly and completely
irrelvant on arrays

But what I can't remember is whether it matters for UDTs


You generally want to pass UDTs BYREF, especially if you want to modify
the UDT in the sub. You can pass them BYVAL, but:

1. They will be read only (it passes a copy)
2. If the UDT is big and passed around frequently, it will be
considerably slower than passing BYREF.


But doesn't -lang deprecated pass them BYREF by default or something?

That would explain why all the many times I have forgotten to specify
BYREF on UDTs has not broken anything (that I have noticed yet).

---
James


UDTs by default are always passed BYREF, in all dialects, so I'd
rather we didn't specify BYREF.

What I didn't realise was that Option Byval changes UDTs to pass BYVAL
by default! Argh! How could the FB devs be so cruel to us! :(


You know, in most languages, UDTs are passed BYVAL BYDEF- er, by 
default. Like, in C for example.


Besides, wouldn't you want it to be consistent everywhere?


On the whole our code will be cleaner if we explicitly pass all UDTs
BYREF, declare Option Byval everywhere, and then remove all the
explicit BYVAL passing of integers. But I'm a bit less motivated to do
so now.
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] BYREF

2010-09-11 Thread Mike Caron

On 9/12/2010 1:01 AM, Keith Gable wrote:

On Sun, 2010-09-12 at 12:57 +1200, Ralph Versteegen wrote:

C didn't have references.


I thought that a reference in BASIC languages is the same thing as a
pointer in C languages. In VB6, ByVal creates a copy of the object (I'm
sure it does the same thing in FB), whereas ByRef is a pointer, even to
the extent that C APIs that follow the standard calling convention that
require pointers will work if you define the pointers as ByRef. Though
that same API could be declared ByVal but then you use AddressOf when
calling it.

[This site][1] seems to reinforce this, at least for VB6. Are things
different in FB? Just curious.

[1]: http://www.cpearson.com/excel/byrefbyval.aspx


No, you are correct. I will make a table:

||
|ALMOST EQUIVALENT THINGS|
||
| BASIC| C| C++  |
|--+--+--|
| BYREF| Pointers | References * |
|--+--+--|
| BYREF as integer | int *| int |
||

- BYVAL parameters are copies of the original, passed via stack. They 
can be modified with no consequence (unless it's a UDT with pointers, 
since the pointers will still point at the old data!)


- BYREF parameters are pointers, but they cannot be reassigned.

- Pointers are pointers (duh), but they CAN be reassigned.

- References are aliases to the variables they reference. They cannot be 
reassigned, and are effectively the same as the original variable.



___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] NPC instance script commands

2010-09-10 Thread Mike Caron

On 9/10/2010 10:58 AM, Ralph Versteegen wrote:

On 10 September 2010 03:18, James Paigeb...@hamsterrepublic.com  wrote:

On Thu, Sep 09, 2010 at 10:18:41PM +1200, Ralph Versteegen wrote:

Well, this email was originally going to be part of the one about SAV,
but then I remembered that NPC instance data has never been read from
.SAV!

I'd like start adding of data to NPC instances, like zone
restrictions. (I'll have to create an NPC instance editor.)
Actually, I already started.  A few months ago I wrote these (below),
but didn't check them in because I was waiting for .SAV to be dropped.
Opps! Sorry Jeremy!
But anyway, I just thought I may as well ask about functions for
reading/writing NPC instance data.

functions:
472,setnpcbit,3,0,0,1 #set NPC instance bit (npcref, bit, value)
473,getnpcbit,2,0,0   #get NPC instance bit (npcref, bit)

constants:
0,NPCbit:ignore walls
1,NPCbit:not obstruction
2,NPCbit:suspend use
3,NPCbit:suspend movement

(Incidentally, those bits are not actually stored as bits in the
UDT.) And then other non-flag data like zone restrictions would each
get a pair of getter/setting functions. Would people prefer something
more uniform like alter/read npc (below)? Or the opposite extreme of
individual read/write functions for each bit?

472,read npc instance,3,0,0,1 #set NPC instance data (npcref,
data id, value)
473,write npc instance,2,0,0   #get NPC instance data (npcref, data id)

0,NPCinst:ignore walls
1,NPCinst:not obstruction
2,NPCinst:suspend use
3,NPCinst:suspend movement
4,NPCinst:zone


I like individual functions for each bit. I may have advocated generic
functions with constants in the past, but I am really starting to hate
the heck out of them. it is all about what I want to be writing as an
end-user in my script:

# this is good
set npc ignore walls(npc, true)

# this is bad
set npc bit(npc, NPCbit:ignore walls, true)


Well, I choose the second approach because I hate having too many
functions (and having to document them :) ), because it makes the
dictionary extremely verbose: consulting a compact table as for
alternpc is much faster (I actually prefer read/alternpc to trying to
remember over 100 menu functions, for example). And our commands are
inconsistent and difficult to remember as a rule -- I can never
remember whether to use slice parent or parent slice -- so I end
up looking up an awful lot. However a few paragraphs of documentation
for every tiny bit is much more fair for people who aren't familiar
with engine internals in the first place.

However despite all that, I must agree with you: I didn't realise how
overly verbose the setnpcbit approach was.

But while we're on the topic of too many functions which are
impossible to remember, I think I'll sidetrack into adding structures
to HS, which I've been meaning to talk about. Having actually used
Euphoria a whole a couple months back, I take back what I said about
it being a nice language. I think not supporting user defined data
structures in the new HamsterSpeak is out of the question, it's just
unworkable.

And following this train of reasoning, if we have user defined
structures, and function objects, then we may as well add some form of
object orientation, since you're already nearly there.

And if we now present a slice handle, npc reference, menu handle or
whatever else as an object with members and/or methods, we can provide
an alternative way to interact these objects that's less verbose,
highly consistent, easy to remember and compactly documentable:
   menuitem.caption
instead of
   get menu item caption (menuitem)

   heroes[who].stats[stat.hp] += x
instead of
   set hero stat(who, stat:hp, get hero stat(who, stat:hp) + x)
and so on.

The exact details don't matter right now, but this is very similar to
the Magic Variables plan.


I'm having deja vu; this is a lot like the transition between the 
mathematical operators being functions and them being actual symbols. 
(although, this transition occurred long before I had ever used the OHR)


Hypothetically speaking, how would you implement these structs? Would 
you go for a classical model (like how they work in C), or something else?


If you're looking for suggestions, I think Lua has the best system. 
Basically, every variable that isn't a basic type (integer, string, etc) 
is a table (i.e., a set of key-value pairs). If the indicies are 
numeric, you call it an array, whereas if the keys are strings, you call 
it a hash. If the values are functions, then it must be an object.


Even better, you can set what's called a metatable, which defines 
functions that are called when the table is operated on, which allows 
you to simulate properties. The identity of an object is based on its 
metatable. If get_metatable(objA) == get_metatable(objB), then they must 
be instances of the same class.


One of Lua's interesting quirks is that it actually has two ways to 
invoke methods on objects. If you use the dot operator 

Re: [Ohrrpgce] Script structures/objects (Was: NPC instance script commands)

2010-09-10 Thread Mike Caron

On 9/10/2010 12:26 PM, Ralph Versteegen wrote:

On 11 September 2010 03:15, Mike Caroncaron.m...@gmail.com  wrote:

On 9/10/2010 10:58 AM, Ralph Versteegen wrote:


On 10 September 2010 03:18, James Paigeb...@hamsterrepublic.comwrote:


On Thu, Sep 09, 2010 at 10:18:41PM +1200, Ralph Versteegen wrote:


Well, this email was originally going to be part of the one about SAV,
but then I remembered that NPC instance data has never been read from
.SAV!

I'd like start adding of data to NPC instances, like zone
restrictions. (I'll have to create an NPC instance editor.)
Actually, I already started.  A few months ago I wrote these (below),
but didn't check them in because I was waiting for .SAV to be dropped.
Opps! Sorry Jeremy!
But anyway, I just thought I may as well ask about functions for
reading/writing NPC instance data.

functions:
472,setnpcbit,3,0,0,1 #set NPC instance bit (npcref, bit, value)
473,getnpcbit,2,0,0   #get NPC instance bit (npcref, bit)

constants:
0,NPCbit:ignore walls
1,NPCbit:not obstruction
2,NPCbit:suspend use
3,NPCbit:suspend movement

(Incidentally, those bits are not actually stored as bits in the
UDT.) And then other non-flag data like zone restrictions would each
get a pair of getter/setting functions. Would people prefer something
more uniform like alter/read npc (below)? Or the opposite extreme of
individual read/write functions for each bit?

472,read npc instance,3,0,0,1 #set NPC instance data (npcref,
data id, value)
473,write npc instance,2,0,0   #get NPC instance data (npcref,
data id)

0,NPCinst:ignore walls
1,NPCinst:not obstruction
2,NPCinst:suspend use
3,NPCinst:suspend movement
4,NPCinst:zone


I like individual functions for each bit. I may have advocated generic
functions with constants in the past, but I am really starting to hate
the heck out of them. it is all about what I want to be writing as an
end-user in my script:

# this is good
set npc ignore walls(npc, true)

# this is bad
set npc bit(npc, NPCbit:ignore walls, true)


Well, I choose the second approach because I hate having too many
functions (and having to document them :) ), because it makes the
dictionary extremely verbose: consulting a compact table as for
alternpc is much faster (I actually prefer read/alternpc to trying to
remember over 100 menu functions, for example). And our commands are
inconsistent and difficult to remember as a rule -- I can never
remember whether to use slice parent or parent slice -- so I end
up looking up an awful lot. However a few paragraphs of documentation
for every tiny bit is much more fair for people who aren't familiar
with engine internals in the first place.

However despite all that, I must agree with you: I didn't realise how
overly verbose the setnpcbit approach was.

But while we're on the topic of too many functions which are
impossible to remember, I think I'll sidetrack into adding structures
to HS, which I've been meaning to talk about. Having actually used
Euphoria a whole a couple months back, I take back what I said about
it being a nice language. I think not supporting user defined data
structures in the new HamsterSpeak is out of the question, it's just
unworkable.

And following this train of reasoning, if we have user defined
structures, and function objects, then we may as well add some form of
object orientation, since you're already nearly there.

And if we now present a slice handle, npc reference, menu handle or
whatever else as an object with members and/or methods, we can provide
an alternative way to interact these objects that's less verbose,
highly consistent, easy to remember and compactly documentable:
   menuitem.caption
instead of
   get menu item caption (menuitem)

   heroes[who].stats[stat.hp] += x
instead of
   set hero stat(who, stat:hp, get hero stat(who, stat:hp) + x)
and so on.

The exact details don't matter right now, but this is very similar to
the Magic Variables plan.


I'm having deja vu; this is a lot like the transition between the
mathematical operators being functions and them being actual symbols.
(although, this transition occurred long before I had ever used the OHR)

Hypothetically speaking, how would you implement these structs? Would you go
for a classical model (like how they work in C), or something else?


I was thinking something along the lines of Python or Lua, which
implement objects in very similar ways. I'm not all that familiar with
Lua though.

We can afford to be less flexible than these though. For example,
should you be able to add new members to builtin data types, like
setting npcref.is_hallucinating := true? (Realise that if we do this,
it would be handled entirely by the script interpreter, and in fact I
think it's quite likely we can add builtin types without having to
significantly modify any existing commands beyond what's needed for
dynamic types anyway) I think it looks elegant, but isn't there a rule
of thumb that composition is preferred to 

Re: [Ohrrpgce] Binary data in RELOAD to XML?

2010-08-23 Thread Mike Caron

On 8/23/2010 8:19 AM, Ralph Versteegen wrote:

On 23 August 2010 05:24, Mike Caroncaron.m...@gmail.com  wrote:

On 8/22/2010 3:23 AM, Ralph Versteegen wrote:


On 22 August 2010 08:14, Mike Caroncaron.m...@gmail.comwrote:


On 8/21/2010 3:55 PM, Ralph Versteegen wrote:


On 21 August 2010 05:22, Mike Caroncaron.m...@gmail.com  wrote:


On 8/20/2010 1:15 PM, Ralph Versteegen wrote:


On 21 August 2010 05:11, James Paigeb...@hamsterrepublic.com
  wrote:


On Fri, Aug 20, 2010 at 12:55:50PM -0400, Mike Caron wrote:


On 8/20/2010 12:52 PM, Ralph Versteegen wrote:


On 21 August 2010 04:43, Mike Caroncaron.m...@gmail.com
  wrote:


On 8/20/2010 12:41 PM, Ralph Versteegen wrote:


On 21 August 2010 03:58, Mike Caroncaron.m...@gmail.com
  wrote:


On 8/20/2010 11:45 AM, Ralph Versteegen wrote:


On 21 August 2010 02:24, Mike Caroncaron.m...@gmail.com
  wrote:


On 8/20/2010 9:58 AM, Ralph Versteegen wrote:


Currently reload2xml can't properly export binary data stored
in
strings in reload files. It would be nice to be able to hand
edit
xml
and convert back. What's the preferred way to write
binary?#nnn;
escape codes, or that Base64 stuff? (Is that actually part of
the
xml
standard?)


Strictly speaking, we only really need to escape characters
below
32.
Everything else should be okay to write out.


Follow-up question: what about bytes above 127? Is there a
chance
of
confusing xml parsers into guessing UTF8 encoding? I suppose it
doesn't matter too much, since we can force libxml2 to read
with
ASCII
encoding (but it would be nice to know that we have to do so).


The best way to handle this, actually, would be to add the XML
header,
which
allows you to specify the encoding. In our case, it should look
something
like:

?xml version=1.0 encoding=iso-8859-1?


In light of that, I would prefer the#; syntax, since it
means
that
no
one has to do any extra work to process the resulting XML
file.
If
you
used
Base64 (which has nothing to do with XML), you'd have to mark
it
as
such
in
order to distinguish it from a regular string that just so
happens
to
look
like Base64.


OK, cool. I'll add that then soonish (unless you jumped on the
chance to
do so).


No, go ahead.


Change of plan required.

' #0; is not permitted, however, as the null character is one
of
the control characters excluded from XML, even when using a
numeric
character reference.[14] An alternative encoding mechanism such
as
Base64 is needed to represent such characters. ' - Wikipedia

And I just confirmed libxml2 spits.


Damn. I guess that kind of makes sense, though.

Maybe... emit anull/  element instead? Ugh.

Or, Base64 it. Sigh.


Well, I know next to nothing about XML, what's the idiomatic way to
do
that? Add a special attribute to nodes containing base64-encoded
data,
likefoo base=64assdfasdf234/foo  ?


No, the proper way to do this is something like this:

basenode xmlns:reload=http://hamsterrepublic.com/RELOAD;
foo reload:encoding=base64.../foo
/basenode

Note: that namespace URL doesn't have to exist, it just has to be
unique.


At first I thought you may be pulling my leg and going overboard...
but such is XML!


Actually, we could just cheese it and say:

root xmlns:reload=uri:reload

But, that's considered bad form.

The only reason I'm suggesting using namespaces is because the
structure
and
the data are intermingled. How is xml2reload supposed to know if
base=64
means that the node is encoded, or it represents a strangely-based
number,
or that all your base count up to 64?


reload:base=64 would be perfectly unambiguous if it were agreed
upon, though. But I agree it would be pretty weird.


It would be, yes. But, then when we add some other encoding for some
reason... etc etc


Another, more XMLish way, might be to encode documents like this:

RELOADDocument
node
nameroot/name
typenull/type
children
node
namemynode/name
typestring/type
content123/content
children.../children
/node
/children
/node
/RELOADDocument

Now who's pulling whose leg? ;)


Ugh I hate XML (and libxml) so much. I volunteered for this when I
thought it was going to be a quick fix with#nnn; but now I'm in XML
deeper than I ever hoped to get in my life.


Should have taken the blue pill...


Anyway some more problems I'd likesapproval/s  suggestions on:
* null-name nodes? We already use these in RELOAD documents. The
solution I came up with is to write the name as 'reload:_' and convert
it back to a null name in xml2reload (while still being able to
distinguish the null-name nodes libxml2 inserts). Was this a good
choice?


Sure, that seems like a reasonable solution.


* strings with leading/trailing whitespace.


Whitespace is a bitch in XML. I had quite a bit of trouble, back when I
did
the plotscripting dictionary, since hssed wanted such particular spacing
for
the help file!


I am quite certain now

Re: [Ohrrpgce] LibXML2 sucks?

2010-08-23 Thread Mike Caron

On 8/23/2010 8:04 AM, Ralph Versteegen wrote:

On 23 August 2010 10:45, Mike Caroncaron.m...@gmail.com  wrote:

The other email thread was getting kinda big, and this is tangentially
related, so here's a separate thread.

TMC, you mentioned that LibXML2 was eating nodes with all whitespace. I am
unable to reproduce this problem.

Using this document:

node
text beforechild  text inside/childtext after
blanknode   /blanknode
/node

And, this program:

void print_element_names(xmlNode * a_node) {
xmlNode *cur_node = NULL;

for (cur_node = a_node; cur_node; cur_node = cur_node-next) {
for(int i = 0; i  indent; i++) printf(  );

switch(cur_node-type) {
case XML_ELEMENT_NODE:
printf(node type: Element, name: %s\n, cur_node-name);
break;
case XML_TEXT_NODE:
printf(node type: Text, content: \%s\\n,
xmlNodeGetContent(cur_node));
break;
}

indent++;
print_element_names(cur_node-children);
indent--;
}
}

(set up code omitted, and in C because that's what the sample I tweaked was
in)

I got this output:

D:\projects\LibXml2Testdebug\LibXml2Test.exe ws.xml
node type: Element, name: node
  node type: Text, content: 
text before
  node type: Element, name: child
node type: Text, content:  text inside 
  node type: Text, content: text after

  node type: Element, name: blanknode
node type: Text, content:  
  node type: Text, content: 


So, it appears to be preserving whitespace properly.


Ah! I see what's going. xml2reload was using xmlNodeIsEmpty, which I'd
failed to notice. Knowing that, I managed to get everything working
without quotes.


Yay!


Why don't you commit what you have, and I will take a look at it?


OK... you asked for it!


Okay, let me just check my blackberry this mornin- holy crap!


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/3668 More horror! MenuDefs are meant to be deleted with ClearMenuData, or the

2010-08-23 Thread Mike Caron

On 8/23/2010 1:39 PM, James Paige wrote:

On Tue, Aug 24, 2010 at 05:22:00AM +1200, Ralph Versteegen wrote:

On 24 August 2010 04:33, James Paigeb...@hamsterrepublic.com  wrote:

On Mon, Aug 23, 2010 at 04:56:27AM -0700, subvers...@hamsterrepublic.com wrote:

teeemcee
2010-08-23 04:56:27 -0700 (Mon, 23 Aug 2010)
218
More horror! MenuDefs are meant to be deleted with ClearMenuData, or they leak 
all their items! Fix the numerous places where we were doing that.

It would be REALLY great if FB let us use constructors and destructors.


Isn't -lang deprecated the thing that is holding us back from using
them?

---
James


Yep.

There are a few UDTs now which have to be manually destructed, and I
feel really bad every time I introduce one because it makes our code
less friendly and more and more C-like.

I suspect that constructor and destructor support could be added to
-lang deprecated by patching a few lines in the compiler, and I am
almost considering trying it. And if I didn't have all these OHR
features to work on, I would definitely be working on fb2c++ right
now.


Have you been following the forum thread in which a couple people have
threatened to bribe you to work on it with the goal of an XNA port?


What, really? While I would really enjoy a .NET port of free basic, I 
doubt this would happen any time in the near future.



---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/3668 More horror! MenuDefs are meant to be deleted with ClearMenuData, or the

2010-08-23 Thread Mike Caron

On 8/23/2010 1:39 PM, James Paige wrote:

On Tue, Aug 24, 2010 at 05:22:00AM +1200, Ralph Versteegen wrote:

On 24 August 2010 04:33, James Paigeb...@hamsterrepublic.com  wrote:

On Mon, Aug 23, 2010 at 04:56:27AM -0700, subvers...@hamsterrepublic.com wrote:

teeemcee
2010-08-23 04:56:27 -0700 (Mon, 23 Aug 2010)
218
More horror! MenuDefs are meant to be deleted with ClearMenuData, or they leak 
all their items! Fix the numerous places where we were doing that.

It would be REALLY great if FB let us use constructors and destructors.


Isn't -lang deprecated the thing that is holding us back from using
them?

---
James


Yep.

There are a few UDTs now which have to be manually destructed, and I
feel really bad every time I introduce one because it makes our code
less friendly and more and more C-like.

I suspect that constructor and destructor support could be added to
-lang deprecated by patching a few lines in the compiler, and I am
almost considering trying it. And if I didn't have all these OHR
features to work on, I would definitely be working on fb2c++ right
now.


Have you been following the forum thread in which a couple people have
threatened to bribe you to work on it with the goal of an XNA port?


What, really? While I would really enjoy a .NET port of free basic, I 
doubt this would happen any time in the near future.



---
James
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Binary data in RELOAD to XML?

2010-08-22 Thread Mike Caron

On 8/22/2010 3:23 AM, Ralph Versteegen wrote:

On 22 August 2010 08:14, Mike Caroncaron.m...@gmail.com  wrote:

On 8/21/2010 3:55 PM, Ralph Versteegen wrote:


On 21 August 2010 05:22, Mike Caroncaron.m...@gmail.comwrote:


On 8/20/2010 1:15 PM, Ralph Versteegen wrote:


On 21 August 2010 05:11, James Paigeb...@hamsterrepublic.com  wrote:


On Fri, Aug 20, 2010 at 12:55:50PM -0400, Mike Caron wrote:


On 8/20/2010 12:52 PM, Ralph Versteegen wrote:


On 21 August 2010 04:43, Mike Caroncaron.m...@gmail.comwrote:


On 8/20/2010 12:41 PM, Ralph Versteegen wrote:


On 21 August 2010 03:58, Mike Caroncaron.m...@gmail.com
  wrote:


On 8/20/2010 11:45 AM, Ralph Versteegen wrote:


On 21 August 2010 02:24, Mike Caroncaron.m...@gmail.com
  wrote:


On 8/20/2010 9:58 AM, Ralph Versteegen wrote:


Currently reload2xml can't properly export binary data stored
in
strings in reload files. It would be nice to be able to hand
edit
xml
and convert back. What's the preferred way to write
binary?#nnn;
escape codes, or that Base64 stuff? (Is that actually part of
the
xml
standard?)


Strictly speaking, we only really need to escape characters
below
32.
Everything else should be okay to write out.


Follow-up question: what about bytes above 127? Is there a chance
of
confusing xml parsers into guessing UTF8 encoding? I suppose it
doesn't matter too much, since we can force libxml2 to read with
ASCII
encoding (but it would be nice to know that we have to do so).


The best way to handle this, actually, would be to add the XML
header,
which
allows you to specify the encoding. In our case, it should look
something
like:

?xml version=1.0 encoding=iso-8859-1?


In light of that, I would prefer the#; syntax, since it
means
that
no
one has to do any extra work to process the resulting XML file.
If
you
used
Base64 (which has nothing to do with XML), you'd have to mark it
as
such
in
order to distinguish it from a regular string that just so
happens
to
look
like Base64.


OK, cool. I'll add that then soonish (unless you jumped on the
chance to
do so).


No, go ahead.


Change of plan required.

' #0; is not permitted, however, as the null character is one of
the control characters excluded from XML, even when using a numeric
character reference.[14] An alternative encoding mechanism such as
Base64 is needed to represent such characters. ' - Wikipedia

And I just confirmed libxml2 spits.


Damn. I guess that kind of makes sense, though.

Maybe... emit anull/element instead? Ugh.

Or, Base64 it. Sigh.


Well, I know next to nothing about XML, what's the idiomatic way to
do
that? Add a special attribute to nodes containing base64-encoded
data,
likefoo base=64assdfasdf234/foo?


No, the proper way to do this is something like this:

basenode xmlns:reload=http://hamsterrepublic.com/RELOAD;
foo reload:encoding=base64.../foo
/basenode

Note: that namespace URL doesn't have to exist, it just has to be
unique.


At first I thought you may be pulling my leg and going overboard...
but such is XML!


Actually, we could just cheese it and say:

root xmlns:reload=uri:reload

But, that's considered bad form.

The only reason I'm suggesting using namespaces is because the structure
and
the data are intermingled. How is xml2reload supposed to know if
base=64
means that the node is encoded, or it represents a strangely-based
number,
or that all your base count up to 64?


reload:base=64 would be perfectly unambiguous if it were agreed
upon, though. But I agree it would be pretty weird.


It would be, yes. But, then when we add some other encoding for some
reason... etc etc


Another, more XMLish way, might be to encode documents like this:

RELOADDocument
node
nameroot/name
typenull/type
children
node
namemynode/name
typestring/type
content123/content
children.../children
/node
/children
/node
/RELOADDocument

Now who's pulling whose leg? ;)


Ugh I hate XML (and libxml) so much. I volunteered for this when I
thought it was going to be a quick fix with#nnn; but now I'm in XML
deeper than I ever hoped to get in my life.


Should have taken the blue pill...


Anyway some more problems I'd likesapproval/ssuggestions on:
* null-name nodes? We already use these in RELOAD documents. The
solution I came up with is to write the name as 'reload:_' and convert
it back to a null name in xml2reload (while still being able to
distinguish the null-name nodes libxml2 inserts). Was this a good
choice?


Sure, that seems like a reasonable solution.


* strings with leading/trailing whitespace.


Whitespace is a bitch in XML. I had quite a bit of trouble, back when I did
the plotscripting dictionary, since hssed wanted such particular spacing for
the help file!


I am quite certain now that using XML to represent RELOAD documents as
text was a horrible idea, and we should have used something very

[Ohrrpgce] LibXML2 sucks?

2010-08-22 Thread Mike Caron
The other email thread was getting kinda big, and this is tangentially 
related, so here's a separate thread.


TMC, you mentioned that LibXML2 was eating nodes with all whitespace. I 
am unable to reproduce this problem.


Using this document:

node
text beforechild text inside /childtext after
blanknode /blanknode
/node

And, this program:

void print_element_names(xmlNode * a_node) {
xmlNode *cur_node = NULL;

for (cur_node = a_node; cur_node; cur_node = cur_node-next) {
for(int i = 0; i  indent; i++) printf(  );

switch(cur_node-type) {
case XML_ELEMENT_NODE:
printf(node type: Element, name: %s\n, cur_node-name);
break;
case XML_TEXT_NODE:
printf(node type: Text, content: \%s\\n, 
xmlNodeGetContent(cur_node));

break;
}

indent++;
print_element_names(cur_node-children);
indent--;
}
}

(set up code omitted, and in C because that's what the sample I tweaked 
was in)


I got this output:

D:\projects\LibXml2Testdebug\LibXml2Test.exe ws.xml
node type: Element, name: node
  node type: Text, content: 
text before
  node type: Element, name: child
node type: Text, content:  text inside 
  node type: Text, content: text after

  node type: Element, name: blanknode
node type: Text, content:  
  node type: Text, content: 


So, it appears to be preserving whitespace properly.

Why don't you commit what you have, and I will take a look at it?
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Binary data in RELOAD to XML?

2010-08-21 Thread Mike Caron

On 8/21/2010 3:55 PM, Ralph Versteegen wrote:

On 21 August 2010 05:22, Mike Caroncaron.m...@gmail.com  wrote:

On 8/20/2010 1:15 PM, Ralph Versteegen wrote:


On 21 August 2010 05:11, James Paigeb...@hamsterrepublic.comwrote:


On Fri, Aug 20, 2010 at 12:55:50PM -0400, Mike Caron wrote:


On 8/20/2010 12:52 PM, Ralph Versteegen wrote:


On 21 August 2010 04:43, Mike Caroncaron.m...@gmail.com  wrote:


On 8/20/2010 12:41 PM, Ralph Versteegen wrote:


On 21 August 2010 03:58, Mike Caroncaron.m...@gmail.comwrote:


On 8/20/2010 11:45 AM, Ralph Versteegen wrote:


On 21 August 2010 02:24, Mike Caroncaron.m...@gmail.com
  wrote:


On 8/20/2010 9:58 AM, Ralph Versteegen wrote:


Currently reload2xml can't properly export binary data stored in
strings in reload files. It would be nice to be able to hand edit
xml
and convert back. What's the preferred way to write binary?#nnn;
escape codes, or that Base64 stuff? (Is that actually part of the
xml
standard?)


Strictly speaking, we only really need to escape characters below
32.
Everything else should be okay to write out.


Follow-up question: what about bytes above 127? Is there a chance
of
confusing xml parsers into guessing UTF8 encoding? I suppose it
doesn't matter too much, since we can force libxml2 to read with
ASCII
encoding (but it would be nice to know that we have to do so).


The best way to handle this, actually, would be to add the XML
header,
which
allows you to specify the encoding. In our case, it should look
something
like:

?xml version=1.0 encoding=iso-8859-1?


In light of that, I would prefer the#; syntax, since it means
that
no
one has to do any extra work to process the resulting XML file. If
you
used
Base64 (which has nothing to do with XML), you'd have to mark it
as
such
in
order to distinguish it from a regular string that just so happens
to
look
like Base64.


OK, cool. I'll add that then soonish (unless you jumped on the
chance to
do so).


No, go ahead.


Change of plan required.

' #0; is not permitted, however, as the null character is one of
the control characters excluded from XML, even when using a numeric
character reference.[14] An alternative encoding mechanism such as
Base64 is needed to represent such characters. ' - Wikipedia

And I just confirmed libxml2 spits.


Damn. I guess that kind of makes sense, though.

Maybe... emit anull/  element instead? Ugh.

Or, Base64 it. Sigh.


Well, I know next to nothing about XML, what's the idiomatic way to do
that? Add a special attribute to nodes containing base64-encoded data,
likefoo base=64assdfasdf234/foo  ?


No, the proper way to do this is something like this:

basenode xmlns:reload=http://hamsterrepublic.com/RELOAD;
foo reload:encoding=base64.../foo
/basenode

Note: that namespace URL doesn't have to exist, it just has to be
unique.


At first I thought you may be pulling my leg and going overboard...
but such is XML!


Actually, we could just cheese it and say:

root xmlns:reload=uri:reload

But, that's considered bad form.

The only reason I'm suggesting using namespaces is because the structure and
the data are intermingled. How is xml2reload supposed to know if base=64
means that the node is encoded, or it represents a strangely-based number,
or that all your base count up to 64?


reload:base=64 would be perfectly unambiguous if it were agreed
upon, though. But I agree it would be pretty weird.


It would be, yes. But, then when we add some other encoding for some 
reason... etc etc



Another, more XMLish way, might be to encode documents like this:

RELOADDocument
node
nameroot/name
typenull/type
children
node
namemynode/name
typestring/type
content123/content
children.../children
/node
/children
/node
/RELOADDocument

Now who's pulling whose leg? ;)


Ugh I hate XML (and libxml) so much. I volunteered for this when I
thought it was going to be a quick fix with#nnn; but now I'm in XML
deeper than I ever hoped to get in my life.


Should have taken the blue pill...


Anyway some more problems I'd likesapproval/s  suggestions on:
* null-name nodes? We already use these in RELOAD documents. The
solution I came up with is to write the name as 'reload:_' and convert
it back to a null name in xml2reload (while still being able to
distinguish the null-name nodes libxml2 inserts). Was this a good
choice?


Sure, that seems like a reasonable solution.


* strings with leading/trailing whitespace.


Whitespace is a bitch in XML. I had quite a bit of trouble, back when I 
did the plotscripting dictionary, since hssed wanted such particular 
spacing for the help file!



xml2reload currently
strips it, but it doesn't have to. My first idea was:
foo reload:encoding=exact  lots of
white   spacechild.../child
  child.../child
/foo
As you can see, the first child if any has to be smack against the end
of the string

Re: [Ohrrpgce] Binary data in RELOAD to XML?

2010-08-20 Thread Mike Caron

On 8/20/2010 11:45 AM, Ralph Versteegen wrote:

On 21 August 2010 02:24, Mike Caroncaron.m...@gmail.com  wrote:

On 8/20/2010 9:58 AM, Ralph Versteegen wrote:


Currently reload2xml can't properly export binary data stored in
strings in reload files. It would be nice to be able to hand edit xml
and convert back. What's the preferred way to write binary?#nnn;
escape codes, or that Base64 stuff? (Is that actually part of the xml
standard?)


Strictly speaking, we only really need to escape characters below 32.
Everything else should be okay to write out.


Follow-up question: what about bytes above 127? Is there a chance of
confusing xml parsers into guessing UTF8 encoding? I suppose it
doesn't matter too much, since we can force libxml2 to read with ASCII
encoding (but it would be nice to know that we have to do so).


The best way to handle this, actually, would be to add the XML header, 
which allows you to specify the encoding. In our case, it should look 
something like:


?xml version=1.0 encoding=iso-8859-1?


In light of that, I would prefer the#; syntax, since it means that no
one has to do any extra work to process the resulting XML file. If you used
Base64 (which has nothing to do with XML), you'd have to mark it as such in
order to distinguish it from a regular string that just so happens to look
like Base64.


OK, cool. I'll add that then soonish (unless you jumped on the chance to do so).


No, go ahead.


I had thought there was some semi-standard for base64 strings in xml:
http://www.xml.com/pub/a/98/07/binary/binary.html


That article just explores different ways of embedding binary data. 
There's no standard for this sort of thing. Base64 would be the closest 
thing to a proper solution, being used in different applications 
already (eg, embedded resources in HTML). The drawback is a flat 33% 
size increase, compared to the raw data.


In comparison, the entity solution would be a 600% increase for 
encoded bytes, and 0% for anything else. (plus, no special handling 
required for parsers)


The MIME idea proposed in that article is interesting, but even more 
complicated than Base64, and not really suited for our purposes.



___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Binary data in RELOAD to XML?

2010-08-20 Thread Mike Caron

On 8/20/2010 12:41 PM, Ralph Versteegen wrote:

On 21 August 2010 03:58, Mike Caroncaron.m...@gmail.com  wrote:

On 8/20/2010 11:45 AM, Ralph Versteegen wrote:


On 21 August 2010 02:24, Mike Caroncaron.m...@gmail.comwrote:


On 8/20/2010 9:58 AM, Ralph Versteegen wrote:


Currently reload2xml can't properly export binary data stored in
strings in reload files. It would be nice to be able to hand edit xml
and convert back. What's the preferred way to write binary?#nnn;
escape codes, or that Base64 stuff? (Is that actually part of the xml
standard?)


Strictly speaking, we only really need to escape characters below 32.
Everything else should be okay to write out.


Follow-up question: what about bytes above 127? Is there a chance of
confusing xml parsers into guessing UTF8 encoding? I suppose it
doesn't matter too much, since we can force libxml2 to read with ASCII
encoding (but it would be nice to know that we have to do so).


The best way to handle this, actually, would be to add the XML header, which
allows you to specify the encoding. In our case, it should look something
like:

?xml version=1.0 encoding=iso-8859-1?


In light of that, I would prefer the#; syntax, since it means that
no
one has to do any extra work to process the resulting XML file. If you
used
Base64 (which has nothing to do with XML), you'd have to mark it as such
in
order to distinguish it from a regular string that just so happens to
look
like Base64.


OK, cool. I'll add that then soonish (unless you jumped on the chance to
do so).


No, go ahead.


Change of plan required.

' #0; is not permitted, however, as the null character is one of
the control characters excluded from XML, even when using a numeric
character reference.[14] An alternative encoding mechanism such as
Base64 is needed to represent such characters. ' - Wikipedia

And I just confirmed libxml2 spits.


Damn. I guess that kind of makes sense, though.

Maybe... emit a null/ element instead? Ugh.

Or, Base64 it. Sigh.


I had thought there was some semi-standard for base64 strings in xml:
http://www.xml.com/pub/a/98/07/binary/binary.html


That article just explores different ways of embedding binary data. There's
no standard for this sort of thing. Base64 would be the closest thing to a
proper solution, being used in different applications already (eg,
embedded resources in HTML). The drawback is a flat 33% size increase,
compared to the raw data.

In comparison, the entity solution would be a 600% increase for encoded
bytes, and 0% for anything else. (plus, no special handling required for
parsers)

The MIME idea proposed in that article is interesting, but even more
complicated than Base64, and not really suited for our purposes.

___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Binary data in RELOAD to XML?

2010-08-20 Thread Mike Caron

On 8/20/2010 12:52 PM, Ralph Versteegen wrote:

On 21 August 2010 04:43, Mike Caroncaron.m...@gmail.com  wrote:

On 8/20/2010 12:41 PM, Ralph Versteegen wrote:


On 21 August 2010 03:58, Mike Caroncaron.m...@gmail.comwrote:


On 8/20/2010 11:45 AM, Ralph Versteegen wrote:


On 21 August 2010 02:24, Mike Caroncaron.m...@gmail.com  wrote:


On 8/20/2010 9:58 AM, Ralph Versteegen wrote:


Currently reload2xml can't properly export binary data stored in
strings in reload files. It would be nice to be able to hand edit xml
and convert back. What's the preferred way to write binary?#nnn;
escape codes, or that Base64 stuff? (Is that actually part of the xml
standard?)


Strictly speaking, we only really need to escape characters below 32.
Everything else should be okay to write out.


Follow-up question: what about bytes above 127? Is there a chance of
confusing xml parsers into guessing UTF8 encoding? I suppose it
doesn't matter too much, since we can force libxml2 to read with ASCII
encoding (but it would be nice to know that we have to do so).


The best way to handle this, actually, would be to add the XML header,
which
allows you to specify the encoding. In our case, it should look something
like:

?xml version=1.0 encoding=iso-8859-1?


In light of that, I would prefer the#; syntax, since it means that
no
one has to do any extra work to process the resulting XML file. If you
used
Base64 (which has nothing to do with XML), you'd have to mark it as
such
in
order to distinguish it from a regular string that just so happens to
look
like Base64.


OK, cool. I'll add that then soonish (unless you jumped on the chance to
do so).


No, go ahead.


Change of plan required.

' #0; is not permitted, however, as the null character is one of
the control characters excluded from XML, even when using a numeric
character reference.[14] An alternative encoding mechanism such as
Base64 is needed to represent such characters. ' - Wikipedia

And I just confirmed libxml2 spits.


Damn. I guess that kind of makes sense, though.

Maybe... emit anull/  element instead? Ugh.

Or, Base64 it. Sigh.


Well, I know next to nothing about XML, what's the idiomatic way to do
that? Add a special attribute to nodes containing base64-encoded data,
likefoo base=64assdfasdf234/foo  ?


No, the proper way to do this is something like this:

basenode xmlns:reload=http://hamsterrepublic.com/RELOAD;
   foo reload:encoding=base64.../foo
/basenode

Note: that namespace URL doesn't have to exist, it just has to be unique.


I had thought there was some semi-standard for base64 strings in xml:
http://www.xml.com/pub/a/98/07/binary/binary.html


That article just explores different ways of embedding binary data.
There's
no standard for this sort of thing. Base64 would be the closest thing to
a
proper solution, being used in different applications already (eg,
embedded resources in HTML). The drawback is a flat 33% size increase,
compared to the raw data.

In comparison, the entity solution would be a 600% increase for encoded
bytes, and 0% for anything else. (plus, no special handling required for
parsers)

The MIME idea proposed in that article is interesting, but even more
complicated than Base64, and not really suited for our purposes.


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: pkmnfrk/3584 Finally added support for RELOAD delay loading: (see below for details)

2010-06-02 Thread Mike Caron

On 02/06/2010 2:49 AM, Ralph Versteegen wrote:

On 2 June 2010 10:33,subvers...@hamsterrepublic.com  wrote:

pkmnfrk
2010-06-01 15:33:51 -0700 (Tue, 01 Jun 2010)
1806
Finally added support for RELOAD delay loading: (see below for details)

- Added new utility reloadtime.bas, which times exactly how long it takes to 
load any random RELOAD document.

- reload2xml now passes optNoDelay, since it does not benefit from delay loading

- reloadTest now includes two document comparison tests: first with no delay 
loading, and then again with delay loading.

- xml2reload now display memory usage (again? I don't know if I ever committed 
this change), and frees the XML document before optimizing the RELOAD tree (I 
meant to commit this two days ago)

Delay Loading: This means that nodes will only be loaded from disk as they are 
accessed. Depending on what the tree is being used for this can be a huge time 
saver. The ideal use-case for this feature would be the hypothetical Textbox 
lump, whereby only the textboxes that are referenced are actually loaded. This 
would speed up loading the document initially, with the tradeoff of spreading 
out the document load to later.

Basically, it works like this:

1. When the document is loaded, the root node (including data) is loaded, but 
its children are not.
2. If its children are requested (eg, by calling GetFirstChild or AddChild or 
something), it will load all its kids (but not their children), and the 
requested operation can take place.
3. Repeat for each of those children that are requested.

While this takes place, the document holds on to the file handle (so that the 
document cannot be modified or removed while it still refers to it), and 
releases it when the document is freed.

The old behaviour of loading everything at the beginning can be restored by 
passing optNoDelay to RELOAD.LoadDocument.

I've tested everything pretty thoroughly, but as always, if you find a way to 
break it (tmc:@), let me know.
---
U   wip/makereload.bat
U   wip/makereload.sh
U   wip/reload.bas
U   wip/reload.bi
U   wip/reload2xml.bas
U   wip/reloadtest.bas
A   wip/reloadtime.bas
U   wip/xml2reload.bas


This looks great! Not yet subjected to stress testing ;)

Two things: you forgot to update AddChild (funny, you actually gave it
as an example :P),


Hmm, you are correct. I will work on this tomorrow


and there's no point marking a node without children as delayed-load.


True. Strictly speaking, it doesn't matter at all, but it should be done 
for completeness.



Also, now we should have function to force loading a node and all its
descendants: if you want to read a textbox, you don't want to read
from file every time you encounter a node with children.


Yes, actually I was going to do this tomorrow. I should have mentioned 
that, but hey.


--
Mike
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: james/3585 New RSAV loadgame support. Not enabled by default yet.

2010-06-02 Thread Mike Caron

On 02/06/2010 2:43 PM, James Paige wrote:

On Wed, Jun 02, 2010 at 02:17:25PM -0400, Mike Caron wrote:

On 02/06/2010 5:08 AM, Ralph Versteegen wrote:

On 2 June 2010 13:59,subvers...@hamsterrepublic.com   wrote:

james
2010-06-01 18:59:48 -0700 (Tue, 01 Jun 2010)
153
New RSAV loadgame support. Not enabled by default yet.
Saving always saves in both SAV and RSAV format.
To load from the RSAV, hold SHIFT when you load.
---
U   wip/moresubs.bas
U   wip/savegame.bas


We're nearly there!

Are we sure we want to store save games in %APP_DATA% on Windows by
default instead of the game folder? I generally find it annoying when
games do that, even if it might be correct in theory. For example, I
was quite annoyed recently when I realised (on linux, but I'm not
disputing putting saved games in ~/.ohrrpgce) that all versions of the
same game (or even different games with the same filename) share the
same save file.

Plus, I think very few people will know to look in the APP_DATA
directory when they want to access a save file, eg. to copy it to
another computer. I try not to go in there, it's a mess of
human-unfriendly data stores.


For what it's worth, if we're going to store the saves in a central
location, I'd rather they either go in a configurable location, or in
My Documents\My Games\Ohrrpgce\*

My documents can be located by calling SHGetSpecialFolderLocation, but
that appears to be rather complicated, so I'll write a wrapper function.


I kinda hate to create a new top-level folder in My Documents. Some
users are particular about how they organize that folder.


Here are the following games that did not share your sympathies, at 
least when they were installed on my computer:


EA Games\The Sims 2
My Games\Age of Mythology
My Games\Heroes of Might And Magic V
My Games\Oblivion
Puzzle Quest
Puzzle Quest Galactrix
RPG Maker XP
RPG Maker VX
Sim City 4
Sim City Societies (they didn't even bother to put these under EA Games 
as above)


And, plenty of other non-game programs. I think that in this age, it's a 
moot point.


My suggestion about making it configurable still stands, though.


Many other games store save games in %APP_DATA%

I do see the problem with different versions sharing the same save data.
It means you can no longer put a copy of the game in a different folder
with a different copy of game.exe and expect it to get its own save
file.

I know %APP_DATA% seems like a kinda lousy default location for game
authors, but I think it is a great default location for players who only
play games and don't make them (which should in theory, (but perhaps not
always practice) be the majority of users)

What if we put save games in:

same\path\as\the\rpg\file\gamename.saves\#.rsav

And then fall back to %APP_DATA%\OHRRPGCE\gamename\saves\#.rsav only if
the first choice is non-writeable?

---
James Paige
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



--
Mike
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] More RELOAD tests

2010-06-01 Thread Mike Caron

On 01/06/2010 2:23 AM, Ralph Versteegen wrote:

On 1 June 2010 16:37, Mike Caroncaron.m...@gmail.com  wrote:

On 01/06/2010 12:25 AM, Ralph Versteegen wrote:


On 1 June 2010 16:15, Mike Caroncaron.m...@gmail.comwrote:


On 01/06/2010 12:10 AM, Ralph Versteegen wrote:


On 1 June 2010 15:57, Mike Caroncaron.m...@gmail.com  wrote:


On 31/05/2010 11:44 PM, Ralph Versteegen wrote:


On 31 May 2010 11:58, Ralph Versteegenteeem...@gmail.comwrote:


On 31 May 2010 10:20, Mike Caroncaron.m...@gmail.comwrote:


On 30/05/2010 6:01 PM, Ralph Versteegen wrote:


On 31 May 2010 08:57, Mike Caroncaron.m...@gmail.com
  wrote:


D:\ohrrpgcedir gentest.xml
30/05/2010  04:52 AM   237,804,960 gentest.xml

D:\ohrrpgcexml2reload gentest.xml gentest.rld
Loaded XML document in 20857 ms
Memory usage: 301
Parsed XML document in 17049 ms
Memory usage: 573142499
Freed XML document in 35378 ms
Optimised document in 31149 ms
Memory usage: 428328275
Serialized document in 8557 ms
Tore down memory in 173 ms
Finished in 116510 ms

D:\ohrrpgcedir gentest.rld
30/05/2010  04:31 PM   203,271,865 gentest.rld

And, here's a profile of CPU and Memory usage while doing the
above:

http://taleotc.com/Reloadprofile.png

Note that on the CPU graph, Green is Usermode, while Red is Kernel
mode.
And
that my CPU thinks it's dual core, so you should consider the 50%
mark
to
be
max.


Hyperthreading?


Aka, Make applications think the CPU can multiple things at once,
when
in
reality it can't!. I guess Hyperthreading is more marketable,
though.
:)


Further, you should care more about the Commit memory, rather
than
th
Physical memory.
--
Mike


Yikes! Nearly twice as long to free as to load the XML document.
Looks
like the memory allocator thrashed a lot while freeing memory,
which
is odd because I would have expected xml nodes to be deleted in
about
the same order they were created. Maybe libxml deletes attribute
nodes
after deleting children. (Yes! I checked, and my hunch is correct!)

I assume that 3.0GB marks the total virtual memory committed on the
machine, and xml2relaod used roughly 1.5GB?


Yes, that's correct.


What does that xml file look like? It's interesting that the
resulting
.reld is nearly the same size as the original! That 64MB test case
compressed to half the size.


I used this program to generate a document:

http://www.xml-benchmark.org/downloads.html

It seems to have a lot of content in the form of text nodes. Alas, I
can't
find the place I got the original document, since it was basically
more
of
the same.

I suppose we could just cat the 64-meg document to itself, and do a
tiny
bit
of editing :D


Serialisation could be a bit faster (you can always increase the
buffer size to speed it up, going from 32kb to 64kb caused about a
20%
improvement), but mostly I'm happy with that.


Honestly, that's the least of my concerns. That's always going to
scale
linearly with the resulting document size.

I'm more concerned, now, with the thing we haven't really been
profiling:
Loading these stupidly large documents again. I modified reloadtest
to
load
it, and it ain't pretty:


Well, I told you to profile them, and have been doing so myself; who
cares how long it takes to convert an XML?

And speaking of profiling, I tried profiling but got totally useless
results missing nearly all running time.


Test #19: loadHugeDocument... Pass
Took 50 s
Test #20: freeHugeDocument... Pass
Took 297 ms

And, just for completion's sake, here's the 64 Meg-document's
RELOAD:

Test #19: loadHugeDocument... Pass
Took 19 s
Test #20: freeHugeDocument... Pass
Took 53 ms

Ouch.


What the devil? Here are my times, after warming up of course, on
windows XP this time, with a private heap:


reload2reload medline.reld medline2.reld


Loaded document in 12743 ms
Serialized document in 1062 ms
Tore down memory in 17 ms
Finished in 13824 ms

But! here's what it was in linux (back then the buffer was
smaller, I think now the serialization time is about 2.5s):

bash-3.1$ time reload2reload medline2.reld medline2_.reld
Loaded document in 3724 ms
Serialized document in 3506 ms
Tore down memory in 597 ms
Finished in 7838 ms

real0m7.892s
user0m5.276s
sys 0m0.440s

So, it looks like Linux is being way too paranoid about flushing the
file to disk as its written, or something like that (there are so
many
options in the kernel for tuning file systems; looks like they're not
set for performance in this case on my machine), and conversely
Windows is doing something REALLY stupid when loading it in. I mean,
the reload file is read in a linear manner, what on earth could the
problem be? Argh! We may have to write a file buffering layer for
reading files as well! Or maybe the problem is in allocating nodes?
We could test this by loading the file into memory before attempting
to load it.


OK, I tested and confirmed that file reads are the problem. I loaded
the whole file into memory and then read from that (inmem). Then I
also 

Re: [Ohrrpgce] SVN: teeemcee/3580 Converted Reload.SerializeBin to use BufferedFile instead of stdio FILEs

2010-05-30 Thread Mike Caron

On 30/05/2010 2:33 AM, subvers...@hamsterrepublic.com wrote:

teeemcee
2010-05-29 23:33:46 -0700 (Sat, 29 May 2010)
134
Converted Reload.SerializeBin to use BufferedFile instead of stdio FILEs.

It now runs nearly 400 times faster on that 64MB test case.
---
U   wip/makereload.bat
U   wip/makereload.sh
U   wip/reload.bas
U   wip/util.bas


You win! No one will ever be able to match 8 commits in the space of 17 
seconds!


When I check out what you've done, I will comment on something relevant.

--
Mike
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] SVN: teeemcee/3580 Converted Reload.SerializeBin to use BufferedFile instead of stdio FILEs

2010-05-30 Thread Mike Caron

On 30/05/2010 3:02 AM, Ralph Versteegen wrote:

On 30 May 2010 18:37, Mike Caroncaron.m...@gmail.com  wrote:

On 30/05/2010 2:33 AM, subvers...@hamsterrepublic.com wrote:


teeemcee
2010-05-29 23:33:46 -0700 (Sat, 29 May 2010)
134
Converted Reload.SerializeBin to use BufferedFile instead of stdio FILEs.

It now runs nearly 400 times faster on that 64MB test case.
---
U   wip/makereload.bat
U   wip/makereload.sh
U   wip/reload.bas
U   wip/util.bas


You win! No one will ever be able to match 8 commits in the space of 17
seconds!

When I check out what you've done, I will comment on something relevant.

--
Mike


Git is great. I have some HSpeak/script debugger work I could have
finished off and committed in several parts as well, but I'll leave it
for another day.


Ah, you lazy git. That explains it. ;)


I meant to say somewhere: maybe you want to modify SerializeXML so
that it outputs valid XML (eg, print  asNULL  andfoo =2  as
foo value=2, and make xml2reload translate back) or whatever, I
left that up to you. I mostly changed it because it was misprinting
slicetrees.


I'm not sure what to do in the face of null nodes, since  and NULL 
are not the same thing. I'm not even sure than a Node with no name is 
even legal (it's quite possibly undefined).


I don't agree with the change to nodes with both values and children. 
The exact XML representation of that is:


node
value
children /
children /
children /
/node

I don't believe in magic attributes or node names, so if I were going to 
do that, I'd spit them out as:


rootnodewhatever xmlns:RELOAD=http://someurlthatIhaventdecidedyet.com;
  ...
  RELOAD:null /
/rootnodewhatever

I'm not sure that I want to commit to doing this yet, as I'm working on 
another big project with my spare time... Maybe soon though. If I become 
inspired.

--
Mike
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Reload.SerializeXML

2010-05-30 Thread Mike Caron

On 30/05/2010 2:53 AM, Ralph Versteegen wrote:

On 28 May 2010 13:04, Mike Caroncaron.m...@gmail.com  wrote:

On 27/05/2010 8:38 PM, Ralph Versteegen wrote:


On 28 May 2010 11:25, James Paigeb...@hamsterrepublic.comwrote:


On Thu, May 27, 2010 at 07:07:38PM -0400, Mike Caron wrote:


On 27/05/2010 6:38 PM, James Paige wrote:


Mike, was there any special reason why Reload.SerializeXML uses print
statements rather than writing to a file?

---
James


I wrote it as a debugging function. If it wrote to a file, then I
wouldn't be able to see it on screen in reloadtest! :)
--
Mike


I guess what I am really looking for is a reload2xml command-line tool
so I can easily debug reload files on disk..

and actually it doesn't matter that SerializeXML prints to the console,
because I could just do

  reload2xml somefile.reldsomefile.xml

---
James


Writing to standard output is the Unix way anyway!

Speaking of xml, Mike mentioned a couple weeks ago that the Reload
code grinds to a halt when processing some translated 64MB xml
document. Since I enjoy optimisation to a rather evil degree, I'd like
to look at it sometime. What are some good testcases?


Right at this moment, I don't feel like touching any of that stuff, so go
nuts.

A few tips:

- I don't think the private heap has anything to do with potential
performance issues. They're the same calls being done by the runtime, just
in a different memory block.
- One thing I never thought about doing is compiling with the -profile
switch.
- I never did any formal performance tuning, being as I subscribe to the
make it work, then make it fast camp. All that ZString crap was to
alleviate my fears of memory corruption caused by having Strings in UDTs.

This is the document I mentioned: (warning: ~5 Megs compressed, 64 Megs
uncompressed)

http://taleotc.com/medline08n0059.zip

I haven't looked to closely at the structure of the document, but it seems
to be a fairly average, if large, dataset.

Other than that, Google isn't being very friendly. Querying xml test
documents lists a bunch of XML Tutorials and Unit testing stuff, while
large xml test documents seems to focus on *really* big documents (like,
1 Gb), for which I suspect the RELOAD file format would break down :)

--
Mike


So here are my results (my machine is a 7 year old 3GHz pentium 4 with
1GB of RAM):

Beforehand:

(I believe that this version of xml2reload did not include the
attributes, which add about 30% to the .reld size)

bash-3.1$ xml2reload ../medline08n0059.xml medline.reld
Loaded XML document in 4839 ms
Parsed XML document in 74792 ms
Optimised document in 9859 ms
Serialized document in 1022907 ms
Tore down memory in 3891 ms
Finished in 1116305 ms


bash-3.1$ time reload2reload plotdict.reld plotdict2.reld
Loaded document in 30 ms
Serialized document in 2851 ms
Tore down memory in 1 ms
Finished in 2899 ms

real0m2.919s
user0m0.112s
sys 0m0.188s

(where reload2reload is obviously just a 10 liner)

Afterwards:===

bash-3.1$ time xml2reload ../medline08n0059.xml medline.reld
Loaded XML document in 4207 ms
Parsed XML document in 6023 ms
Optimised document in 10631 ms
Serialized document in 2623 ms
Tore down memory in 3097 ms
Finished in 26596 ms

real0m26.699s
user0m24.018s
sys 0m1.100s

(Also, running reload2reload on medline.reld (which is 31MB) required
about 142MB of memory)

bash-3.1$ reload2reload plotdict.reld plotdict2.reld
Loaded document in 13 ms
Serialized document in 21 ms
Tore down memory in 8 ms
Finished in 60 ms


After running a few tests, I discovered the major bottleneck in the 
private heap implementation: A tiny bit of debugging code which didn't 
do a whole lot... except enumerate the entire heap on every allocation.


When I got rid of it, everything sped up enormously!

With private heap:
Loading XML document...
Loaded XML document in 5139 ms
Starting memory usage: 301
Parsing document...
Parsed XML document in 6765 ms
Memory usage: 237104215
Optimised document in 11849 ms
Memory usage: 157105826
Serialized document in 1138 ms
Tore down memory in 1974 ms
Finished in 28314 ms

Without private heap:
Loading XML document...
Loaded XML document in 4974 ms
Starting memory usage: 0
Parsing document...
Parsed XML document in 6989 ms
Memory usage: 0
Optimised document in 12147 ms
Memory usage: 0
Serialized document in 1207 ms
Tore down memory in 3257 ms
Finished in 28577 ms

I ran each a few times, it seems that they're all about the same. the 
only big difference I can see is the Tore down memory phase, which is 
indeed faster with the private heap (by 33%!) as intended. I suspect, 
though, that it's not enough to save it. Oh well, it was fun to get 
working, now it'll be fun to excise!


Anyway, the whole process used ~650 Megs of RAM, which is broken up as such:
- Approximately 423 Megs used by libxml2 to load the XML document
- Exactly 226.12 Megs (as seen above) used by RELOAD to load the 
unoptimized RELOAD document


I am going

Re: [Ohrrpgce] SVN: teeemcee/3580 Converted Reload.SerializeBin to use BufferedFile instead of stdio FILEs

2010-05-30 Thread Mike Caron

On 30/05/2010 3:19 AM, Ralph Versteegen wrote:

On 30 May 2010 19:08, Mike Caroncaron.m...@gmail.com  wrote:

On 30/05/2010 3:02 AM, Ralph Versteegen wrote:


On 30 May 2010 18:37, Mike Caroncaron.m...@gmail.comwrote:


On 30/05/2010 2:33 AM, subvers...@hamsterrepublic.com wrote:


teeemcee
2010-05-29 23:33:46 -0700 (Sat, 29 May 2010)
134
Converted Reload.SerializeBin to use BufferedFile instead of stdio
FILEs.

It now runs nearly 400 times faster on that 64MB test case.
---
U   wip/makereload.bat
U   wip/makereload.sh
U   wip/reload.bas
U   wip/util.bas


You win! No one will ever be able to match 8 commits in the space of 17
seconds!

When I check out what you've done, I will comment on something relevant.

--
Mike


Git is great. I have some HSpeak/script debugger work I could have
finished off and committed in several parts as well, but I'll leave it
for another day.


Ah, you lazy git. That explains it. ;)


I meant to say somewhere: maybe you want to modify SerializeXML so
that it outputs valid XML (eg, printasNULLandfoo =2as
foo value=2, and make xml2reload translate back) or whatever, I
left that up to you. I mostly changed it because it was misprinting
slicetrees.


I'm not sure what to do in the face of null nodes, since  andNULL  are
not the same thing. I'm not even sure than a Node with no name is even legal
(it's quite possibly undefined).


According to emacs' builtin XML validator (ha) it's not legal in XML,
but it's certainly legal in RELOAD. (Not sure which you're wondering.)


I meant in RELOAD. I know it's possible in RELOAD, but I never really 
gave it any thought. And, I see that I optimized this case...



I don't agree with the change to nodes with both values and children. The
exact XML representation of that is:

node
value
children /
children /
children /
/node


I'm not sure that's exact. What is

  node
 value
 children /
 othervalue
 children /
  /node


Technically, the structure in XML is:

   node
  xml:textvalue/xml:text
  children /
  xml:textothervalue/xml:text
  children /
   /node

If you recall way back, this was the way RELOAD was going to work: A 
node could have children, or data, not both.



I made that change to avoid confusion betweennode
=foobbar/b/node  and what you get after running
nodefoobbar/b/node through xml2reload. Although admittedly
the --debug option I added to reload2xml is enough to distinguish
those two.


I'm not really sure what the difference would be, assuming I'm 
interpreting your =foo notation correctly.



I don't believe in magic attributes or node names, so if I were going to do
that, I'd spit them out as:

rootnodewhatever xmlns:RELOAD=http://someurlthatIhaventdecidedyet.com;
  ...
  RELOAD:null /
/rootnodewhatever


You lost me. Would this actually be useful (OK, so I suggested it in
the first place, so what)


I meant, stick any magic attributes and nodes in a namespace to avoid 
misinterpreting a document which contains those names.



I'm not sure that I want to commit to doing this yet, as I'm working on
another big project with my spare time... Maybe soon though. If I become
inspired.
--
Mike


And I was meant to be working on term projects and assignments instead
of RELOAD.
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org



--
Mike
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] Reload.SerializeXML

2010-05-30 Thread Mike Caron

On 30/05/2010 4:33 AM, Ralph Versteegen wrote:

On 30 May 2010 20:23, Mike Caroncaron.m...@gmail.com  wrote:

On 30/05/2010 4:19 AM, Ralph Versteegen wrote:


On 30 May 2010 20:10, Mike Caroncaron.m...@gmail.comwrote:


On 30/05/2010 4:03 AM, Ralph Versteegen wrote:


On 30 May 2010 19:30, Mike Caroncaron.m...@gmail.com  wrote:


On 30/05/2010 2:53 AM, Ralph Versteegen wrote:


On 28 May 2010 13:04, Mike Caroncaron.m...@gmail.comwrote:


On 27/05/2010 8:38 PM, Ralph Versteegen wrote:


On 28 May 2010 11:25, James Paigeb...@hamsterrepublic.com
  wrote:


On Thu, May 27, 2010 at 07:07:38PM -0400, Mike Caron wrote:


On 27/05/2010 6:38 PM, James Paige wrote:


Mike, was there any special reason why Reload.SerializeXML uses
print
statements rather than writing to a file?

---
James


I wrote it as a debugging function. If it wrote to a file, then I
wouldn't be able to see it on screen in reloadtest! :)
--
Mike


I guess what I am really looking for is a reload2xml command-line
tool
so I can easily debug reload files on disk..

and actually it doesn't matter that SerializeXML prints to the
console,
because I could just do

  reload2xml somefile.reld  somefile.xml

---
James


Writing to standard output is the Unix way anyway!

Speaking of xml, Mike mentioned a couple weeks ago that the Reload
code grinds to a halt when processing some translated 64MB xml
document. Since I enjoy optimisation to a rather evil degree, I'd
like
to look at it sometime. What are some good testcases?


Right at this moment, I don't feel like touching any of that stuff,
so
go
nuts.

A few tips:

- I don't think the private heap has anything to do with potential
performance issues. They're the same calls being done by the runtime,
just
in a different memory block.
- One thing I never thought about doing is compiling with the
-profile
switch.
- I never did any formal performance tuning, being as I subscribe to
the
make it work, then make it fast camp. All that ZString crap was to
alleviate my fears of memory corruption caused by having Strings in
UDTs.

This is the document I mentioned: (warning: ~5 Megs compressed, 64
Megs
uncompressed)

http://taleotc.com/medline08n0059.zip

I haven't looked to closely at the structure of the document, but it
seems
to be a fairly average, if large, dataset.

Other than that, Google isn't being very friendly. Querying xml test
documents lists a bunch of XML Tutorials and Unit testing stuff,
while
large xml test documents seems to focus on *really* big documents
(like,
1 Gb), for which I suspect the RELOAD file format would break down :)

--
Mike


So here are my results (my machine is a 7 year old 3GHz pentium 4 with
1GB of RAM):

Beforehand:

(I believe that this version of xml2reload did not include the
attributes, which add about 30% to the .reld size)

bash-3.1$ xml2reload ../medline08n0059.xml medline.reld
Loaded XML document in 4839 ms
Parsed XML document in 74792 ms
Optimised document in 9859 ms
Serialized document in 1022907 ms
Tore down memory in 3891 ms
Finished in 1116305 ms


bash-3.1$ time reload2reload plotdict.reld plotdict2.reld
Loaded document in 30 ms
Serialized document in 2851 ms
Tore down memory in 1 ms
Finished in 2899 ms

real0m2.919s
user0m0.112s
sys 0m0.188s

(where reload2reload is obviously just a 10 liner)

Afterwards:===

bash-3.1$ time xml2reload ../medline08n0059.xml medline.reld
Loaded XML document in 4207 ms
Parsed XML document in 6023 ms
Optimised document in 10631 ms
Serialized document in 2623 ms
Tore down memory in 3097 ms
Finished in 26596 ms

real0m26.699s
user0m24.018s
sys 0m1.100s

(Also, running reload2reload on medline.reld (which is 31MB) required
about 142MB of memory)

bash-3.1$ reload2reload plotdict.reld plotdict2.reld
Loaded document in 13 ms
Serialized document in 21 ms
Tore down memory in 8 ms
Finished in 60 ms


After running a few tests, I discovered the major bottleneck in the
private
heap implementation: A tiny bit of debugging code which didn't do a
whole
lot... except enumerate the entire heap on every allocation.


Ah, I was wondering why you said that in tests it took 20 min to
optimise the parsed XML when it only took me 12 seconds.


When I got rid of it, everything sped up enormously!

With private heap:
Loading XML document...
Loaded XML document in 5139 ms
Starting memory usage: 301
Parsing document...
Parsed XML document in 6765 ms
Memory usage: 237104215
Optimised document in 11849 ms
Memory usage: 157105826
Serialized document in 1138 ms
Tore down memory in 1974 ms
Finished in 28314 ms

Without private heap:
Loading XML document...
Loaded XML document in 4974 ms
Starting memory usage: 0
Parsing document...
Parsed XML document in 6989 ms
Memory usage: 0
Optimised document in 12147 ms
Memory usage: 0
Serialized document in 1207 ms
Tore down memory in 3257 ms
Finished in 28577 ms


Interesting that in those runs it took less than half as long to
serialise as on my machine

Re: [Ohrrpgce] Reload.SerializeXML

2010-05-30 Thread Mike Caron

On 30/05/2010 4:33 AM, Ralph Versteegen wrote:

On 30 May 2010 20:23, Mike Caroncaron.m...@gmail.com  wrote:

On 30/05/2010 4:19 AM, Ralph Versteegen wrote:


On 30 May 2010 20:10, Mike Caroncaron.m...@gmail.comwrote:


On 30/05/2010 4:03 AM, Ralph Versteegen wrote:


On 30 May 2010 19:30, Mike Caroncaron.m...@gmail.com  wrote:


On 30/05/2010 2:53 AM, Ralph Versteegen wrote:


On 28 May 2010 13:04, Mike Caroncaron.m...@gmail.comwrote:


On 27/05/2010 8:38 PM, Ralph Versteegen wrote:


On 28 May 2010 11:25, James Paigeb...@hamsterrepublic.com
  wrote:


On Thu, May 27, 2010 at 07:07:38PM -0400, Mike Caron wrote:


On 27/05/2010 6:38 PM, James Paige wrote:


Mike, was there any special reason why Reload.SerializeXML uses
print
statements rather than writing to a file?

---
James


I wrote it as a debugging function. If it wrote to a file, then I
wouldn't be able to see it on screen in reloadtest! :)
--
Mike


I guess what I am really looking for is a reload2xml command-line
tool
so I can easily debug reload files on disk..

and actually it doesn't matter that SerializeXML prints to the
console,
because I could just do

  reload2xml somefile.reld  somefile.xml

---
James


Writing to standard output is the Unix way anyway!

Speaking of xml, Mike mentioned a couple weeks ago that the Reload
code grinds to a halt when processing some translated 64MB xml
document. Since I enjoy optimisation to a rather evil degree, I'd
like
to look at it sometime. What are some good testcases?


Right at this moment, I don't feel like touching any of that stuff,
so
go
nuts.

A few tips:

- I don't think the private heap has anything to do with potential
performance issues. They're the same calls being done by the runtime,
just
in a different memory block.
- One thing I never thought about doing is compiling with the
-profile
switch.
- I never did any formal performance tuning, being as I subscribe to
the
make it work, then make it fast camp. All that ZString crap was to
alleviate my fears of memory corruption caused by having Strings in
UDTs.

This is the document I mentioned: (warning: ~5 Megs compressed, 64
Megs
uncompressed)

http://taleotc.com/medline08n0059.zip

I haven't looked to closely at the structure of the document, but it
seems
to be a fairly average, if large, dataset.

Other than that, Google isn't being very friendly. Querying xml test
documents lists a bunch of XML Tutorials and Unit testing stuff,
while
large xml test documents seems to focus on *really* big documents
(like,
1 Gb), for which I suspect the RELOAD file format would break down :)

--
Mike


So here are my results (my machine is a 7 year old 3GHz pentium 4 with
1GB of RAM):

Beforehand:

(I believe that this version of xml2reload did not include the
attributes, which add about 30% to the .reld size)

bash-3.1$ xml2reload ../medline08n0059.xml medline.reld
Loaded XML document in 4839 ms
Parsed XML document in 74792 ms
Optimised document in 9859 ms
Serialized document in 1022907 ms
Tore down memory in 3891 ms
Finished in 1116305 ms


bash-3.1$ time reload2reload plotdict.reld plotdict2.reld
Loaded document in 30 ms
Serialized document in 2851 ms
Tore down memory in 1 ms
Finished in 2899 ms

real0m2.919s
user0m0.112s
sys 0m0.188s

(where reload2reload is obviously just a 10 liner)

Afterwards:===

bash-3.1$ time xml2reload ../medline08n0059.xml medline.reld
Loaded XML document in 4207 ms
Parsed XML document in 6023 ms
Optimised document in 10631 ms
Serialized document in 2623 ms
Tore down memory in 3097 ms
Finished in 26596 ms

real0m26.699s
user0m24.018s
sys 0m1.100s

(Also, running reload2reload on medline.reld (which is 31MB) required
about 142MB of memory)

bash-3.1$ reload2reload plotdict.reld plotdict2.reld
Loaded document in 13 ms
Serialized document in 21 ms
Tore down memory in 8 ms
Finished in 60 ms


After running a few tests, I discovered the major bottleneck in the
private
heap implementation: A tiny bit of debugging code which didn't do a
whole
lot... except enumerate the entire heap on every allocation.


Ah, I was wondering why you said that in tests it took 20 min to
optimise the parsed XML when it only took me 12 seconds.


When I got rid of it, everything sped up enormously!

With private heap:
Loading XML document...
Loaded XML document in 5139 ms
Starting memory usage: 301
Parsing document...
Parsed XML document in 6765 ms
Memory usage: 237104215
Optimised document in 11849 ms
Memory usage: 157105826
Serialized document in 1138 ms
Tore down memory in 1974 ms
Finished in 28314 ms

Without private heap:
Loading XML document...
Loaded XML document in 4974 ms
Starting memory usage: 0
Parsing document...
Parsed XML document in 6989 ms
Memory usage: 0
Optimised document in 12147 ms
Memory usage: 0
Serialized document in 1207 ms
Tore down memory in 3257 ms
Finished in 28577 ms


Interesting that in those runs it took less than half as long to
serialise as on my machine

[Ohrrpgce] More RELOAD tests

2010-05-30 Thread Mike Caron

D:\ohrrpgcedir gentest.xml
30/05/2010  04:52 AM   237,804,960 gentest.xml

D:\ohrrpgcexml2reload gentest.xml gentest.rld
Loaded XML document in 20857 ms
Memory usage: 301
Parsed XML document in 17049 ms
Memory usage: 573142499
Freed XML document in 35378 ms
Optimised document in 31149 ms
Memory usage: 428328275
Serialized document in 8557 ms
Tore down memory in 173 ms
Finished in 116510 ms

D:\ohrrpgcedir gentest.rld
30/05/2010  04:31 PM   203,271,865 gentest.rld

And, here's a profile of CPU and Memory usage while doing the above:

http://taleotc.com/Reloadprofile.png

Note that on the CPU graph, Green is Usermode, while Red is Kernel mode. 
And that my CPU thinks it's dual core, so you should consider the 50% 
mark to be max.


Further, you should care more about the Commit memory, rather than th 
Physical memory.

--
Mike
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


Re: [Ohrrpgce] what to do with saved NPC and map state when the map gets edited

2010-05-30 Thread Mike Caron

On 30/05/2010 5:51 PM, James Paige wrote:

So seeing as I will be soon working on NPC and map state saving as a NEW
feature, (since the limited support that was already present was broken
for 11 or 12 years and nobody noticed (and why should they? Nobody but
me knew it was supposed to be a feature))

I digress.

Suppose you release your first demo. Everybody plays it, and then saves
their game at the end.

Then a few weeks later you release your second demo, which among other
things includes heavy revision of the NPCs on the same map where the
previous demo ends.

Everybody who continues from their old save says the NPCs are all
crazy! They are in the wrong place! Some of them are missing


How do we resolve this situation?

For a while I was thinking we should have a version number of some kind
on each map that the game author could manually incremment, which would
invalidate old saved state for that map.

So that is one option.

Another option is that each NPC would have a timestamp tracking when it
was placed/edited in the map editor. That could be compared to a
timestamp on the save game to determine if the NPC's saved position
should be restored.

And then there is tilemap data...

Thoughts?

---
James


I suggest a bitset that optionally turns this feature on. If it's off, 
it behaves as it always has (i.e, not saving map state at all). If it's 
on, then it unconditionally loads the map state on load, and requires 
that the player leave the map and come back to get the new changes.


I don't think it would be a good idea to mix and match NPCs, because 
then you get into a situation where you're not sure what data to base a 
reset on.


For example, take a nosy guard NPC who is meant to stick near the 
player while he selects exactly one item from the treasury, and open the 
door for him when he's done. The player then saves in the treasury. But, 
the NPC gets moved in the editor, and subsequently gets reset when the 
game is loaded. Now, hypothetically, the player is stuck, since he can't 
talk to the NPC to get out!


With the existing behaviour, this is still possible, but it's expected, 
since the guard will always be reset, so you wouldn't do something 
stupid like let the player save there.


Similarly, in the DS Pokémon games, it saves the state of NPCs that are 
in the same sector (32x32 square) as you. When you load, it loads 
everything exactly as it was, even if it should be different (eg, if an 
NPC is supposed to be elsewhere due to it being a different time). This 
is to prevent the player getting stuck on top of a cut tree or something.


That's just my two cents.

--
Mike
___
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org


  1   2   3   4   >