May 23, 2012, 02:24:48 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Please report any bugs or issues that you might be encountering with the Beta in the Support System so that we can better keep track of any oustanding issues that may come up.

GameCore Support System
 
   Home   Help Search Login Register  
Pages: 1 2 [3]
  Print  
Author Topic: Building a "Builder"...  (Read 3191 times)
Steely Dane
Sr. Member
****
Posts: 287


View Profile
« Reply #30 on: August 26, 2009, 06:08:51 PM »

No, but it does sound very similiar.
I'm huge fan of games like Sim City 4. I like building type games, which are few if any....
I'd really like to give out more details of what I have in mind for my project, but it is such a unique idea, I don't want to give it away, lol...
Logged
gekido
Guest
« Reply #31 on: August 28, 2009, 11:50:25 AM »

I've been experimenting with different ways to build character creation systems in gamecore (which are in many ways similar), and after much experimentation have definitely decided that simply doing the 'show / hide' mesh idea is a bad idea for the most part, simply because whether 90% of the mesh is hidden or not, it still has to be loaded and processed.

By breaking it down into individual components, you don't need to have all of these unnecessary pieces loaded.  It does make the 'building' interface a bit more difficult, but will be much more scalable / flexible in the long run.
Logged
Steely Dane
Sr. Member
****
Posts: 287


View Profile
« Reply #32 on: August 28, 2009, 03:29:21 PM »

That was my theory. That way, even though I need mine to be set up in a game specific way, it would still be relatively easy to convert the system to what ever the user wants to use it for. It's almost as if the thing will be a game itself within the game. Kind of like a highly modified version of the chess game as the first level/option screen for the player, with the resulting object and all of it's accessories becoming the "player" that then enters the real game to carry out whatever the objective/mission/purpose of the game is.

That's my theoretical approach to the problem anyway, and the avenue of solution I'm pursuing.
I wish I could throw up some early examples of what I'm doing, but there aren't any yet, since I'm brain deep in learning C++ right now with the hopes I can gain a better understanding of scripting in general.
It's a tough slog because I find it utterly tedious, lol.
Getting a print out on the screen of Hello World, or a string of numbers isn't nearly as satisfying as making, well anything, in my 3D program, I'm afraid.
How you coder types had the patience to pursue it in the first place is a true wonder to me......
Logged
Ron
Sr. Member
****
Posts: 326


View Profile
« Reply #33 on: September 26, 2009, 03:07:11 AM »

Baby steps.... using the chess game example and the options file, I very roughly got a builder to work. Still a long ways to go, right now object x and z position is controlled by the mouse, but y and rotation I put on gui tuggers.

http://www.youtube.com/watch?v=1_LF-Js11vE

Its slick how the option file works. I have the script going through all the world objects and saving the position and rotation vectors.

Its pretty amazing the power you get for the little amount of script code needed. Use the Chess example for how to move objects around and then...

Save:
Code:
int index = thisForm.GetControl( "TrackText").GetTextPlain().GetLength();
if (index > 0)
{
thisForm.Hide();

String trackFile = "[savegame]/" + thisForm.GetControl( "TrackText").GetTextPlain() + ".track";
OptionsFile track("Track");
track.New( trackFile);

GameManager@ game = GetGameManager();

int i, j;

j = game.GetWorld().GetObjectCount();

for (i = 0; i < j; i++)
{
Object@ TrackObject = game.GetWorld().GetObject( i);

String ItemName = TrackObject.GetName();
Vector ItemPosition = TrackObject.GetPosition();
Vector ItemRotation = TrackObject.GetRotation();

if(ItemName != "Focus" && ItemName != "Player" && ItemName != "squarehighlight" && ItemName != "Tracker")
{
track.AddVariable( ItemName,ItemPosition);
track.AddVariable( ItemName + "R",ItemRotation);
track.Save();
GetControl("FPS").GetControl("FileName").SetTextPlain( "File Name: " + thisForm.GetControl( "TrackText").GetTextPlain());
}
}

}

And Load: (for each object)
Code:
OptionsFile track("Track");
Vector ItemPosition, ItemRotation;
track.Load( trackFile);

GetGameManager().SetTextAlignment( "Center", "Subtitle");

int ItemCount = 0;
int ItemCountTotal = 0;

ItemCount = track.GetVariableCount("starting_line_1");

