Milestone Reached: Mission Launched from Database
by Frank Carney · 12/25/2007 (11:29 pm) · 7 comments
Well I reached a simple milestone today. I created a database that stores barebones mission data as script. Then I developed a routine that will retrieve the mission from the database and launch it. It is overly simplistic right now, but it is a milestone I have been wanting to reach.
The next steps:
1. Upon mission completing load: Populate mission with objects from object table associated with mission table entry.
2. Upon objects populating mission: Choose object to spawn as or object to take control of for player.
3. Save object state back to object table.
These are also simple milestones, but right now to get anything done I have to take baby steps. I am also guessing I will be learning a lot more about how missions are loaded. Also, yes, I want to not generate lighting for mission objects for now. So all objects will be loaded post mission loading. Faster for now, and unless there is sufficient reason (say for lighting effects) I will not be letting the lighting routines light anything but the terrain.
Yeah me!!!
The next steps:
1. Upon mission completing load: Populate mission with objects from object table associated with mission table entry.
2. Upon objects populating mission: Choose object to spawn as or object to take control of for player.
3. Save object state back to object table.
These are also simple milestones, but right now to get anything done I have to take baby steps. I am also guessing I will be learning a lot more about how missions are loaded. Also, yes, I want to not generate lighting for mission objects for now. So all objects will be loaded post mission loading. Faster for now, and unless there is sufficient reason (say for lighting effects) I will not be letting the lighting routines light anything but the terrain.
Yeah me!!!
About the author
#2
12/26/2007 (9:18 am)
Sounds good, Frank.
#3
12/26/2007 (7:47 pm)
Thanks Stephan! Merry Christmas and Happy New Year!
#4
Now I need to get number 2 working.
12/26/2007 (10:18 pm)
Okay, finished up milestone number 3. Objects are now saved back to database.Now I need to get number 2 working.
#5
12/29/2007 (12:41 am)
That's pretty spiffy stuff to get working Frank - good luck with #2!
#6
Well I got number 2 working. It is really simple. I press the space bar and it sends a server command that says this client wants to possess whatever gets hit by a containerRayCast. If the raycast hits an object (Player in this case) then it will set the object as the control object (setControlObject) for the client. So in effect I can become any player object in the sim and unbecome any object by just hitting the space bar again. It is like mounting a vehicle except you are taking them over. Very simple and all script.
I am doing all of this in the tutorial.base because starter.fps has so much stuff in it. I just go look at the other games and pick and choose to see how I am supposed to do something. So far it has been very fun and challenging. For instance when I put in the GuiShapeNameHud in the playGUI gui I suddenly had a mouse that allowed selection, but could not control the camera or players direction with it. I went and looked at both starter.racing and starter.fps and found a very tricky thing. For some reason the playGUI.gui that comes with tutorial.base has canSaveDynamicFields set to false. So when you save it the first time it wipes out a variable called noCursor. If noCursor is set to false or does not exist then the mouse appears and keeps focus of it as a mouse. If it is set to true then the pointer goes away and you can use the mouse to control your object again. Just a little snafu, but it can drive you batty.
So to move forward I need to come up with some more milestones to get this prototype functional.
I want some simple attributes for the players so I need to add tables for attributes, stats, equipment, etc. These would be separate tables so that you can add to the list of stats, attributes, skills, etc. This is something that was bothering me before was how to make the database generic for multiple types of games that may not all want strength, agility, speed, etc.
I need some way to act on these abilities so I need some basic actions for the player to perform with the characters. I need a way for the stats to change, a way for me to die, etc. This would be a simple leveling system and way to relate stats of the character to actions.
Now once I get that far I need the NPCs to be able to act as well. For that some simple AI will be in order.
Finally, the most difficult part. How do I get the NPCs to be able to store information that given to them either through text, action, state, etc and use that information as "experience"? This is something I have thought about over and over and still have not come up with a really good approach. I thought the way Fable did it was very interesting, but may not work in an environment where you can play every character. It seemed to be very similar in the end to a simple disposition system as used in Morrowind. It may not have been, but that seemed to be how it operated.
Okay, next steps then:
1. Develop character stats tables in the database.
2. Develop basic character actions that can be performed.
3. Develop some simple AI for the NPCs when not possessed by the player.
4. Develop a learning system for the AI that allows the NPCs to act on experience and information. To start I will be exploring a "needs" based system for the AI. The AI needs something so will act to get it. So the trick will be to create needs and ways to satisfy those needs by AI action. So experience could allow the AI to know where to find something. The information would allow the AI to know where to start looking. I would like the AI to be able to go on missions created by other AI to fill needs for both AI entities.
Yes, pie in the sky, but now that I am finally getting off my duff and back on my duff in front of the computer I have a simple framework in which to accomplish this. Most likely the first iteration will be very simple mission based stuff like Morrowind, but I intend to make the AI a little bit smarter than that.
One thing Morrowind does not have is a decent scripting environment. I started modding it for some simple stuff and quickly was disgusted by how limited the scripting engine was. Very difficult to go from a full featured language to something pre-basic. I love Morrowind, but modding it is definitely not as fun as it could be. I know there are external scripting addons, but with all the mods I have in my copy I would not want to add another reason for it crash. Besides right now I am having fun playing a mod that allows every object in the game to be created by using crafting skills. It is very interesting. I am learning to furnish my own house with objects in the game. Yes, I am playing "house" again, but it is very fun! I also intend to build my own workshop to build anything in the game. I definitely will be incorporating this kind of play in my game and then some.
It is very interesting what attaching a database does for productivity. Now that I have it up and running and the ease of storing data for anything it tends to help you organize things. You are now focusing on the data rather than any mechanisms for storing data. You no longer worry about where things are at. You know all the data is in a database file. For new sets of data I just create a new table and create a routine to put data in and out. Very simple and effective. Perhaps a simple database like sqlite should be standard in the engine. The license is right and a module could be written to make all calls generic. Then you could back end other databases without changing front end code.
Off I go into the wild to try some more "stuff". Thanks for listening and hope everyone is having a good holiday!!!
12/29/2007 (7:43 am)
Thanks Don.Well I got number 2 working. It is really simple. I press the space bar and it sends a server command that says this client wants to possess whatever gets hit by a containerRayCast. If the raycast hits an object (Player in this case) then it will set the object as the control object (setControlObject) for the client. So in effect I can become any player object in the sim and unbecome any object by just hitting the space bar again. It is like mounting a vehicle except you are taking them over. Very simple and all script.
I am doing all of this in the tutorial.base because starter.fps has so much stuff in it. I just go look at the other games and pick and choose to see how I am supposed to do something. So far it has been very fun and challenging. For instance when I put in the GuiShapeNameHud in the playGUI gui I suddenly had a mouse that allowed selection, but could not control the camera or players direction with it. I went and looked at both starter.racing and starter.fps and found a very tricky thing. For some reason the playGUI.gui that comes with tutorial.base has canSaveDynamicFields set to false. So when you save it the first time it wipes out a variable called noCursor. If noCursor is set to false or does not exist then the mouse appears and keeps focus of it as a mouse. If it is set to true then the pointer goes away and you can use the mouse to control your object again. Just a little snafu, but it can drive you batty.
So to move forward I need to come up with some more milestones to get this prototype functional.
I want some simple attributes for the players so I need to add tables for attributes, stats, equipment, etc. These would be separate tables so that you can add to the list of stats, attributes, skills, etc. This is something that was bothering me before was how to make the database generic for multiple types of games that may not all want strength, agility, speed, etc.
I need some way to act on these abilities so I need some basic actions for the player to perform with the characters. I need a way for the stats to change, a way for me to die, etc. This would be a simple leveling system and way to relate stats of the character to actions.
Now once I get that far I need the NPCs to be able to act as well. For that some simple AI will be in order.
Finally, the most difficult part. How do I get the NPCs to be able to store information that given to them either through text, action, state, etc and use that information as "experience"? This is something I have thought about over and over and still have not come up with a really good approach. I thought the way Fable did it was very interesting, but may not work in an environment where you can play every character. It seemed to be very similar in the end to a simple disposition system as used in Morrowind. It may not have been, but that seemed to be how it operated.
Okay, next steps then:
1. Develop character stats tables in the database.
2. Develop basic character actions that can be performed.
3. Develop some simple AI for the NPCs when not possessed by the player.
4. Develop a learning system for the AI that allows the NPCs to act on experience and information. To start I will be exploring a "needs" based system for the AI. The AI needs something so will act to get it. So the trick will be to create needs and ways to satisfy those needs by AI action. So experience could allow the AI to know where to find something. The information would allow the AI to know where to start looking. I would like the AI to be able to go on missions created by other AI to fill needs for both AI entities.
Yes, pie in the sky, but now that I am finally getting off my duff and back on my duff in front of the computer I have a simple framework in which to accomplish this. Most likely the first iteration will be very simple mission based stuff like Morrowind, but I intend to make the AI a little bit smarter than that.
One thing Morrowind does not have is a decent scripting environment. I started modding it for some simple stuff and quickly was disgusted by how limited the scripting engine was. Very difficult to go from a full featured language to something pre-basic. I love Morrowind, but modding it is definitely not as fun as it could be. I know there are external scripting addons, but with all the mods I have in my copy I would not want to add another reason for it crash. Besides right now I am having fun playing a mod that allows every object in the game to be created by using crafting skills. It is very interesting. I am learning to furnish my own house with objects in the game. Yes, I am playing "house" again, but it is very fun! I also intend to build my own workshop to build anything in the game. I definitely will be incorporating this kind of play in my game and then some.
It is very interesting what attaching a database does for productivity. Now that I have it up and running and the ease of storing data for anything it tends to help you organize things. You are now focusing on the data rather than any mechanisms for storing data. You no longer worry about where things are at. You know all the data is in a database file. For new sets of data I just create a new table and create a routine to put data in and out. Very simple and effective. Perhaps a simple database like sqlite should be standard in the engine. The license is right and a module could be written to make all calls generic. Then you could back end other databases without changing front end code.
Off I go into the wild to try some more "stuff". Thanks for listening and hope everyone is having a good holiday!!!
#7
02/13/2008 (3:58 pm)
So Frank, how's this going? I finally got some time to think about it again and remembered your blog so thought I'd check in! Hope it's going along as nicely as it was when you wrote this.
Torque Owner Frank Carney
I can load objects from the database. Right now I have Fred, Joe, Nancy and Phil being created from a database entry upon mission start. They don't do anything yet. They just stand there like proper blue block people and bounce up and down according to the their "just stand there" animation.
I have sort of achieved milestone 3:
I can save the mission script back to the database. This allows me to make changes to the mission in the editor and run SaveMission to save it back to the database. Still need to save individual object states back to the mission object table. Should be the same as saving the mission back to the database. I made a SimGroup during load that contains all savable objects. I will just cycle through that to save the state of the objects.
Now I need to tackle milestone 2.