PDA

View Full Version : WFTO by Kopavel



Kopavel
January 25th, 2010, 19:24
BRIEF
WFTO demo second release. This demo dont follow WFTO design document, but this forum is the only place where it is accessible, so I call it WFTO nevertheless.

WFTO (Mirror 1) (http://www.filehosting.org/file/details/104966/WFTO_250110.msi) (6.34 MB)
WFTO (Mirror 2) (http://files.joshbishop.me/wfto/WFTO_250110.msi) (6.34 MB)

PROJECT STATUS
Undetermined. There are 3 fraweworks related to WFTO.
The first is IKSLM's NBKE (OpenGL, windows only, with steps toward cross-platformity)
Second is this one (DirectX, windows only)
Third one uses Ogre3D (lots of code, I had no time to sort it out for myself)

I have some plans on implementing entirely new lighting pipeline, this may consume a lot of time. Also, I am planning to use PhysFS to improve loading time and lower disk space requirements. These are just concepts and I am not yet sure I will push this demo much further.

Sources (MS VS 2005) are attached.

FEATURES
Basic dungeon rendering and lighting, with possibility to dig the tiles (I call them blocks).
LUA integration, currently used for handling dungeon and creature events.
Basic creature AI (creatures are visualised as animated skinned meshes).

Kopavel
January 25th, 2010, 19:25
FURTHER DEVELOPMENT
There's still not much flexibility about it, but you can play with LUA scripts.

Here is how scripting works:
Engine imports sets of functions and constants into each LUA script loaded (these sets differ from script to script), as well as common LUA script Common.lua, which contains math functions and proxy functions definitions (for debugging).
Each script recieves COMBINE_ closure so LUA can understand whether engine is executing script or you are testing it on your own.
So when you want to execute script apart from engine, you place Common.lua to folder with your script, and thats pretty much it.
One important C++ function accesible in LUA is trace, which recieves text string and prints in to file lua_debug.txt.

When you execute script on your own, trace merely transforms into print (standard LUA output function)

Important: you need a basic understanding of 3D space to write scripts in 2D. DirectX uses left-handed coordinate system (compared to OpenGL's right handed), which means that X axis points to your right, Y axis points up (to the sky), Z axis points away from you.
In 2D, X axis points right, Y axis points up. When 3D and 2D communicate, X(3D) axis is assumed to point the same way as X(2D), Z(3D) is the same as Y(2D), and Y(3D) is omitted (creatures cant currently move up and down in the dungeon).

1. Media/Common.lua
Check it out yourself, I dont think there is something complicated in it.
Outline: it defines functions to work with tables (structures form C++ are called tables in LUA) of specific type, which I call V2Vec and V3Vec.

2. Dungeon script
Media\Dungeon\dungeon_script.lua

Imported constants:
DUNGEON_BLOCK_WIDTH
DUNGEON_BLOCK_HEIGHT

BLOCK_EMPTY
BLOCK_WALL
BLOCK_DIRT

C++ imported functions:

CreateDungeon
parameters:
int - number of dungeon tiles along x asix (1..128)
int - number of dungeon tiles along z asix (1..128)

Note that since most dungeons algorithms are 2D, I use 2D vectors for it, But DirectX uses Y asix to point upwards, so 3D Z axis is 2D Y axis. (X remains the same)

SetBlockType
parameters:
int - block x position
int - block z position
int - block type

Possible block types are:
BLOCK_DIRT = 0;
BLOCK_EMPTY = 1;
BLOCK_WALL = 2;
, these are defined in LUA (as already stated)

GetBlockType
parameters:
int - block x position
int - block z position

return values:
int - block type

CreateStaticEntity
parameters:
V3Vec - entity position
V3Vec - entity up direction (normalized vector)
V3Vec - entity forward direction (normalized vector)
String - entity mesh file

CreateCreature
[to be continued]

CreateTorch
[to be continued]

RemoveEntities
[to be continued]

GetEntityClass
[to be continued]

GetEntityPosition
[to be continued]

LUA functions called from C++:

OnCreateEntities
No input or output. Called once, right after dungeon is created. Can be used to define custom level appearance.

OnBlockChange
No input or output. Most important function called for each block which type has changed.


3. Creature AI script
[you can add new ones]
Media\Creatures\Orc\orc_script.lua
Each creature recieves its own instance of LUA script context, so you dont need to mess around with 'this' pointer.

C++ imported functions:

SetPosition
parameters:
V2Vec - 2D position you want place creature to. X and Y axis are mapped to X and Z axes, respectively.
return:
bool - false if cant move creature to that position.

GetPosition
return:
V2Vec - Current 2D position of creature. X and Y axis are mapped to X and Z axes, respectively.

SetOrientation
parameters:
V2Vec - Normalized 2D orientation. X and Y axis are mapped to X and Z axes, respectively.
return:
bool - false if cant orient creature that way.

GetOrientation
return:
V2Vec - Normalized 2D orientation. X and Y axis are mapped to X and Z axes, respectively.

SetAnimation
parameters:
string - Name of the animation. Use your own .X files with arbitrary animations.

FindPath
parameters:
V2Vec - where you want the path to start from
V2Vec - where you want the path to end
return:
list of V2Vec - path nodes, each segment of this path is a line .
note:
This function is supposed to be implemented in C++. It currently uses proxy LUA implementation. Feel free to extend it.

LUA functions called from C++:

OnProcess
input:
float - elapsed time since last call
The only function, which is responsible for all AI logic.

IMPORTANT NOTE
This is draft. I'm new to LUA.

Kopavel
January 25th, 2010, 19:32
SOFTWARE

LUA
I used package http://luaforwindows.luaforge.net/index.html#Download
Which contains LUA IDE called SciTE, which I liked very much!

DirectX
Mesh models could be created in any editor (I use 3DSMax 9), but for them to be used by the framework, they need to be converted to DirectX' .X file format.
I used Pandasoft DirectX exporter for 3DSMax 9.

Kopavel
January 25th, 2010, 19:41
[reserved for future posting]

Toukichiro
January 25th, 2010, 21:36
Looking amazing

Exception
January 25th, 2010, 21:42
Looks great, and thanks for the great effort in making some documentation. I was planning to go to bed now, but seems I will be spending some time looking over the source first.

drkow
January 26th, 2010, 00:18
to compile:
Install latest Havok and Lua SDKs, and add to solution:
http://software.intel.com/sites/havok/download/Havok_Physics_Animation_660_PC_XS_win32_VS2008_key code_perpetual_20090704.zip
http://luaforwindows.googlecode.com/files/LuaForWindows_v5.1.4-30.exe

Install Kopavel's demo and copy the contents of the Media folder into your solution directory.


Release + Debug tested and working under VS2008.

Kopavel, can you host this project at github.com? I would love to start making modifications but would prefer to branch from the original version.

Trass3r
January 26th, 2010, 01:22
Undetermined. There are 3 fraweworks related to WFTO.
The first is IKSLM's NBKE (OpenGL, windows only, with steps toward cross-platformity)
just wondering, why doesn't it use SFML (http://www.sfml-dev.org) for platform-independent window creation and input handling? It's quite neat and simple.

SimFirehawk
January 26th, 2010, 10:26
Hey Kopavel,

thanks for sharing your work. It looks amazing.
Just have two questions:
- In your older screenshots there was information about frame rate and usage of GPU memory. Is there any option to turn that on?
I run on a Geforce 8400M with 1024x768 in Fullscreen mode and it worked sometimes a bit slow, so I was just wondering about the frame rate.
- you citate that there is an Ogre3D project working on that too. Could you give any link about that?

Bye Simon

Kopavel
January 26th, 2010, 11:38
to compile:
...

Thanks, I forgot to mention it. Actually, I have Media/ folder with all the art placed in a different location (compared to source codes) on my home PC. However, I commented the code that includes additional directories from this release, so you have to place it there, yes.
Also, I experience huge problems switching from Release to Debug modes because of Havok - thats the reason you may experience problems compiling it as well.


to compile:
Kopavel, can you host this project at github.com? I would love to start making modifications but would prefer to branch from the original version.
If you'd really like to make modifications, I need some time to refactor the code, and mark the code that is stable and should not be modified, as well as code that is experimental (thats like 30% of code).
Anyway, a better way to contribute would be not to modify this one, but rather work on a tool set that would allow people to create content. This tools could be a plugin for 3D editor or a middleware solution (like Ogre3D).

Kopavel
January 26th, 2010, 11:51
- In your older screenshots there was information about frame rate and usage of GPU memory. Is there any option to turn that on?

Nope, this is only available in Debug build (you need another .exe)



I run on a Geforce 8400M with 1024x768 in Fullscreen mode and it worked sometimes a bit slow, so I was just wondering about the frame rate.

I have to spend some time optimizing it. It uses ps2.0 and vs3.0 so its probably a question of fixing a couple of bottlenecks.



- you citate that there is an Ogre3D project working on that too. Could you give any link about that?

I'm not sure If I can put a link for it here, could you PM Nebster (http://forum.keeperklan.com/member.php?u=130) or me via Skype?


SFML (http://www.sfml-dev.org)
Looks promising. Tho I always try to minimize amount of code. Unless we can extract parts of it, SFML would probably bring in 60% of unused functionality.

drkow
January 26th, 2010, 16:34
Thanks, I forgot to mention it. Actually, I have Media/ folder with all the art placed in a different location (compared to source codes) on my home PC. However, I commented the code that includes additional directories from this release, so you have to place it there, yes.
Also, I experience huge problems switching from Release to Debug modes because of Havok - thats the reason you may experience problems compiling it as well.


If you'd really like to make modifications, I need some time to refactor the code, and mark the code that is stable and should not be modified, as well as code that is experimental (thats like 30% of code).
Anyway, a better way to contribute would be not to modify this one, but rather work on a tool set that would allow people to create content. This tools could be a plugin for 3D editor or a middleware solution (like Ogre3D).

I had no problem with debug mode, just needed to include the proper libs... I think Havok even has hybrid ones that will work with either mode.

I added you on Skype, and would love to give a hand. I've never used havok, lua, dx, tinyxml, etc, so I'd like to learn with a simpler task like writing up a GUI. If you can refactor just enough to give me a good place to start with that I would appreciate it.

I have some experience with using openjpeg, ogre, boost, opengl, openal, python, and a few other libs with C++. If you want to try using those I can definitely help, however I'm all for learning/using directx.

Walkerz
January 26th, 2010, 18:36
great to see the project is getting a move on

atari7
January 26th, 2010, 19:05
this looks very promising, keep up the good work kopavel = )

SimFirehawk
January 26th, 2010, 22:16
Thanks for the info. I compiled the debug version and yeah here it is my fps information :)

There are still some uprising questions in my mind:

1. The project looks very promising. At the moment the code base is small enough to handle it "easily", but for further development are there any thoughts about sw architectural design or something like this?

2. I've seen you spend already some work in digging into lua. Wouldn't it be nice to create the system in a way, so that the whole game logic does work from lua, so that the underlying graphical / network / sound / physics system can easily be substituted, without any big changes. The reason why I ask is, that I think about porting the graphical stuff of your work to Ogre3D, having already all the lighting, particle, material, shader and mesh handling out of the box.

Greets Simon

Exception
January 27th, 2010, 06:46
great to see the project is getting a move on

Yes. At this rate, we might have something worthwhile to show when Bluto is done with his other project. :)

Kopavel
January 27th, 2010, 12:17
1. The project looks very promising. At the moment the code base is small enough to handle it "easily", but for further development are there any thoughts about sw architectural design or something like this?

What do you mean by sw architectural design?



2. I've seen you spend already some work in digging into lua. Wouldn't it be nice to create the system in a way, so that the whole game logic does work from lua, so that the underlying graphical / network / sound / physics system can easily be substituted, without any big changes. The reason why I ask is, that I think about porting the graphical stuff of your work to Ogre3D, having already all the lighting, particle, material, shader and mesh handling out of the box.

Have you ever tried it? Nebster has the same mania, of separating everything from everything. From my experience, large LUA code would trun into a complete mess really quickly.
I even feel uncertain about that few amount of LUA code I wrote - maybe I should push more of it to C++.
But the big point is, for a big project, you DO need a lot of middleware. Thats why, there could be a point of using Ogre3D.

Kopavel
January 27th, 2010, 12:23
I'm currently looking into Havok Animation. Seems like they have nice exporting tools from Maya / 3DSmax.

SimFirehawk
January 27th, 2010, 12:54
Hey Kopavel,


What do you mean by sw architectural design?

Some kind of overview how the different stuff ist connected to the other stuff, how they relate and something like this. I studied computer science and it could be, that I am a bit "overacademized" with formal descriptions and stuff like this. But at least what my experience told me from the past, for a one man project, you do have all this stuff in your mind. But when it comes to a point, that more than one person is working on the project there is a need for "communication" in some way, what you have in your mind and what the others have etc.
I mean that shouldn't bother you at the moment. But by reason the project looks very promising I think a lot of people are willing to help in that. So if everyone has different ideas and start to implement them, this will end up in a huge mess, therefore some kind of "design" is appreciated. I do not mean that this should be your task, I think it is a task of all people who want to be involved in programming for this project.



Have you ever tried it? Nebster has the same mania, of separating everything from everything. From my experience, large LUA code would trun into a complete mess really quickly.


Honestly I've never tried it, but I think you can do the same in LUA what you do at the moment with c++, writing at first lowlevel functions and then build more complex functions out of these low level functions.
So the big question is where to draw the line of writing "low level functions" in c++ and LUA. The advantage of having all this in LUA is faster development without recompiling and you do not have to care about all the datatype stuff.

Trass3r
January 28th, 2010, 21:38
Looks promising. Tho I always try to minimize amount of code. Unless we can extract parts of it, SFML would probably bring in 60% of unused functionality.
SFML is very modular. If you only need the window stuff, then you may link only the system and window modules which aren't very big.

Simburgur
February 1st, 2010, 20:05
Awesome work! I uploaded it to my web server here so people don't have to go through that email thing.

Link here: http://files.joshbishop.me/wfto/WFTO_250110.msi

Hapuga
February 1st, 2010, 22:29
Simburgur! you're alive! :D

Jango
February 9th, 2010, 16:17
amazing... just amazing...

danvzare
February 9th, 2010, 18:48
The light's are a bit blurry which i don't like and it would be nice to have a zoom but exept for that, I really thought that it looked great and I loved how the floor looks like it's extruding, it makes it look a lot more grapical and I think the icon was awsome and unexpected.

Shadow of Beetle
February 9th, 2010, 22:13
It's coming along nicely! Yeah the lights are bit blurry, but in a way it may even fit to the game. Nevertheless it's lookig already very professional. :)