for (int i = 0; i < ItemCount; i++)
{
ItemCountTotal++;
GetGameManager().ShowTextPlain( "Loading Object: " + ItemCountTotal, 2);
ItemPosition = track.GetVariableVector( "starting_line_1", ItemPosition, i);
ItemRotation = track.GetVariableVector( "starting_line_1R", ItemRotation, i);
Object@ starting_line_1 = GetGameManager().GetWorld().AddObject( "starting_line_1", "../Objects/TrackBuilder/starting_line_1.opr");
starting_line_1.SetPosition(ItemPosition);
starting_line_1.SetRotation(ItemRotation);
starting_line_1.UpdateCollisionObjectPositions();
}

Logged
Steely Dane
Sr. Member
****
Posts: 287


View Profile
« Reply #34 on: September 26, 2009, 04:40:27 AM »

Jesus Ron, you're like some sort of savant... or something.... I've just been checking in here off an on since i'm  doing the vibe course and building models for my own project, but cool you are werkin' on this idea... Have you perused gekidos modular weapons?...that is what i really had in mind only more detailed ...i'm doing what I can as well...but  I think that it's something that would benefit everyone as you obviously do as well...keep pushin', limits are for cowards....
« Last Edit: September 26, 2009, 04:43:00 AM by Steely Dane » Logged
zknack
Full Member
***
Posts: 207


View Profile
« Reply #35 on: September 30, 2009, 04:06:15 PM »

Ron,

You are amazing :-)

I will be looking into this this weekend, but it looks great!

I wish I'd saved the working rts example with buildings & resources from the old Beyond Virtual
forum- with that Gekido's more or less complete modular weapons tutorial, and this, I think I'd
be golden more or less (well, if I can get a visual inventory system & grappling hook working I would
but that's another story ;-) )

Thank you, for the examples thus far- I love that you're assisting those of us who are very much
so not-programmers :-)

I hope we don't lose you anytime too soon.
Logged
Ron
Sr. Member
****
Posts: 326


View Profile
« Reply #36 on: October 18, 2009, 04:59:25 PM »

Got a little further, players can upload and download tracks online with php/mysql. First make a new table in mysql. With whatever hosting company you use, they probably have a utility to help. Then added this section to the masterserver function_user.php file

Code:
if (substr($password,0,8) == "_Custom_")
{
// insert data into table

$query = str_replace("\r", "'", $email);
$result = mysql_query($query);
$result_string =  str_replace("\r", "'", $email);

return;
}

Its basically just passing custom data in place of where the players email and password go. I could not get it to pass the quote ' character, so I use a \r instead and then convert that to ' in the php. Its not 'secure' yet either, if someone wanted to, they could hack another players tracks.

In the GC gui script for uploading

Code:
if (GetControl("CheckOnlineTracks").GetChecked())
{
String TrackData = ItemName + "~" + ItemPosition.x + "~" + ItemPosition.y + "~" + ItemPosition.z + "~" + ItemRotation.x + "~" + ItemRotation.y + "~" + ItemRotation.z + "~~";
String SQLSend = "INSERT INTO race_tracks_data (track_id, TrackData) VALUES (" + trackindex + " , \r" + TrackData + "\r)";
OnlineAccountRegister( GetSaveGameVariableString("UserName"), "_Custom_", SQLSend);

String result3;
while (result3.IsEmpty())
{
Delay( 0.1);
result3 = OnlineAccountGetRegisterResponse();
}
k++;
thisForm.GetControl("TrackFileDialog").SetTextPlain( "Uploading Item: " + k);

}

And finally for the GC gui downloading

Code:
String SQLSend = "SELECT * FROM race_tracks WHERE file_name=\r" + thisForm.GetControl( "TrackList").GetListItemText( index) + "\r LIMIT 1";
OnlineAccountRegister( GetSaveGameVariableString("UserName"), "_Get_Tracks_", SQLSend);

String resultindex;
while (resultindex.IsEmpty())
{
Delay( 0.1);
resultindex = OnlineAccountGetRegisterResponse();
}

int i, j, k, l, m;
String trackindex, trackname;

for (i = 0; i < resultindex.GetLength(); i++)
{
for (j = i + 1; j < resultindex.GetLength(); j++)
{
if (resultindex[j] == 45)
{
trackindex = resultindex.SubString( i, j - i);
i = j + 1;
break;
}
}
}

trackname = thisForm.GetControl( "TrackList").GetListItemText( index);

