Warscale 35 - Do you want a flame sword?
by Guimo · 03/09/2009 (12:45 pm) · 6 comments
Hi all!
After the extremely-dull-and-boring last week blog, I really hope I can make up with you with this new blog.
First, I reeived my motherboard replacement from HP and reassembled my laptop. Its working great now and I applied some artic silver thermal compound and cleaned all the dust from the components (and there I thought that a computer bug was related only to software) so I hope that solves the problem for now. I cannot longer thrust this PC for gaming but will make an excellent entertainment enter and maybe the main server for Warscale.
What was planned
IM Windows persistence
As I mentioned last week, I really needed a way to keep the IM windows on top of the GUI. First I decided to create an invisible control which covered all the screen like a layer and added all the IM windows to that layer. The idea was that when the screen changes, I add that layer to the new screen and all windows will move. Unfortunately the large empty control still consumes mouse events and I want those events. I decided to just keep a list of windows (I already had it anyway) and when I change the screen all the windows are moved to that screen in the same position. Torque grants that the controls are detached from the previous window automatically.
Game loading
One thing that bugs me is that while the game is loading, the refresh rate becomes extremely slow. I wanted the user to be able to chat while waiting but unfortunately that wasnt possible. Anyway thats not an easy to solve problem unless I somehow code multithreading inside the engine and that not in my list.
Anyway, what I did fix is that when the game finishes loading the loading screen now fades away and the game screen fades in. Those fades are more than just cosmetic. It gives the camera enough time to reposition itself to its final destination avoiding a problem with a jumping camera which appears using the Advanced Camera resource so it looks great and solves a problem. What else may I ask?
Game end
I fixed the end game proccedure so that gold is assigned properly to the winners (and losers) and the gold information is appropiately transmited to the clients. I also fixed a bug which happened if you passed the turn while your opponent was stil dying.
The gold is also saved in the DB and people who resign the game (not just loses connection but intentionally leaves the game) are penalized with -2 gold pieces... a small amount considering that you may win up to 10 gold just for losing a game and 100 for winning the game.
Also, a 5 seconds delay between the end game message and showing the results has been added meaning that you will have the pleasure of seeing your opponent die before the end game screen covers the screen. Some checks were included to avoid clashes with the server.
Video!
With everything in place, I can show you a small video. This is work in progress on some elemental efects in Warscale. This is a simple trick learned after studying the techniques used by Blizzard Entertainment.
This technique allows me to setup an area in fire. I can setup a hand in fire or maybe the feet or maybe the head meaning I can have really cool magic items. Not only that but varying the texture I can have other effects like smoke, green gas, electricity, plasma... you name it.
I was forced too fix some problems with the Z billboards and add to the WSGuiObjectView the ability to mount multiple objects into the same node. The technique is far from complete. New parameters need to be added on the logical level for this to work effectively but its a first step.
If anyone is interested in this technique Im planning to create a small pack to sell in the store which includes the engine fixes (1 line so its painless), the milkshape files, png animated textures and cs scripts to make them work using the WSGuiObjectView (which I will include also for free) and in the game mision and also instructions about how to modify the basic setup in order to get your personalized effects. This is a fairly simple pack that I will release once this technique has been polished and I see its strong enough not to crash in your games.
The plan for this week
All the GUI pieces have been polished. Not completely polished as that will be a task for the Beta-to-RC step (thing like server ping, ESC and Enter keys default actions, final backgrounds, some icons and so on) but it is almost done.
Weapon special effects
So this week and for the next month I will completely focus on the game. Of course I will work in this special effects thing but I guess it is a requirement for the game as this tehnique will also be the basis for fire walls and burning effects (players get continuous damage).
In-game GUI fixes
Of course the players will interact using the GUI and in this case the GUI has many bugs which need to be solved while changing states, chatting and more.
Code snippet
For those curious about the ZBillboard fix. The problem was that in stock torque, the ZBillboard works fine if the object is standing up (0,0,1). But if you applied a rotation on x or y, the up (z) axis rotated and the ZBillboard was no longer in Z. So, we can call it a local Z billboard but for this effect I needed a global Z billboard. ortunately this is really easy to fix. Just open tsMesh.cc and search a function called forceFaceCameraZAxis. Once you get that function find this line:
mat.getColumn(2,&z); // this is where the z-axis goes, keep it here but reset x and y
Then add this line exactly under that line:
z.set(0,0,1);
You are just forcing the Z axis to be always up. Recompile and there you go.
This is a small trick and as usual not everybody will need it but as usual I guess somebody may find it interesting.
Luck with your projects!
Guimo
After the extremely-dull-and-boring last week blog, I really hope I can make up with you with this new blog.
First, I reeived my motherboard replacement from HP and reassembled my laptop. Its working great now and I applied some artic silver thermal compound and cleaned all the dust from the components (and there I thought that a computer bug was related only to software) so I hope that solves the problem for now. I cannot longer thrust this PC for gaming but will make an excellent entertainment enter and maybe the main server for Warscale.
What was planned
IM Windows persistence
As I mentioned last week, I really needed a way to keep the IM windows on top of the GUI. First I decided to create an invisible control which covered all the screen like a layer and added all the IM windows to that layer. The idea was that when the screen changes, I add that layer to the new screen and all windows will move. Unfortunately the large empty control still consumes mouse events and I want those events. I decided to just keep a list of windows (I already had it anyway) and when I change the screen all the windows are moved to that screen in the same position. Torque grants that the controls are detached from the previous window automatically.
Game loading
One thing that bugs me is that while the game is loading, the refresh rate becomes extremely slow. I wanted the user to be able to chat while waiting but unfortunately that wasnt possible. Anyway thats not an easy to solve problem unless I somehow code multithreading inside the engine and that not in my list.
Anyway, what I did fix is that when the game finishes loading the loading screen now fades away and the game screen fades in. Those fades are more than just cosmetic. It gives the camera enough time to reposition itself to its final destination avoiding a problem with a jumping camera which appears using the Advanced Camera resource so it looks great and solves a problem. What else may I ask?
Game end
I fixed the end game proccedure so that gold is assigned properly to the winners (and losers) and the gold information is appropiately transmited to the clients. I also fixed a bug which happened if you passed the turn while your opponent was stil dying.
The gold is also saved in the DB and people who resign the game (not just loses connection but intentionally leaves the game) are penalized with -2 gold pieces... a small amount considering that you may win up to 10 gold just for losing a game and 100 for winning the game.
Also, a 5 seconds delay between the end game message and showing the results has been added meaning that you will have the pleasure of seeing your opponent die before the end game screen covers the screen. Some checks were included to avoid clashes with the server.
Video!
With everything in place, I can show you a small video. This is work in progress on some elemental efects in Warscale. This is a simple trick learned after studying the techniques used by Blizzard Entertainment.
This technique allows me to setup an area in fire. I can setup a hand in fire or maybe the feet or maybe the head meaning I can have really cool magic items. Not only that but varying the texture I can have other effects like smoke, green gas, electricity, plasma... you name it.
I was forced too fix some problems with the Z billboards and add to the WSGuiObjectView the ability to mount multiple objects into the same node. The technique is far from complete. New parameters need to be added on the logical level for this to work effectively but its a first step.
If anyone is interested in this technique Im planning to create a small pack to sell in the store which includes the engine fixes (1 line so its painless), the milkshape files, png animated textures and cs scripts to make them work using the WSGuiObjectView (which I will include also for free) and in the game mision and also instructions about how to modify the basic setup in order to get your personalized effects. This is a fairly simple pack that I will release once this technique has been polished and I see its strong enough not to crash in your games.
The plan for this week
All the GUI pieces have been polished. Not completely polished as that will be a task for the Beta-to-RC step (thing like server ping, ESC and Enter keys default actions, final backgrounds, some icons and so on) but it is almost done.
Weapon special effects
So this week and for the next month I will completely focus on the game. Of course I will work in this special effects thing but I guess it is a requirement for the game as this tehnique will also be the basis for fire walls and burning effects (players get continuous damage).
In-game GUI fixes
Of course the players will interact using the GUI and in this case the GUI has many bugs which need to be solved while changing states, chatting and more.
Code snippet
For those curious about the ZBillboard fix. The problem was that in stock torque, the ZBillboard works fine if the object is standing up (0,0,1). But if you applied a rotation on x or y, the up (z) axis rotated and the ZBillboard was no longer in Z. So, we can call it a local Z billboard but for this effect I needed a global Z billboard. ortunately this is really easy to fix. Just open tsMesh.cc and search a function called forceFaceCameraZAxis. Once you get that function find this line:
mat.getColumn(2,&z); // this is where the z-axis goes, keep it here but reset x and y
Then add this line exactly under that line:
z.set(0,0,1);
You are just forcing the Z axis to be always up. Recompile and there you go.
This is a small trick and as usual not everybody will need it but as usual I guess somebody may find it interesting.
Luck with your projects!
Guimo
About the author
#2
03/09/2009 (5:49 pm)
Cool sword! The more we hear about Warscale, the better it looks and sounds -- keep these updates coming. It's great to see someone taking a custom approach to effects without relying on AFX as the core of their effects system, my interest is piqued.
#3
AFX relies heavilly on particle systems which is ok but when you have to create something like a flame sword then you have to setup a lot of parameters and the number of particle emitters you need increase and the final effect is hard to work out. Also a particle system will require at least 100 particles at the same time to produce a decent effect. Thats 200 billboarded triangles.
This approach uses billboards and animated textures. Right now its is rendering a single mesh with 60 triangles and I think I can cut it on half.
Just think about an army of 40 fire elementals. Using particle systems will require at least 4000 additional triangles. Using this approach you can do the same with just 2400 triangles (or less).
On the other side the particles can be better customized and will leave trails that this approach cant but that may require more particles and that means more triangles. So I thing an hybrid method would be the best approach. This effects for very controlled element presentation and particles for trails and smoke which add more realism.
Luck!
Guimo
03/09/2009 (10:15 pm)
Warscale uses AFX (would be dumb not to do so) but this particular effect doesnt. We must remind that AFX, even when provides enhanced widgets and particle systems, is more a choreographic system than anything else.AFX relies heavilly on particle systems which is ok but when you have to create something like a flame sword then you have to setup a lot of parameters and the number of particle emitters you need increase and the final effect is hard to work out. Also a particle system will require at least 100 particles at the same time to produce a decent effect. Thats 200 billboarded triangles.
This approach uses billboards and animated textures. Right now its is rendering a single mesh with 60 triangles and I think I can cut it on half.
Just think about an army of 40 fire elementals. Using particle systems will require at least 4000 additional triangles. Using this approach you can do the same with just 2400 triangles (or less).
On the other side the particles can be better customized and will leave trails that this approach cant but that may require more particles and that means more triangles. So I thing an hybrid method would be the best approach. This effects for very controlled element presentation and particles for trails and smoke which add more realism.
Luck!
Guimo
#4
The effect looks stunning! You got my attention as soon as you started talking about body parts being on fire...
I have been following your blogs, its great seeing the progress, but what version of Torque are you using now?
This is something we would probably purchase if the price was right, and it was TGEA 1.81 compatible.
Jondo
03/09/2009 (11:25 pm)
Guimo,The effect looks stunning! You got my attention as soon as you started talking about body parts being on fire...
I have been following your blogs, its great seeing the progress, but what version of Torque are you using now?
This is something we would probably purchase if the price was right, and it was TGEA 1.81 compatible.
Jondo
#5
I'm using TGE 1.5.2 but I was checking the TGEA 1.8.1 files and it looks easy to change. The ZBillboard point is located in the tsMesh.cpp around line 182. Here is where the fix for global ZBillboards should be done (not the same fix unfortunately but simple enough also).
Other than that, the planned resource should work in TGEA also as it is Torquescript calls basically.
The updated WSGuiObjectView for TGE may be a problem. Right now it is a free resource and anybody can get it just by sending me an email. The problem is that the control is complex and I dont have the time right now to explain the code or its capabilities so if you get it you are on your own. I have previously asked for somebody to help me writing a resource but nobody offered so I prefer jut not release it as it may become a headache.
I plan to upgrade Warscale to T3D when it comes out so eventually I will be forced to upgrade the WSGuiObjectView to T3D too. I plan to skip TGEA completely as T3D looks more mature.
But even if we take the ObjectView aside, the effects can be used just fine in the mission mounting them into objects and all. Of course you can get your body parts in fire... just dont tell me which body parts...
Luck!
Guimo
03/10/2009 (12:22 am)
Thanks Jondo, you are right.I'm using TGE 1.5.2 but I was checking the TGEA 1.8.1 files and it looks easy to change. The ZBillboard point is located in the tsMesh.cpp around line 182. Here is where the fix for global ZBillboards should be done (not the same fix unfortunately but simple enough also).
Other than that, the planned resource should work in TGEA also as it is Torquescript calls basically.
The updated WSGuiObjectView for TGE may be a problem. Right now it is a free resource and anybody can get it just by sending me an email. The problem is that the control is complex and I dont have the time right now to explain the code or its capabilities so if you get it you are on your own. I have previously asked for somebody to help me writing a resource but nobody offered so I prefer jut not release it as it may become a headache.
I plan to upgrade Warscale to T3D when it comes out so eventually I will be forced to upgrade the WSGuiObjectView to T3D too. I plan to skip TGEA completely as T3D looks more mature.
But even if we take the ObjectView aside, the effects can be used just fine in the mission mounting them into objects and all. Of course you can get your body parts in fire... just dont tell me which body parts...
Luck!
Guimo
#6
Guimo
03/10/2009 (12:26 am)
Now that I see the ZBillboard code in TGEA 1.8.1... this resource should work right out of the box without any modifications. Need to test of course.Guimo
Torque Owner Scott Wilson