Kopavel
February 24th, 2010, 11:48
it would be nice to have a zoom

You can zoom. The controls are the same as Dungeon Keeper - 1.

Ninja
February 25th, 2010, 23:39
@Kopavel how long time do You need to creation the full version WFTO?

A New Room
February 26th, 2010, 00:21
Would imagine a very long time if Kopavel is still the only one working on it. Most companies have quite a large number of people working on the games engine.

There is still a lot of things that can/need to be done while we all wait for engine news. So it is not like there is much reason to put pressure on Kopavel/Engine-crew.

kyle
February 26th, 2010, 09:20
To my understanding kopavel has kind of stopped working on WTFO.

A New Room
February 26th, 2010, 09:38
*Shurg* the whole topic of the engines, who is still active/involved and who is still interested is very confusing :confused:

Hapuga
February 26th, 2010, 09:56
Nobody is active now, as far as I know.

Kopavel
February 26th, 2010, 12:18
What you really need to do, is to rethink the idea of WFTO.
Experienced programmers are not likely to be interested in developing a "dream game".
I am going for a realese a finished project, and for that I need a realistic plan.

What I have done here, was a demo in a first place. I enjoyed writing it, and I like it as it is. :-)

And why dont you start being active yourself? Dotted has done a good work managing the forum and the wiki, I believe you dont have to be a programmer to help him.
Good wiki and SVN server is a must for such project.