for (i = 0; i < trackname.GetLength(); i++)
{
if (trackname[i] == 93)
{
trackname = trackname.SubString( i + 2, trackname.GetLength());
break;
}
}

trackname = trackname + " - Downloaded";
String trackFile = "[savegame]/" + trackname + ".track";
OptionsFile track("Track");
track.New( trackFile);

String ItemName;
Vector ItemPosition;
Vector ItemRotation;

SQLSend = "SELECT * FROM race_tracks_data WHERE track_id=\r" + trackindex + "\r";
OnlineAccountRegister( GetSaveGameVariableString("UserName"), "_Get_Track_Data", SQLSend);

String datafeed;
while (datafeed.IsEmpty())
{
Delay( 0.1);
datafeed = OnlineAccountGetRegisterResponse();
}

String dataline;

for (i = 0; i < datafeed.GetLength(); i++)
{
for (j = i + 1; j < datafeed.GetLength(); j++)
{
if (datafeed[j] == 124)
{
dataline = datafeed.SubString( i - 1, j - i);
//print(dataline);
m = 1;
String datapoint;

for (k = 0; k < dataline.GetLength(); k++)
{
for (l = k + 1; l < dataline.GetLength(); l++)
{
if (dataline[l] == 126)
{
datapoint = dataline.SubString( k - 1, l - k);
k = l + 1;
if (m==1)
{
ItemName = datapoint;
m++;
}
else if (m==2)
{
ItemPosition.x = datapoint.ToFloat();
m++;
}
else if (m==3)
{
ItemPosition.y = datapoint.ToFloat();
m++;
}
else if (m==4)
{
ItemPosition.z = datapoint.ToFloat();
m++;
}
else if (m==5)
{
ItemRotation.x = datapoint.ToFloat();
m++;
}
else if (m==6)
{
ItemRotation.y = datapoint.ToFloat();
m++;
}
else if (m==7)
{
ItemRotation.z = datapoint.ToFloat();
m++;
}
//print(datapoint);
break;
}
}
}
track.AddVariable( ItemName,ItemPosition);
track.AddVariable( ItemName + "R",ItemRotation);
track.Save();
i = j + 1;
break;
}
}
}

thisForm.Hide();
LoadGame("../worlds/DragTrack.wld", "../scripts/builder.gsl");
LoadTrack( "[savegame]/" + trackname + ".track");
GetControl("FPS").GetControl("FileName").SetTextPlain( "File Name: " + thisForm.GetControl( "TrackList").GetListItemText( index));
« Last Edit: October 18, 2009, 05:02:26 PM by Ron » Logged
pixel_legolas
Hero Member
*****
Posts: 786


View Profile
« Reply #37 on: October 19, 2009, 01:28:00 PM »

where the h*ll (insert e) do you come up with this stuff? Is it even documented Smiley
Logged
Ron
Sr. Member
****
Posts: 326


View Profile
« Reply #38 on: October 19, 2009, 02:01:36 PM »

where the h*ll (insert e) do you come up with this stuff? Is it even documented Smiley

The looping idea came from a very old example we had of a socket chat script before we had the luxury of the hostgame / joingame. The php/mysql is a extension of the master server with alot of reading on php.net. Then finally a bunch of trial and error until it worked  Tongue  Smiley
Logged
gekido
Guest
« Reply #39 on: October 23, 2009, 01:07:11 AM »

wow ron that's awesome!

we've done similar types of things, but nowhere near as 'complete' as this!  very, very cool.
Logged
Ron
Sr. Member
****
Posts: 326


View Profile
« Reply #40 on: October 23, 2009, 01:48:56 AM »

should have it finished, at least this 'phase', this weekend. I am ready to work on something different.

the main benefit I am looking for in addition to adding to the game is for players to be able to create their own worlds. I would never have time like big game companies to make 30+ different tracks. I am hoping players will take this and make them for others to share so I can keep programming and not get bogged down in world building.
Logged
Steely Dane
Sr. Member
****
Posts: 287


View Profile
« Reply #41 on: November 07, 2009, 10:26:06 AM »

That was my vision for the builder idea as well...the game is a mod of itself.
You get the basics with your purchase, but it's up to you as a player to add to it and keep it interesting....community based game building with the original creator steering the development by introducing new patches, tools and options.
Logged
Pages: 1 2 [3]
  Print  
 
Jump to:  

 
Powered by MySQL Powered by PHP bluBlur Skin © 2006, hbSkins
Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC
Valid XHTML 1.0! Valid CSS!