SoulFu Forums II
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Development Tools

2 posters

Go down

Development Tools Empty Development Tools

Post  AgentX Tue Mar 27, 2012 12:19 am

These are some brief explanations on how to use the development tools posted by Aaron on the old forum

Important Info for the Scripting System
Author: dunlar

Some people are having trouble with my script language. So here's a thread to ease those troubles... I won't promise anything, but there are a few things I'd like to say.

1. The script system was the very first thing I wrote for this game. It works as intended. If there is a problem, it is 99.99% likely to be due to the script itself.

2. The script system is not careful with where you access memory, so you can crash the game that way. Be careful.

3. Don't attempt to use Lua. Trying to switch over would be nearly impossible.

4. Use the Emacs tool. It allows you to recompile your script as you go. Just make sure you export, save, and backup often in case you have trouble.

5. I decided to use an indent system to force clean code.

6. To use the tools while playing the game, open up WMESSAGE.SRC and change around the first line... That'll allow you to hold down C while you're playing to pop up some tools... WSTATUS has a similar cheat commented out.

There's more, but that's enough for now. Some of the important scripts are GENERIC, STANDARD, ITEMREG, and MAPGEN.
-------------------------------------------------------------------------------------
CTRL-K to Kut. Several lines.
CTRL-C to Copy. Single line only.
CTRL-V to Paste.

The script system is basically a mini version of C with a few peculiarities... What things in particular do you need help with?

When you have something like self.x = 5.0, make sure you have self set correctly... It should be a pointer. So if I do...

Code:
target = FindTarget()
target.x = 5.0


I might crash the game, because I never bothered to check if target was valid... The "good" way to do it is like this...

Code:
target = FindTarget()
if(target)
target.x = 5.0


The FindIndex() and FindByIndex() functions are useful too... FindIndex() will return a character number, FindByIndex() will translate a character number into a pointer... For example...

Code:
target = FindByIndex(20)
if(target)
target.x = 5.0
target_index = FindIndex(target)
if(target_index == 20)
target.y = 5.0


Also, this is probably important... Always Export, then Recompile, then Save...
-------------------------------------------------------------------------------------
There is the source code (the .C files), and then there are the ingame script files (the .SRC files). Start up SoulFu DEVTOOL. Hold down the C key at the main menu. Go to the hidden tools menu. Use the text editor. Type in WMESSAGE.SRC. Change the first line to read...

Code:
#define CHEAT (SystemGet(SYS_DEVTOOL, 0, 0) && SystemGet(SYS_KEYDOWN, 99, 0))


...press the Recompile button, and you'll be able to use some of the tools while you're actually playing, by holding down the C key. Some of the other script files, like WSTATUS.SRC and WSPAWN.SRC and IRING.SRC have similar cheats built in... The logfile also gives a complete listing of all the .SRC files in the game.

Hope that helps!




Info on the Modeler tool
Author: dunlar

The file name for the player character (which contains all of the class sub-types) is CPLAYER.SRC. Run SoulFu DEVTOOL. Hold down C at the main menu. Go to the tools menu. Use the text editor. Type CPLAYER.SRC at the prompt.

Reading through that file will tell you all of the ModelAssigns used to set up each part of the character model. For example...

Code:
ModelAssign(self+MODEL_HEAD_FILE, "FILE:PLRHELM0.RDY")
ModelAssign(self+MODEL_HEAD_TEX0, flesh_color)
ModelAssign(self+MODEL_HEAD_TEX1, "FILE:DYELLOW.RGB")
ModelAssign(self+MODEL_HEAD_TEX2, "FILE:DBLACK.RGB")
ModelAssign(self+MODEL_HEAD_TEX3, "FILE:=ARMOR.RGB")
ModelAssign(self+MODEL_HEAD_COLOR, body_color_rgb)


If you go back to the tools menu. Click the file util button. Type PLRHELM0.RDY in the prompt. Click the modeler button (on the right side of the file util window). The modeler tool should open up, with a leather hood as the base model (the one that's actually being edited). In the upper left hand corner, you'll see 4 prompts for textures -- fill in FLESH, DYELLOW, DBLACK, and =ARMOR -- and the model won't look quite so screwy.

The player character model is pretty complicated, so you might have an easier time starting with a Kitten or a Porc or something like that.

To actually make a new model, just export an old one, change the name, and import it again.

To make the character actually use the model, just edit that character type's script file... Hope you enjoy playing...
-------------------------------------------------------------------------------------
A) There always has to be one bone at least, to orient the model.
B) Weapons attach to special weapon bones (which have different colors)
C) From the bone menu in the modeler, use the cursor to position your joint with the crosshairs, then hit the spacebar to plop it. Hold X and hit space bar to plop two symmetrical joints. Then it's just connect the dots.