Kopavel
February 26th, 2010, 12:24
As for me, i'm working very hard on my engine.
Hate to say that, but it looks like I will need a custom editor, probably will use C# for that.

Hapuga
February 26th, 2010, 15:24
And why dont you start being active yourself? Dotted has done a good work managing the forum and the wiki, I believe you dont have to be a programmer to help him.
Good wiki and SVN server is a must for such project.

Is that question dedicated to me personally? If it is, you are right =) I am less active now than I used to be. I am still thinking of a best way to move russian-speaking community to the forums (a lot of talented guys who love this game).

As for the wiki... it is time-consuming. I lack free time this semester, I am very busy. And the wiki is better to be managed by several people rather than many but by a small part. Style.

I really wish I could be of more help on the technical part.

A New Room
February 26th, 2010, 17:32
Me too ):


What you really need to do, is to rethink the idea of WFTO.
Experienced programmers are not likely to be interested in developing a "dream game".
I am going for a realese a finished project, and for that I need a realistic plan.

I see what you are saying and I think that there should be a very realistic discussion of what can and can't be done at some point (sooner the better), because looking at it now it seems a pretty big mountain to climb with duct tape and sewing thread.


And why dont you start being active yourself? Dotted has done a good work managing the forum and the wiki, I believe you dont have to be a programmer to help him.
Good wiki and SVN server is a must for such project.

dotted is doing a very good job, but I have to say it is not very fair it all being left up to him. From what I gather he manages all the important stuff that keeps this site from falling inward, as well as; the KK wiki, emails to EA, telling us to be calm and wait, being pretty much the only Wtfo developer (other than yourself) that still seems to say yes and no to design choices, etc. What I'm really saying is that hes is too powerful! :p (whether he knows it or not)


What I have done here, was a demo in a first place. I enjoyed writing it, and I like it as it is. :-)

But anyway this is getting off topic. I think I'm going to just mess around with your demo a little more, it is really impressive all you need is random text popping up and you have you self a very basic game :p