Magic carpet style barge in SI-based game
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Magic carpet style barge in SI-based game
Hi all,
Can anyone give me any advice on how I'd go about creating a magic carpet type barge in a new SI-based game? Basically what I want is a 'flying' barge.. ala magic carpet.
I'm reading the instructions in the ES documentation that describe how to create a 'custom magic carpet', but these seem to assume you are running BG, ala - "To create a magic carpet, place the small blue tiles from the magic carpet (shape# 840, frame 57)..."
My current setup is a custom 'new' game employing a slightly modified SI "shapes.vga" (which doesn't contain magic carpet shapes/tiles). How does the barge code work in this sense - is it hardcoded? i.e. If I just create an appropriate shape at shape #840, frame 57 in my shapes.vga and use it as my barge, will it work? Or would that only work for a BG-based game?
Thanks
Achenar
Can anyone give me any advice on how I'd go about creating a magic carpet type barge in a new SI-based game? Basically what I want is a 'flying' barge.. ala magic carpet.
I'm reading the instructions in the ES documentation that describe how to create a 'custom magic carpet', but these seem to assume you are running BG, ala - "To create a magic carpet, place the small blue tiles from the magic carpet (shape# 840, frame 57)..."
My current setup is a custom 'new' game employing a slightly modified SI "shapes.vga" (which doesn't contain magic carpet shapes/tiles). How does the barge code work in this sense - is it hardcoded? i.e. If I just create an appropriate shape at shape #840, frame 57 in my shapes.vga and use it as my barge, will it work? Or would that only work for a BG-based game?
Thanks
Achenar
Re: Magic carpet style barge in SI-based game
I'm at work, but I'll try to take a look at the source tonight. If it's hardcoded, we can make it configurable (with a bit of work).
Re: Magic carpet style barge in SI-based game
Hey DrCode, did you ever get a chance to look at this?
I'm still wondering how I could get such a barge working.
I'm not actually sure where the magic carpet code is... i.e. the functionality to "levitate" the tiles etc. Is that in usecode, or in the engine itself? If the former, I might be in a bit of trouble - as I'm trying to build a game from scratch and don't necessarily want all the BG/SI usecode.
Achenar
I'm still wondering how I could get such a barge working.
I'm not actually sure where the magic carpet code is... i.e. the functionality to "levitate" the tiles etc. Is that in usecode, or in the engine itself? If the former, I might be in a bit of trouble - as I'm trying to build a game from scratch and don't necessarily want all the BG/SI usecode.
Achenar
Re: Magic carpet style barge in SI-based game
I'm also curious about this. I noticed that SI has the ice raft, which does not even use seats but somehow will still work. I didn't get around to looking at the usecode for those shapes, but maybe that will provide some answers.
Re: Magic carpet style barge in SI-based game
Sorry, but I forgot all about this. You're right about usecode being involved, though.
Re: Magic carpet style barge in SI-based game
Flying barges, and ships do work in SI, including in the original game.
The elevation change in the original game had a limit of 6 in the Z (height) though, as compared to the change of 12 in Z in Black Gate.
In the original game I could use a "Qaulity 255" engine to fire up the movement on such a vessel without having to trip the flag for the mayor of moonshade's barge.
I would store the engine and a "button/lever" in a chest or ships hold on that barge since the buttons and levels were not affected by the barge movement.
Not sure if Exult has caught this yet or not. I just know this trick has not worked in Exult so far.
Was unable to check UseCode back then as it was 1998 or 1999.
The elevation change in the original game had a limit of 6 in the Z (height) though, as compared to the change of 12 in Z in Black Gate.
In the original game I could use a "Qaulity 255" engine to fire up the movement on such a vessel without having to trip the flag for the mayor of moonshade's barge.
I would store the engine and a "button/lever" in a chest or ships hold on that barge since the buttons and levels were not affected by the barge movement.
Not sure if Exult has caught this yet or not. I just know this trick has not worked in Exult so far.
Was unable to check UseCode back then as it was 1998 or 1999.
Re: Magic carpet style barge in SI-based game
The Engine UseCode Function needs a rewrite to work in Exult, they made no allowance for other engines.
A quality check for Quality 1 would point to the Mayor's Barge.
Also, it would help if a barge could move at a non 0 altitude without being on a surface.
Not sure when this was added in, but I remember bein able to sail those all over in the original game back in 98 while rewriting the map with a DOS world editor.
Here is the recoded Engine for SI which seems to be working:
// externs
extern Func094A 0x94A (var var0000);
extern var Func0890 0x890 ();
extern var Func08E7 0x8E7 (var var0000);
Func0316 0x316 (var var0000) //Engine Code
{
var var0001;
var var0002;
var var0003;
if (!(event != 0x0001))
{
goto labelFunc0316_0009;
}
return;
labelFunc0316_0009:
if (!UI_in_gump_mode())
{
goto labelFunc0316_0014;
}
UI_close_gumps();
labelFunc0316_0014:
if (!UI_get_barge(item))
{
goto labelFunc0316_00D2;
}
if (!(!UI_get_item_flag(0xFE9C, 0x000A)))
{
goto labelFunc0316_00BA;
}
var0000 = UI_get_item_quality(item);
var0001 = UI_count_objects(0xFE9B, 0x031D, var0000, 0xFE99);
if (!(((!var0001) && (!gflags[0x0005])) && (!((var0000 == 0x0001) && gflags[0x00EC]))))
{
goto labelFunc0316_007D;
}
if (!(((!var0001) && (var0000 == 1))))
{
goto labelFunc0316_007D;
}
if (!(UI_get_array_size(UI_get_party_list()) == 0x0001))
{
goto labelFunc0316_0076;
}
Func094A("@This vessel belongs to another.@");
goto labelFunc0316_007C;
labelFunc0316_0076:
Func094A("@This vessel doth not belong to us.@");
labelFunc0316_007C:
return;
labelFunc0316_007D:
if (!Func0890()) goto labelFunc0316_00A8;
UI_clear_item_flag(0xFE9C, 0x0014);
UI_set_item_flag(0xFE9C, 0x000A);
UI_set_item_flag(UI_get_barge(0xFE9C), 0x001A);
goto labelFunc0316_00B7;
labelFunc0316_00A8:
var0002 = Func08E7(item);
UI_set_item_flag(item, 0x0014);
labelFunc0316_00B7:
goto labelFunc0316_00D2;
labelFunc0316_00BA:
UI_clear_item_flag(item, 0x0014);
UI_clear_item_flag(item, 0x000A);
UI_clear_item_flag(item, 0x001A);
labelFunc0316_00D2:
return;
}
A quality check for Quality 1 would point to the Mayor's Barge.
Also, it would help if a barge could move at a non 0 altitude without being on a surface.
Not sure when this was added in, but I remember bein able to sail those all over in the original game back in 98 while rewriting the map with a DOS world editor.
Here is the recoded Engine for SI which seems to be working:
// externs
extern Func094A 0x94A (var var0000);
extern var Func0890 0x890 ();
extern var Func08E7 0x8E7 (var var0000);
Func0316 0x316 (var var0000) //Engine Code
{
var var0001;
var var0002;
var var0003;
if (!(event != 0x0001))
{
goto labelFunc0316_0009;
}
return;
labelFunc0316_0009:
if (!UI_in_gump_mode())
{
goto labelFunc0316_0014;
}
UI_close_gumps();
labelFunc0316_0014:
if (!UI_get_barge(item))
{
goto labelFunc0316_00D2;
}
if (!(!UI_get_item_flag(0xFE9C, 0x000A)))
{
goto labelFunc0316_00BA;
}
var0000 = UI_get_item_quality(item);
var0001 = UI_count_objects(0xFE9B, 0x031D, var0000, 0xFE99);
if (!(((!var0001) && (!gflags[0x0005])) && (!((var0000 == 0x0001) && gflags[0x00EC]))))
{
goto labelFunc0316_007D;
}
if (!(((!var0001) && (var0000 == 1))))
{
goto labelFunc0316_007D;
}
if (!(UI_get_array_size(UI_get_party_list()) == 0x0001))
{
goto labelFunc0316_0076;
}
Func094A("@This vessel belongs to another.@");
goto labelFunc0316_007C;
labelFunc0316_0076:
Func094A("@This vessel doth not belong to us.@");
labelFunc0316_007C:
return;
labelFunc0316_007D:
if (!Func0890()) goto labelFunc0316_00A8;
UI_clear_item_flag(0xFE9C, 0x0014);
UI_set_item_flag(0xFE9C, 0x000A);
UI_set_item_flag(UI_get_barge(0xFE9C), 0x001A);
goto labelFunc0316_00B7;
labelFunc0316_00A8:
var0002 = Func08E7(item);
UI_set_item_flag(item, 0x0014);
labelFunc0316_00B7:
goto labelFunc0316_00D2;
labelFunc0316_00BA:
UI_clear_item_flag(item, 0x0014);
UI_clear_item_flag(item, 0x000A);
UI_clear_item_flag(item, 0x001A);
labelFunc0316_00D2:
return;
}
Re: Magic carpet style barge in SI-based game
Argh, I had forgotten how ugly UCXT output really is. Here, this is much better:
Code: Select all
extern partySay 0x94A (var msg);
extern var isPartySitting 0x890 ();
extern var sitPartyOnBarge 0x8E7 (var barge);
Engine shape#(0x316) ()
{
const int AVATAR = -356;
const int PARTY = -357;
const int ON_MOVING_BARGE = 10;
const int SAILOR = 14;
const int IN_MOTION = 26;
const int DOUBLECLICK = 1;
const int SHAPE_SCROLL = 797;
const int FRAME_ANY = -359;
const int GOT_MAGELORDS_PERMISSION = 236;
if (event != DOUBLECLICK)
return;
if (UI_in_gump_mode())
UI_close_gumps();
if (get_barge())
{
if (!AVATAR->get_item_flag(ON_MOVING_BARGE))
{
var quality = get_item_quality();
var scrolls = PARTY->count_objects(SHAPE_SCROLL, quality, FRAME_ANY);
if ((!scrolls && !gflags[5]) && !(quality == 1 && gflags[GOT_MAGELORDS_PERMISSION]))
{
if (UI_get_array_size(UI_get_party_list()) == 1)
partySay("@This vessel belongs to another.@");
else
partySay("@This vessel doth not belong to us.@");
return;
}
if (isPartySitting())
{
AVATAR->clear_item_flag(SAILOR);
AVATAR->set_item_flag(ON_MOVING_BARGE);
var barge = AVATAR->get_barge();
barge->set_item_flag(IN_MOTION);
}
else
{
sitPartyOnBarge(item);
set_item_flag(SAILOR);
}
}
else
{
clear_item_flag(SAILOR);
clear_item_flag(ON_MOVING_BARGE);
clear_item_flag(IN_MOTION);
}
}
}
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Re: Magic carpet style barge in SI-based game
This is definately easier to read. Thanks.
Re: Magic carpet style barge in SI-based game
Thanks for the code, it may come in handy...
I guess this brings to mind another question - the recent thread re copyright issues etc got me thinking (once again) about how far we'd have to go to improve Exult's support for standalone games that don't require pre-ownership of Ultima 7.
In the context of this thread specifically, I often wonder about the "default" usecode functions such as "isPartySitting" and "sitPartyOnBarge" (and indeed the 'Engine' function that has been reverse engineered above) - these presumably are provided by the underlying Ultima 7 usecode (?). How hard would it be to re-implement these from scratch? And would this be legally legitamite? I.e. with some effort, could the community come up with a re-written legally distributable "base" library of usecode functions rather than having to rely on the framework provided by the original?
In addition to legality (reverse-engineering?), part of the problem may lie in having to clean up the decompiled source for all the useful functions, ... could be a largish job?
I guess this brings to mind another question - the recent thread re copyright issues etc got me thinking (once again) about how far we'd have to go to improve Exult's support for standalone games that don't require pre-ownership of Ultima 7.
In the context of this thread specifically, I often wonder about the "default" usecode functions such as "isPartySitting" and "sitPartyOnBarge" (and indeed the 'Engine' function that has been reverse engineered above) - these presumably are provided by the underlying Ultima 7 usecode (?). How hard would it be to re-implement these from scratch? And would this be legally legitamite? I.e. with some effort, could the community come up with a re-written legally distributable "base" library of usecode functions rather than having to rely on the framework provided by the original?
In addition to legality (reverse-engineering?), part of the problem may lie in having to clean up the decompiled source for all the useful functions, ... could be a largish job?
Re: Magic carpet style barge in SI-based game
The way the deal worked between the Makers of Baldurs Gate, Icewind Dale, Planescape: Torment, and BG2 worked like this: Any part of the game could be modded, but the xxx.EXE were not to be altered.
I believe Black Isle Studios was the maker there since the box has their branding on it.
Rules seem similar when modding things like Morrowind and Oblivion.
I believe Black Isle Studios was the maker there since the box has their branding on it.
Rules seem similar when modding things like Morrowind and Oblivion.
Re: Magic carpet style barge in SI-based game
PS: that deal was between a group called TeamBG and Black Isle Studios.
Re: Magic carpet style barge in SI-based game
I don't think it would be that hard to re-implement these from scratch. This should also be perfectly legal, since none of us has seen the original usecode source (and we don't even know what the language looks like).
Re: Magic carpet style barge in SI-based game
Good to hear -
Does anyone think this would be a worthwhile thing to do?
Actually in terms of making it easier, I have a faint memory of someone working on the decompiler to improve its' output ... perhaps I'm wrong though?
Does anyone think this would be a worthwhile thing to do?
Actually in terms of making it easier, I have a faint memory of someone working on the decompiler to improve its' output ... perhaps I'm wrong though?
Re: Magic carpet style barge in SI-based game
I am planning on doing that; but I think that perhaps you are referring to a (buggy) program I wrote once (which was in ESGuides) which improved the ucxt output.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Re: Magic carpet style barge in SI-based game
Have the Barges been fixed yet so they can move at elevations other than 0 like they did in the original Serpent Isle?
Re: Magic carpet style barge in SI-based game
That (IIRC) is defined in usecode, isn't it? You can use 'rise' or 'descent' with a barge in a UCC script block and it will go up or down.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Re: Magic carpet style barge in SI-based game
In th original SI, a barge could move freely on the x and y as well as on the z. I have a ship I placed on a revamped Claw Island at elevation 6.
I did the revamp back in about 1998 using a tool I had built back then for world editing. (Was DOS based though and no graphics)
I used a smaller barge of 4 barge tiles in a square flying at elevation 6 to manuver over chunks of terrain i wished to modify the statics in.
Rise/fall works great, but say, raise Filbercio's barge into the air and try sailing it, it wont move off the spot in Exult, though it will in the original engine.
I did the revamp back in about 1998 using a tool I had built back then for world editing. (Was DOS based though and no graphics)
I used a smaller barge of 4 barge tiles in a square flying at elevation 6 to manuver over chunks of terrain i wished to modify the statics in.
Rise/fall works great, but say, raise Filbercio's barge into the air and try sailing it, it wont move off the spot in Exult, though it will in the original engine.
Re: Magic carpet style barge in SI-based game
Fixed it. It will be working in the next snapshot.Rise/fall works great, but say, raise Filbercio's barge into the air and try sailing it, it wont move off the spot in Exult, though it will in the original engine.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Re: Magic carpet style barge in SI-based game
Thanks, Marzo.
Tis much appreciated.
Tis much appreciated.
Re: Magic carpet style barge in SI-based game
Barges fly now, but if one is using a ship, or a "carpet", the craft only seems able able to do a 180 degree rotation, not a 90 degree one when elevated. (z != 0).
At z = 0, the facings work correctly on the craft.
At z = 0, the facings work correctly on the craft.
Re: Magic carpet style barge in SI-based game
Will be fixed in the next snapshot.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]