Info on the Other Tools
Author: dunlar

Connecting the rooms is a little tricky, because the maps can be randomly generated. In the room editor, use the door menu to make several of the walls doorable (select two points of the wall) -- test the room to show all of the possible doors. Then, your map has to be added to the map list in MAPGEN.SRC (using the ingame text editor)... Just copy and paste one of the lines that looks like this...

Code:
fail = fail | SuperPlopRoom("FILE:CAVES001.SRF", AREA_CAVES, -1, FALSE, flags)


...and change the filename to your room name. Recompile and save.

To make the shops have different items, edit the PSHOP.SRC file, and change the item names for the given shop. For example, change ITEM_FISH to ITEM_GREAT_SWORD. The list of item types can be found in DEFINE.TXT... Oh, here... I'll make it easy for 'ya... Very Happy

// General items (0-63)...
#define ITEM_NONE 0
#define ITEM_JUMP 1
#define ITEM_TALK 2
#define ITEM_PRAY 3
#define ITEM_KISS 4
// 5 is unused
#define ITEM_HIDE 6
#define ITEM_TINKER 7
#define ITEM_GONNE 8
#define ITEM_GRONNADE 9
#define ITEM_QUIVER_10 10
#define ITEM_QUIVER_9 11
#define ITEM_QUIVER_8 12
#define ITEM_QUIVER_7 13
#define ITEM_QUIVER_6 14
#define ITEM_QUIVER_5 15
#define ITEM_QUIVER_4 16
#define ITEM_QUIVER_3 17
#define ITEM_QUIVER_2 18
#define ITEM_QUIVER_1 19
#define ITEM_AMMO_10 20
#define ITEM_AMMO_9 21
#define ITEM_AMMO_8 22
#define ITEM_AMMO_7 23
#define ITEM_AMMO_6 24
#define ITEM_AMMO_5 25
#define ITEM_AMMO_4 26
#define ITEM_AMMO_3 27
#define ITEM_AMMO_2 28
#define ITEM_AMMO_1 29
#define ITEM_LETTER 30
#define ITEM_HORN 31
#define ITEM_DOLL 32
#define ITEM_FLAMER 33
#define ITEM_HEAL 34
#define ITEM_MANA 35
#define ITEM_SUPER_HEAL 36
#define ITEM_SUPER_MANA 37
#define ITEM_EXPLOSIVES 38
#define ITEM_FISHING_POLE 39
#define ITEM_BOOK_5 40 // Adventurer's Handbook & Virtue
#define ITEM_BOOK_4 41 // Magic Spells
#define ITEM_BOOK_3 42 // Beastiary
#define ITEM_BOOK_2 43 // Weapons & Armor
#define ITEM_BOOK_1 44 // Rogue
#define ITEM_RING 45
#define ITEM_GOLD_BAR 46
#define ITEM_ONE_UP 47


// Armor items (48-123) (4 variants each)...
#define ITEM_SHIELD 48
#define ITEM_MIRROR_SHIELD 52
#define ITEM_BOW 56
#define ITEM_LONG_BOW 60
#define ITEM_HELM_1 64
#define ITEM_HELM_2 68
#define ITEM_HELM_3 72
#define ITEM_HELM_4 76
#define ITEM_HELM_5 80
#define ITEM_BODY_1 84
#define ITEM_BODY_2 88
#define ITEM_BODY_3 92
#define ITEM_BODY_4 96
#define ITEM_BODY_5 100
#define ITEM_LEGS_1 104
#define ITEM_LEGS_2 108
#define ITEM_LEGS_3 112
#define ITEM_LEGS_4 116
#define ITEM_LEGS_5 120

// Food items (124 - 135)
#define ITEM_FISH 124
#define ITEM_MEAT 125
#define ITEM_MEAT_ROTTEN 126
#define ITEM_PORC 127
#define ITEM_PORC_ROTTEN 128
#define ITEM_FOOD 129
#define ITEM_COOKIE 130
#define ITEM_TRIPE 131
// 132 is Unused
// 133 is Unused
// 134 is Unused
// 135 is Unused


