Author Topic: Q-Gears Field Module - Midgar Conversion Project [Replaced by Finishing Touch]  (Read 62893 times)

Tom

  • Moderator
  • *
  • Posts: 207
    • View Profile
When I first downloaded Q-Gears 0.21 I was slightly disappointed that only the first 3 fields are playable, so I'm converting ff7 fields to Q-Gears fields so theres more to do in Q-Gears other than run around the train station and the bombing mission starting fields.

New Notice: The replacement project for this is Finishing Touch which you can find here: http://forums.qhimm.com/index.php?topic=16211.msg229368#msg229368
You can even download whatever progress is made and play it yourself, not just look at screenshots I upload :)

Notice: This project has been abandoned in favor of SUDM, the automatic Field Script decompiler you can find here:https://github.com/paulsapps/SUDM If you want to see the fields that were done up to this point you should download the Q-Gears repository and it will be in the output folder.  (Or download the q-gears-data repository and find them in maps/ffvii/ )

=[ Conversion Progress ]=
(Debug Room) startmap: Complete!
md1stin: Q-Gears
md1_1: Q-Gears
md1_2: Q-Gears
nrthmk: Complete!
nmkin_1: Imported, partial scripts
elevtr1: Complete!
nmkin_2: Complete!
nmkin_3: Imported, partial scripts
nmkin_4: Imported, no scripts
nmkin_5: Imported, no scripts
tin_3: Imported, no scripts


Here is what I got so far:
Images are 5000KB bitmaps so you might have to wait a while if you are on a slow line.
Start menu with shortcuts to the new fields

North Mako Reactor outside

Now were inside the reactor, without even having to hack the gate codes.

Looks like Cloud and Barret are stuck in the elevator!

Cloud and Jessie head deeper into the reactor!

The train leaves at 00:00 Midgar Standard Time!


I hear you asking, how do we get these fields ingame!?
You can get them by downloading the github q-gears and compiling it.
« Last Edit: 2015-06-29 22:23:39 by Tom »

Akari

  • Moderator
  • *
  • Posts: 766
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #1 on: 2014-11-15 13:25:36 »
Quote
The hardest part in converting the fields is getting the field scripts to work.  Having slight trouble with the elevator scene because I do not know how to get the cloud model that has the elevator slam button animation working.  Any help would be appreciated  :)

Scripts exporting is a bit tricky because you need a bit of manual work to do it. In existed field files I already rename a lot of things to increase readability.

1) Scripts exported to text file (md1_1_script.txt)

There you will find raw script to lua conversion. Most of implemented functions ready to use when they converted. Others need to be reworked.



2) You need to cteate entity layout manually.

EntityContainer = {}

EntityContainer[ "entity_name_goes_here" ] = {
}

After export you get original entity name. They are abbreviated and may be different in different fields though they represent same model. That's why I renamed them.

Code: [Select]
cl
script_0:

became

Code: [Select]
EntityContainer[ "Cloud" ] = {


3)  First script ("script_0:")

In ffvii first script has two parts: initial and normal.

Code: [Select]
cl
script_0:
0441 (end 0441): -- assosiate entity with model (CHAR) argument doesn't matter
0443 (end 0443): set_entity_to_character( "cl", 0 );
0445 (end 0445): return
0446 (end 0446): cl:set_move_speed( 1.875 )
044a (end 044a): jumpto( 044a );

Everything before first return is initial script.

In qgears this is "on_start" script.

We need to initialize model for entity in qgears

Code: [Select]
        set_entity_to_character( "Cloud", "Cloud" )
        self.cloud = entity_manager:get_entity( "Cloud" )

In ffvii this is done with PC opcode wich translates to

Code: [Select]
0441 (end 0441): -- assosiate entity with model (CHAR) argument doesn't matter
0443 (end 0443): set_entity_to_character( "cl", 0 );

set_entity_to_character  is located in output\data\scripts\ffvii\field.lua