// Weapon items (136-231) (8 variants each)...
#define ITEM_DAGGER 136
#define ITEM_SHORT_SWORD 144
#define ITEM_SWORD 152
#define ITEM_GREAT_SWORD 160
#define ITEM_OBSIDIAN_BLADE 168
#define ITEM_DRAGON_SWORD 176
#define ITEM_HAMMER 184
#define ITEM_PICK_AXE 192
#define ITEM_HATCHET 200
#define ITEM_MACE 208
#define ITEM_BROAD_AXE 216
#define ITEM_WAR_HAMMER 224

// Spell items (232-255)
// Level 1 (10 Int)
#define ITEM_SPELL_MISSILE 232
#define ITEM_SPELL_POISON_CLOUD 233
#define ITEM_SPELL_ANIMATE_DEAD 234
#define ITEM_SPELL_ENTANGLE 235
#define ITEM_SPELL_DISENCHANT 236
#define ITEM_SPELL_KNOCK 237

// Level 2 (20 Int)
#define ITEM_SPELL_FLAME_WALL 238
#define ITEM_SPELL_LIGHTNING_BOLT 239
#define ITEM_SPELL_TELEPORT 240
#define ITEM_SPELL_ENCHANT 241
#define ITEM_SPELL_MAPPING 242
#define ITEM_SPELL_LUCK 243

// Level 3 (30 Int)
#define ITEM_SPELL_FIREBALL 244
#define ITEM_SPELL_ICEBALL 245
#define ITEM_SPELL_LEVITATE 246
#define ITEM_SPELL_PETRIFY 247
#define ITEM_SPELL_PORTAL 248
#define ITEM_SPELL_DEFLECT 249

// Level 4 (40 Int)
#define ITEM_SPELL_FIRESTORM 250
#define ITEM_SPELL_HASTE 251
#define ITEM_SPELL_INVISIBILITY 252
#define ITEM_SPELL_MORPH 253
#define ITEM_SPELL_FLAME_BRAND 254
#define ITEM_SPELL_ICE_BRAND 255
-------------------------------------------------------------------------------------
To put in a new shop in the town, go to the Tools Menu. Click File Util. Type TOWN000.SRF and click Room Edit on the right side. In the top left corner, change the drop-down from Vertex to Object Group. You'll notice several colored diamonds in the room if you zoom in. Those are object spawn locations. Click one of 'em and it will tell you what object spawns there...

A shop is comprised of a DDD plop (the actual house looking thing -- HOUSE00.DDD for example), and a particle that handles the actual workings of the shop (PSHOP.RUN). The DDD is White, and the particle is green if that helps. Click on one, then click the Copy Object button. Do it again for the other. You'll now have 2 new objects in the center of the room -- put 'em where you want. In the green object, change the "Misc7 = 2" (or whatever) drop down list to be a number from 0 to 15... That's used by the PSHOP.SRC script to determine which shop type you'll have.
-------------------------------------------------------------------------------------
Adding new classes involves tweaking WSPAWN.SRC, which is the little character setup window that appears when you first start the game. The cheat feature shows how to start as a monster...

To change hair styles, look at CPLAYER.SRC.

To add a new item, you'll need a PCX file for the icon and a SRC file for the item script... You'll also need to register it in ITEMREG.SRC... If the item is a weapon, you'll also need a DDD model file.
AgentX
AgentX

Posts : 62
Join date : 2011-11-16
Location : Lorule

Back to top Go down

Development Tools Empty connecting new room

Post  Zoz Wed May 02, 2012 11:30 pm

I understand how to connect a new room in a randomized stage, but I'ld like to add a room to the castle....

I create a new room named TOWN008.SRF, I add a passage modifying the TOWN006.SRF file and I exported the file MAPGEN.SRC, I modified it adding this line after the fist room line of //castle :

"
AddRoom( 130.0, -400.0, 0, AREA_SUMMON, 0, 0, "FILE:TOWN008.SRF", 6, FALSE, RollDice(1, 256), 0, flags | MAP_ROOM_FLAG_FOUND)
"
I uploaded and test : it doesn't work : there is no change in the game (exept the cupboard I took away in the room TOWN006.SRF to make place for a passage).

Someones know why ?

Zoz

Posts : 12
Join date : 2012-05-02

Back to top Go down

Development Tools Empty Re: Development Tools

Post  AgentX Thu May 03, 2012 2:28 am

I have been trying to figure that out to. You might want to look at the arena mod because they add a room to to the town. The Mapgen code for the town origially looks like this

// Town...
AddRoom( 0.0, 0.0, 0, AREA_SUMMON, 0,40960, "FILE:TOWN000.SRF", 65535, FALSE, RollDice(1, 256), 1, flags | MAP_ROOM_FLAG_TOWN | MAP_ROOM_FLAG_FOUND | MAP_ROOM_FLAG_OUTSIDE)

and they changed it to this
// Town...
AddRoom( 0.0, 0.0, 0, AREA_SUMMON, 0,40960, "FILE:TOWN000.SRF", 65535, FALSE, RollDice(1, 256), 1, flags | MAP_ROOM_FLAG_TOWN | MAP_ROOM_FLAG_FOUND | MAP_ROOM_FLAG_OUTSIDE)
AddRoom( -150.0, -4.0, 0, AREA_SUMMON, 0,33300, "FILE:ARENA000.SRF", 0, FALSE, RollDice(1, 256), 0, flags | MAP_ROOM_FLAG_FOUND | MAP_ROOM_FLAG_OUTSIDE)
The numbers right here /\ I believe are x, y, z coordiates (for the door you enter maybe?) so you'll need to mess around with that to get it to work.
What are your new rooms like? I once made a level with lots of grass and trees that I called The Forest.
AgentX
AgentX

Posts : 62
Join date : 2011-11-16
Location : Lorule

Back to top Go down

Development Tools Empty function addroom

Post  Zoz Thu May 03, 2012 6:53 pm

I'm studying the function "AddRoom" in the MAPGEN.SRC file, what I understand :
the function is composed by 12 others function wich have to be completed to make it works.

-> Float x and Float y seems to fix the position of the room (I think not the door's position because many rooms have more than 1 doors).

-> int level : I'm not sure, but it is maybe the number of the stage level : castle is 0, cellar 1, sewer 2...

-> int area : I think this function is used by the game to know wich randooms monster or objects will apears in the room, linked at the 2 tools : randoom monsters tool et random item tool.

-> int difficulty : I supose if we put 0 the function is disabled. And if we put "difficulty" the function calculates the number of monsters depending on the number of players.

-> int rotation : I supose it turn te room, but I dont know how it works...

-> int file : the name of the room's file.

-> int from_room : I don't know what is it...

-> int multi_connect : always "FALSE" excepted when the room's file is used 2 times in the stage..

-> int seed : any ideas ?

-> int twset : I supose it changes the font colour, because in castle is 0 and in town is 1 (and here the sky is blue)

-> int flags : I think here we can chose if the room haves to be entered before appearing on the map, and wich logo haves to appear on the map (boss, virtue, town, or stairway)

the line I added is a copy of the first line of castle : I have changed the x and y fload : 130 for x, the same than Town004, Town007, ST0 and 006... and -400, the same than Townvr0. Doors seems to be in front of their equivalent in others rooms.
I've put the value of int from_rom at random (I'me not sure of the english).

I think the problem come from int from_room and/or int rotation...

I continue searching..

What sort of room ? at this time the only room I've created is an empty room...just for understand how it works, but I'ld like to create maybe an exterior stage : where did you found trees ? did you create them ?

Zoz

Posts : 12
Join date : 2012-05-02

Back to top Go down

Development Tools Empty Re: Development Tools

Post  Zoz Thu May 03, 2012 8:24 pm

I'm learning...

the order of lines in the mapgen.src file seems to have importance :
I added this line at the end of all the rooms in castle :

AddRoom(-130.0, -410.0, 0, AREA_SUMMON, 0, 0, "FILE:TOWN008.SRF", 6, FALSE, RollDice(1, 256), 0, flags | MAP_ROOM_FLAG_FOUND)

and it works.
Why I put 6 at int from_room ? intuition...
I've done the map of castle and writen on rooms they from_room number fouded in mapgen.src
[img]Development Tools Carte_10[/img]
The order of rooms in mapgen is : 0,1,1,1,3,5,4,7,8,2,6 (in column in mapgen)

I don't understant the logic of the file's order and from_room's number....

Zoz

Posts : 12
Join date : 2012-05-02

Back to top Go down

Development Tools Empty Re: Development Tools

Post  AgentX Thu May 03, 2012 9:52 pm

Congratultions on placing the room. Now I'm starting to understand too. The trees were already made but not put in any rooms if you want to add them in a room add an object called CTREE.RUN.
AgentX
AgentX