Code: [Select]
set_entity_to_character = function( entity_name, character_name )
    if character_name == FFVII.Party[ 1 ] and entity_name ~= "" then
        if System.MapChanger.point_name ~= "" then
            local point = entity_manager:get_entity_point( System.MapChanger.point_name )
            if point ~= nil then
                local x, y, z = point:get_position()
                local rotation = point:get_rotation()
                local player = entity_manager:get_entity( entity_name )
                player:set_position( x, y, z )
                player:set_rotation( rotation )
                player:set_solid( true )
                player:set_visible( true )
            end
        end

        entity_manager:set_player_entity( entity_name )
    end
end

It do basicly tha same thing that PC opcode do.

Next is self.cloud = entity_manager:get_entity( "Cloud" )

This finds entity with name Cloud which described in XML file and store referensce to it in local variable to get access to it.



That\s all for now. Try to look at exported script and existed script files to understand how it works. I can add more later.

LeonhartGR

  • *
  • Posts: 2577
  • ~Whatever...~ Enjoy life!
    • View Profile
    • LeonhartGR Productions
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #2 on: 2014-11-15 13:51:51 »
Keep it up folks! Thanks for the devotion in this project!

Tom

  • Moderator
  • *
  • Posts: 207
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #3 on: 2014-11-15 14:44:25 »
Is there some sort of reference that describes all the field commands and what their arguments/parameters are?

Akari

  • Moderator
  • *
  • Posts: 766
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #4 on: 2014-11-15 15:25:23 »
Is there some sort of reference that describes all the field commands and what their arguments/parameters are?

https://github.com/q-gears/q-gears-data/blob/master/documents/script_commands.ods

but this is for v0.20

All real methods for current version are here https://github.com/q-gears/q-gears/blob/master/QGearsMain/include/core/ScriptManagerBinds.h
sadly without comments.
« Last Edit: 2014-11-15 15:41:54 by Akari »

Tom

  • Moderator
  • *
  • Posts: 207
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #5 on: 2014-11-16 07:50:26 »
Is it possible to have entities on the field without models? I need to make a entity "ele" to use as an elevator button so when you press [OK] you activate the elevator push script.

If its not possible then Ill probably add a Shinra Guard as an elevator operator that you talk to and tell him to take you to the floors.
« Last Edit: 2014-11-16 08:13:00 by Tom »

Akari

  • Moderator
  • *
  • Posts: 766
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #6 on: 2014-11-16 08:16:55 »
Is it possible to have entities on the field without models? I need to make a entity "ele" to use as an elevator button so when you press [OK] you activate the elevator push script.

If its not possible then Ill probably add a Shinra Guard as an elevator operator that you talk to and tell him to take you to the floors.

In xml:
Code: [Select]
<entity_script name="Elevator" />
In lua;
Code: [Select]
EntityContainer[ "Elevator" ] = {
    on_start = function( self )
        return 0
    end,
}

Done. You can see entity Director in md1_1 as reference of entity script.
« Last Edit: 2014-11-16 08:19:44 by Akari »

Tom

  • Moderator
  • *
  • Posts: 207
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #7 on: 2014-11-16 10:12:53 »
Thanks,  how do I set it up to react to a button press at certain coordinates?  I have tried using on_talk but thats not working,  the original script checks if button [OK] is pressed once but I don't know which button [OK] is in Q-Gears I would guess its shift. However you never have to use [OK] in Q-Gears because there are no texts and the scene where Biggs asks you to say your name is done using walkmesh triangles.

Fixed some problems by downloading the latest Q-Gears source and compiling it. Q-Gears v0.23 (5th cool guys choose to fight)
« Last Edit: 2014-11-16 14:57:28 by Tom »

Akari

  • Moderator
  • *
  • Posts: 766
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #8 on: 2014-11-16 17:33:22 »
Thanks,  how do I set it up to react to a button press at certain coordinates?  I have tried using on_talk but thats not working,  the original script checks if button [OK] is pressed once but I don't know which button [OK] is in Q-Gears I would guess its shift. However you never have to use [OK] in Q-Gears because there are no texts and the scene where Biggs asks you to say your name is done using walkmesh triangles.

Fixed some problems by downloading the latest Q-Gears source and compiling it. Q-Gears v0.23 (5th cool guys choose to fight)

There is an event called "on_button"

Code: [Select]
on_button = function( self, button, event )
You can find examples in main menu. It catches this buttons: Enter, Escape, Space, LCtrl, Left, Up, Down, Right.
Normally it's bad idea to use buttons directly, so you can create some bind list to associate actions with keys.

Tom

  • Moderator
  • *
  • Posts: 207
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #9 on: 2014-11-16 17:41:08 »
Thanks, the elevator scene now works properly.  However since I upgraded to the newest Q-Gears I can no longer make shortcuts on the main menu that take me to fields, whenever I skip the opening scene I am unable to move in the fields. My coordinates are setup right
I have added these in the begin_menu and changed the corresponding files and all worked fine in 0.21 but in 0.23 it teleports me to the field but I am unable to move.  I get no walkmesh errors in the console and the player isn't locked, what could be causing this?
Code: [Select]
                elseif self.position == 6 then
                    load_field_map_request( "ffvii_nmkin_1", "" )
                    console( "camera_free false" )
                    console( "debug_walkmesh false" )
                    script:request_end_sync( Script.UI, "BeginMenu", "hide", 0 )
                    FFVII.MenuSettings.pause_available = true

Akari

  • Moderator
  • *
  • Posts: 766
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #10 on: 2014-11-16 18:36:24 »
Thanks, the elevator scene now works properly.  However since I upgraded to the newest Q-Gears I can no longer make shortcuts on the main menu that take me to fields, whenever I skip the opening scene I am unable to move in the fields. My coordinates are setup right
I have added these in the begin_menu and changed the corresponding files and all worked fine in 0.21 but in 0.23 it teleports me to the field but I am unable to move.  I get no walkmesh errors in the console and the player isn't locked, what could be causing this?
Code: [Select]
                elseif self.position == 6 then
                    load_field_map_request( "ffvii_nmkin_1", "" )
                    console( "camera_free false" )
                    console( "debug_walkmesh false" )
                    script:request_end_sync( Script.UI, "BeginMenu", "hide", 0 )
                    FFVII.MenuSettings.pause_available = true

What is version 0.23? Where can I find it?

KnifeTheSky77

  • *
  • Posts: 548
  • Somnambulistic Paraphile
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #11 on: 2014-11-16 18:40:25 »
Is this where you pulled your source from? I believe this is the latest efforts

https://github.com/q-gears/q-gears


Tom

  • Moderator
  • *
  • Posts: 207
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #12 on: 2014-11-16 19:04:54 »
0.23 is the one with the latest commits, https://github.com/q-gears/q-gears/
It has battle 300 partially setup with the MP1 and MP2 entities
0.21 does not have any battles

Tom

  • Moderator
  • *
  • Posts: 207
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #13 on: 2014-11-17 16:45:35 »
nrthmk is now fully implemented, with all its scripts and functions!
Avalance runs into the reactor and Wedge ensures there is an escape route once the bomb is set!


Ill make a list at the top post showing what fields have been loaded and what has been implemented.
I have been wondering for a while if we could have a countdown function, so when you set the bomb you have 10 minutes to get out.
Does field:lock_walkmesh( 37, true ); exist? It doesnt seem to work

Also, how do I set variables?  Like for storing the position of the elevator or for the activation of certain scripts?
« Last Edit: 2014-11-17 18:30:27 by Tom »

Akari

  • Moderator
  • *
  • Posts: 766
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #14 on: 2014-11-17 18:44:16 »
Also, does field:lock_walkmesh( 37, true ); exist? It doesnt seem to work

Sadly this function not exported to Lua.


Add this to ScriptManagerCommands.h

Code: [Select]
    // walkmesh access
    luabind::module( m_LuaState )
    [
        luabind::class_< Walkmesh >( "Walkmesh" )
            .def( "lock_walkmesh", ( void( Walkmesh ::* )( unsigned int, bool ) ) &Walkmesh ::LockWalkmesh)
            .def( "is_locked", ( bool( Walkmesh ::* )( unsigned int ) ) &Walkmesh ::IsLocked)
    ];





    luabind::globals( m_LuaState )[ "walkmesh" ] = boost::ref( *( EntityManager::getSingletonPtr()->GetWalkmesh() ) );



Quote
Also, how do I set variables?  Like for storing the position of the elevator or for the activation of certain scripts?

You need to store it anywhere in lua where you want )
Luastate is not reloaded after map load. Only entity container reloaded. I created file output\data\scripts\ffvii\data.lua for all this variables.
You can store there like this FFVII.Data.progress_game = 7
« Last Edit: 2014-11-17 18:50:34 by Akari »

WolfMan

  • *
  • Posts: 372
  • One whos possessed by nothing possesses evrything
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #15 on: 2014-11-17 19:04:35 »
Tom and Akari. I am extremely impressed with your knowledge and abilities. I really need to sit down and understand this project. I really am in the dark on what Q-Gears is.

meesbaker

  • *
  • Posts: 324
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #16 on: 2014-11-18 01:10:20 »
Tom and Akari. I am extremely impressed with your knowledge and abilities. I really need to sit down and understand this project. I really am in the dark on what Q-Gears is.

I also find this extremely impressive! As far as I understand it qgears is a selfmade executable that will run ff7 from the extracted files found on the psx ISO. That eliminates the need to play some pc port or using an emulator. Just extracting all the files, scripts, models and fields and qgears runs it like a pro ;)

At least that is the target and the progress seems very good so far. Keep it up guys :)

LeonhartGR

  • *
  • Posts: 2577
  • ~Whatever...~ Enjoy life!
    • View Profile
    • LeonhartGR Productions
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #17 on: 2014-11-18 02:10:00 »
Smash the like button!

KnifeTheSky77

  • *
  • Posts: 548
  • Somnambulistic Paraphile
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #18 on: 2014-11-18 02:29:55 »
Qgears is getting lonely Akari, please give it some love  :) :)


WolfMan

  • *
  • Posts: 372
  • One whos possessed by nothing possesses evrything
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #19 on: 2014-11-18 12:44:50 »
Will it eventually be able to use mods? You can't import models into psx from my understanding.

Tom

  • Moderator
  • *
  • Posts: 207
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #20 on: 2014-11-18 13:45:18 »
Figured out how to add Walkmesh management, turns out it wasn't ScriptManagerCommands.h but ScriptManagerBinds.h.  Now working on nmkin_1 field and will start nmkin_2
« Last Edit: 2014-11-18 13:53:24 by Tom »

paralleluniverse

  • *
  • Posts: 15
  • <3 Final Fantasy
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #21 on: 2014-11-18 17:52:13 »
This is pretty neat, lots of information in this topic :D

Tom

  • Moderator
  • *
  • Posts: 207
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #22 on: 2014-11-18 18:45:26 »
Akari, is it currently possible to easily show text on screen?  Like the dialogue ingame like: [Barret] Yo! Is this your first time in a reactor?
Actually I need the on_talk script to work, for biggs deciphering the codes on the doors when you talk to him.
« Last Edit: 2014-11-18 18:53:34 by Tom »

Akari

  • Moderator
  • *
  • Posts: 766
    • View Profile
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #23 on: 2014-11-19 15:31:56 »
I add support for "on_interact" callback for entity-s and line triggers.
Could you compile changes and send me back? I don't have compiler here to do it myself. I can add dialog support but it will take a while.

http://vk.com/doc7350946_343148641

sithlord48

  • Moderator
  • *
  • Posts: 1632
  • Dark Lord of the Savegame
    • View Profile
    • Blackchocobo
Re: Q-Gears Field Module - Midgar Conversion Project
« Reply #24 on: 2014-11-19 20:42:58 »
additions to the source should be happening on the github repo. Do these new src files replace the exsisting copies. i can do that for you . if you dont have a github you should create one and ill add you to the project.

i have been a tad busy lately with stuff so i have been a bit slacking on my q-gears duty (sorry).