Posts : 62
Join date : 2011-11-16
Location : Lorule

Back to top Go down

Development Tools Empty Re: Development Tools

Post  Zoz Fri May 04, 2012 12:57 am

Nice tree ! but while testing the room, the tree became transparent at moments....
do you know how we can edit/create .RUN files ?
your level : The Forest is testable ? does it seem to take place outside ? or trees are undergrouds ?!


Zoz

Posts : 12
Join date : 2012-05-02

Back to top Go down

Development Tools Empty Re: Development Tools

Post  AgentX Fri May 04, 2012 1:16 am

Every .RUN file has a corresponding .SRC file, so to edit a .RUN file you mess with its .SRC file. The Forest was underground because I couldn't figure out how to place them next to the town, but that might not be a problem anymore. The from_room number determines which room to attach it to. Each room's number depends on where on the list it is Town000 is room 0, Town001 is room 1, Town002 is room 2, etc.
AgentX
AgentX

Posts : 62
Join date : 2011-11-16
Location : Lorule

Back to top Go down

Development Tools Empty Re: Development Tools

Post  Zoz Fri May 04, 2012 7:41 pm

Are you sure ? I'm not sure understanding well : do you say that for the Town000.srf files, the from_room values is 0, for town001 is 1, ect...
but in my exemple Town001 has 0, and Town002, Town003, and Town004 have 1...
look , I took an extract of mapgen.src. the last line is my room.

\here file's name/ \/ here from_room number's
"FILE:TOWN001.SRF", 0,
"FILE:TOWN002.SRF", 1,
"FILE:TOWN003.SRF", 1,
"FILE:TOWN004.SRF", 1,
"FILE:TOWN005.SRF", 3,
"FILE:TOWN006.SRF", 5,
"FILE:TOWN007.SRF", 4,
"FILE:TOWNST0.SRF", 7,
"FILE:TOWN006.SRF", 8,
"FILE:TOWNVR0.SRF", 2,
"FILE:TOWN008.SRF", 6,

Zoz

Posts : 12
Join date : 2012-05-02

Back to top Go down

Development Tools Empty Re: Development Tools

Post  AgentX Fri May 04, 2012 8:08 pm

maybe this picture will make it make more sense. it's not the actual values, but it's what you need to put in when you want to connect a new room with the room.
https://i.servimg.com/u/f48/17/48/92/83/mapgen11.jpg the red is the room number and the blue is the from_room number.
AgentX
AgentX

Posts : 62
Join date : 2011-11-16
Location : Lorule

Back to top Go down

Development Tools Empty Re: Development Tools

Post  Zoz Fri May 04, 2012 10:29 pm

I dont understand... are numbers in red the from_room's values ? have-you tested it because mine are Ok.

Well, it doesn't matter now, I have put my room... but I would understand scratch

Zoz

Posts : 12
Join date : 2012-05-02

Back to top Go down

Development Tools Empty Re: Development Tools

Post  AgentX Sun May 06, 2012 7:21 pm

I suppose it doesn't matter. How did you figure out the x and y coordinates of your door? Is there a way to check them or do you have to guess?
AgentX
AgentX

Posts : 62
Join date : 2011-11-16
Location : Lorule

Back to top Go down

Development Tools Empty Re: Development Tools

Post  Zoz Sun May 06, 2012 10:03 pm

I calculated them looking at coordinates of others rooms.
Looking at the map and the coordinates of rooms on the mapgen's file, It's easy to understand where are rooms. Not the same with the from_room value...
x and y coordinates can be aproximated : if the room isn't exactly at the right place, the room appears and we can rectificate with the map. But if coordinates are to much approximatives, the room doesn't appear...

scuse me for the bad english,

Zoz

Posts : 12
Join date : 2012-05-02

Back to top Go down

Development Tools Empty Re: Development Tools

Post  Zoz Sun May 06, 2012 10:07 pm

Woops !
you talk about the doors... I don't know where are door's coordinates.

Zoz

Posts : 12
Join date : 2012-05-02

Back to top Go down

Development Tools Empty Re: Development Tools

Post  AgentX Mon May 07, 2012 1:36 am

It's okay I figured it out. When you are in the room-editor you can use the vertex plopper to see where the x and y is for things.
AgentX
AgentX

Posts : 62
Join date : 2011-11-16
Location : Lorule

Back to top Go down

Development Tools Empty Re: Development Tools

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum