Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    32
  • comments
    30
  • views
    11024

Entries in this blog

 

Framework update

I worked on the framework yesterday. I added more to the event and windowing frameworks to pass button presses to windows. If the cursor is visible it passes the button presses to any window and any children components that fall under it.

I gave the button an on click event handler and made it create a new window with a label in it above the original window. It all seems to be working pretty well.

Next I think I need to create some more components to allow me to build the game window from.

Edit: Part of the problem that I'm hitting is that Lua doesn't really have a concept of classes and so has no concept of "constructors". A lot of the things that I am doing would be a ton easier if I could write constructors. I am also having to fake out "virtual" functions to make some of the event handling for windows work properly.

Lacutis

Lacutis

 

It's been way too long.

I really don't write in this enough. Work keeps me busy and by the time I get home I don't feel like doing much development after doing it all day.

My PSP sparked my interest again recently, so I was looking around on the internet for information on homebrew stuff I came across this:

PGELua PSP Game engine

So I downloaded it to play around and decided I would try writing a simple Turn-Based Strategy game. I decided the first thing I needed to do was to write some kind of GUI framework so that I could handle things easier.

I started out writing a window handler to handle the drawing of the windows, then I added a Window class that could draw itself. I then inherited that into a button class and added some extra functionality to that.

After I was done I ended up with this:


Using the framework I was able to do that with this:

assert(loadfile("Window.lua"))()

if not WindowManager then
error("Failed to load window classes.")
end

local winman = WindowManager:new()

local mainwin = Window:new
{
name = "Test",
xpos = 200,
ypos = 100,
height = 75,
visible = true,
}

local myButton = Button:new
{
name = "TestButton",
xpos = 25,
ypos = 20,
width = 40,
height = 20,
text = "Push Me",
visible = true
}

if not mainwin:addChild(myButton) then
error("Adding Button Failed.")
end

if winman:addWindow(mainwin) then
wintext = true
else
error("Failed to add window to manager.")
end

while pge.running() do
pge.controls.update()
pge.gfx.startdrawing()
pge.gfx.clearscreen()

winman:Draw() -- Where most of the magic happens

verdana9:activate()
if wintext then
verdana9:print(200, 200, white, "There Should be a window.")
end

pge.gfx.enddrawing()
pge.gfx.swapbuffers()
end




That was a couple days ago. When I got home from work tonight I decided to add in an a cursor that I could move with the analog stick. In order to do that I decided I needed an event handler to accept event messages and dispatch them to listeners. I added a control class to scan the buttons and create events when their status changes.

So that left me with this when I was done:






I cleaned up some of the code, put the entire library in a table to get it all out of the global namespace and ended up with this:

assert(loadfile("guilib.lua"))()

if not gui.WindowManager then
error("Failed to load window classes.")
end

local ehandler = gui.EventHandler:new()
local controls = gui.ControlHandler:new
{
handler = ehandler
}
local cursor = gui.Cursor:new
{
handler = ehandler,
visible = true
}
ehandler:Register(cursor, cursor.Handler, "Stick")

local winman = gui.WindowManager:new
{
handler = ehandler
}

local mainwin = gui.Window:new
{
name = "Test",
xpos = 200,
ypos = 100,
height = 75,
visible = true,
}

local myButton = gui.Button:new
{
name = "TestButton",
xpos = 25,
ypos = 20,
width = 40,
height = 20,
text = "Push Me",
visible = true
}

if winman:addWindow(mainwin) then
wintext = true
else
error("Failed to add window to manager.")
end

local basedir = pge.dir.getcwd()

while pge.running() do

controls:Update()
pge.gfx.startdrawing()
pge.gfx.clearscreen()

winman:Draw()
cursor:Draw()

verdana9:activate()

if wintext then
verdana9:print(200, 200, white, "There Should be a window.")
end

pge.gfx.enddrawing()
pge.gfx.swapbuffers()
end




Then I decided to take the screenshots you see above so I added this real quick:

ss = { num = 1 }
function ss:TakeOne(event)
if event.value["cross"] then
pge.gfx.screenshot("screenshot"..self.num..".png")
self.num = self.num + 1
end
end
ehandler:Register(ss, ss.TakeOne, "Press")




And I had a screenshot button.

Of course I'm glossing over all the debugging and so forth it took to get the library classes working correctly. The second part though I started at about 7 pm tonight and its just after 1 am now, so not bad for 4 hours I think.

Next I'm just going to work on adding different controls that you would expect to have. Check boxes, etc.

Now it's time for bed.

Lacutis

Lacutis

 

I'm horrible at this

By this I mean blogging.

As you can see by my archive on the right I've been a GDNet+ Member for quite a while, but I don't keep my journal up to date very well.

I really haven't done a ton on the game development front in the last year, I decided early in the year that the TorqueX stuff was still too new to be productive and I was busy like always with work. World of Warcraft always sucks up too much time, etc.

I noticed a week or so ago that the DreamBuildPlay contest was starting up again. The warmup started December 20th so I was already behind. On the plus side I already had a concept that I was kicking around that kind of meshed right with what they were asking for.

I redownloaded all of the XNA stuff, and decided to give TorqueX another try since I have licenses for everything GG makes except for TGEA. TX has come a long way, it's really nice to work with.

Over the last 4 nights I've already got my tileset for my ground, an animated character that moves, and a camera that follows him. I think my game idea will be novel to play if I get the ai working the way I want in the game. We will see how far I get this weekend.

My big stumbling block is going to be artwork, like it always is. I've found some free textures and sprites that I'm using but it would be nice to have something more custom.

Lacutis

Lacutis

 

Progress...

It doesn't look like much, but it's actually representative of a lot of work.

I have a mostly working skybox, an object handler class, a model class with working shaders, a base camera object that I still need to work on so that I can manipulate it easier.

I still have a lot to work on, but it feels good to make progress and to work on something.

I think I'm going to hit the sack and work on it some more in the morning.

Lacutis

Lacutis

 

Progress...

It doesn't look like much, but it's actually representative of a lot of work.

I have a mostly working skybox, an object handler class, a model class with working shaders, a base camera object that I still need to work on so that I can manipulate it easier.

I still have a lot to work on, but it feels good to make progress and to work on something.

I think I'm going to hit the sack and work on it some more in the morning.

Lacutis

Lacutis

 

XNA and other Stuff

From around the 20th of this month till around the 3rd is the busiest time for me at work. It's end of year, I have to do upgrades on the HR and Payroll systems for the new years tax tables, there is the year end saves and all kinds of other fun stuff. This year is compacted with the merger which just adds bonus work like data pulls for the new corp, etc.

I'm still finding some time to work on game dev related stuff though.. Back at the end of July I bought a new laptop so I could work on stuff when I was away from the house, it's pretty nice, has a GeForce 7300 Go in it, 2.4 ghz dual core.

So I've been playing with the XNA dev kit since a day or so after it was released and I have to say it's really nice. Microsoft did an excellent job with it. I ended up going and picking up a wired XBox controller because all mine are wireless and I wanted to be able to test with the actual controller. I haven't really messed around that much with C#, but I have been programming in C++ for over 15 years so it's not that far of a stretch.

I started in working on an engine for a game idea I have. I think its going to work pretty well but I want to get the engine fleshed out some before I really lay out the game. Right now between what I've gleamed from several tutorials plus ideas from other engines I've put together I've gotten some groundwork laid. A basic object framework that is working, a scenegraph, and I started on basic cameras before it got too late last night. I'll start on that again tonight after work.

Lacutis

Lacutis

 

Where the hell have I been?

Well, looking at my last entry, it was in July of last year. You see back in 2003 I moved back to Arizona from Texas and quit my job to be close to my Grandfather. He had Alzheimers and I didn't want my one major regret in life to be that I didn't spend the time that I could have with him before it was too late for either of us. So I moved back. He had a steady decline, but I don't regret a second of the time I spent back here.

In August he went downhill fast and he finally passed on the 15th, which is the day after my birthday.

I pretty much quit working on everything after that except for my job out of necessity. Then things at work changed in January/February and my workload increased which ended up with my company going through a merger (which finishes in the next couple weeks) and me taking a promotion this last September.

The last month or so I've started tinkering around with things again, more specifically the XNA toolkit which I will probably talk more about later.

Anyway, there is all the information you never wanted to know.

Hopefully I will get some more use out of this journal which I have been paying for for the last 2+ years and get some more motivation out of it.

Lacutis

Lacutis

 

Update? Wow!

Ok, so after I spent a day or so going over the communication protocol I started feeling like I didn't care anymore. That is a sure sign that you are starting to burn out.

I looked at the calendar and realized I have been spending every waking moment outside of work and household chores working on the game. That isn't bad, but I decided I deserved a break after three weeks.

So I took yesterday off, tonight I ended up cleaning and moving out boxes because the appraiser is coming tommorow to appraise the property so I can get my loan completed. I decided that after I get the mortgage and pay off my truck, I'm going to use some of the money to enroll in college again. We will see how that goes.

Anyway, I figured I would update. After the appraiser tommorow I most likely will veg out the rest of the evening. I don't know what I'm going to do this weekend, as I planned to go to vegas, but I think I have no money. Ill find out tommorow or friday.

Night!

Lacutis

Lacutis

 

That place.

I'm at that place in my project where you go back over the code you have written and what needs to be written and determine if it will work the way you planned on.

I've written out some stuff on how I need to keep track of what entities to send to clients, what messages need to be replicated to other clients and how to handle client messages in an abstracted way.

I think I'll be sorted out in another day or so, I just don't want to have to rewrite code later because I didn't design it write to begin with.

Night!

Lacutis

Lacutis

 

Mission Accomplished.

Ok, so without further ado, I present, Ship in space:



I now can load torque2d, key in my user/pass, select my character, and hit Enter Game, upon which the server happily tells me to spawn a player ship in the middle of the screen. T2d happily complies.

I only spent about 3-4 hours today working on this, I spent some time goofing off. Tommorow I want to work on the movement stuff but I need to rethink the way I want to do command passing. I started to implement it, and I realized it wasn't going to work the way I wanted it to. Thats ok though, I just need to flesh it out a little more.

For now, its bed time.

Lacutis

Lacutis

 

Hrmm.

I decided to get part of my usual sunday crap done tonight instead, so that I can spend all day sunday working on the game. So I went out buying groceries, etc.

I coded in handling for the new messages on the T2d c++ side. I also coded in part of the player creation bit on the torque script side. The scrolling star background looks pretty slick, although I need to recapture the textures and touch them up a little. It still looks pretty good in motion.

Tommorow I'll make the server send the player create message to the client, and have the client spawn the sprite. Then I'll need to code some of the key commands on the script side so I can accellerate/decelerate and turn left and right. Once I get that working, Ill have the client send the commands back to the server, and have the server return the updatepos message to the client. Once I get that, Ill have moving players.

Lacutis

Lacutis

 

Woohoo.

Ok, so I got the scrolling star background working.

The star background is pretty neat. I took one of the 1600x1200 images from the NASA website sattelite images and cut it up into a few tiles and told Torque2d to wrap it. I'm still playing with the image sizes but it looks pretty good. I'll post some screenshots tonight of my player ship sitting in space all alone. Hopefully moving around as well.

I'm at work, but I am vnc'd in and writing the entity code now.

Lacutis

Lacutis

 

...

Ok, well I spent most of tonight attempting to cut up large images into tiles so that I can use them as the background for my game. I finally ended up doing it by hand and created the tiles I needed.

So now Ive got the game loading, going through the login process and displaying the game screen with the background. I'm having a few issues scrolling it, so I've been reading threads on the torque boards. The documentation is almost nonexistant, which is kind of frustrating. Once I get the background to scroll, I'll enable to code that will allow the server to spawn entities on the client.

Anyone else ever hit road blocks using someone elses library/engine that you think should work one way and just doesnt?

Either way, I'm still way further ahead than if I had to write a client from scratch.

In other news, I got my partner who does the website design for the web hosting business I run on the side to make me some 2d graphics for the menus and whatnot in the game, so my horrible programmer art is living on borrowed time :)

Lacutis

Lacutis

 

Update

Ok, so tonight I worked on the communication protocol between the server and Torque2d.

So far I have made the following message types:

enum EComType
{
COM_NONE = 0,
COM_HELLO,
COM_DISPLAY,
COM_LOGIN,
COM_LOGOUT,
COM_BANNED,
COM_MENU,
COM_CHARLIST,
COM_CREATECHAR,
COM_CHOOSECHAR,
COM_ENTERGAME,
COM_CREATEENT,
COM_UPDATEPOS,
COM_REQUPDATE,
COM_REMENTITY
};



They all pass from the server to the client properly, and I have created the stub functions in the engine to parse them and pass them to a callback in the scripting engine of T2d.

So far, so good. Tommorow I will start implementing the new functions in script. I spent a good hour or so reading through threads on the garagegames message boards to figure out the best way to handle the entities so I can reference them, loop on them, and create them properly without losing track of them.

Fun, fun!

Lacutis

Lacutis

 

Fun in RL.

I didn't get a ton done tonight. I'm in the process of buying a house, so as soon as I got off work, I had to hurry over to the loan office and sign a ton of papers, then they got to tell me all the papers I forgot to bring and would have to bring them next time. Fun.

So after that I had to go get some groceries so I would have stuff to eat for breakfast till friday when I get paid.

After all that I was able to get into Torque2d and add the buttons to enter the game, and created the gui screen that will end up being the in game screen.

Next I need to come up with a series of messages to allow the server to push entity data down to the client, and some messages to allow the client to send action messages to the server (accelerate, decelerate, fire at X, etc).

I'm still fairly happy with the progress I'm making since I started this project in the beginning of this month.

Looking at what I have gotten done, and what I need to do before the game will be really playable, I'm realistically looking at another month and a half to two months of development. Somewhere in that time I also need to find a 2d sprite artist, or I might blind someone with my horrible programmer art.

Anyway, time for bed.

Lacutis

Lacutis

 

Ugh.

Ok, I only spent an hour working on it tonight. However I did find the wierd bug I was talking about before and it had to do with the way that I handle the input buffer from the socket.

I have two buffers, one is the "input" buffer, and I use it to do a recv from the socket. The second buffer is used in a for loop. I loop from 0 to the length of the recv buffer and add characters one at a time to the processing buffer. When I get 4 bytes I check what ComType the message is. I then keep looping until the processing buffer has the same amount of bytes as whatever com object the message is. I then cast the buffer to the proper type and pass it to the scripting engine to handle.

The bug was I was checking the recv buffer for the comtype and not the processing buffer, so when I got multiple messages in one recv, it was treating all of them as the first message type. But it's fixed now and works happily.

When I left last night I ended up being out till after 1 am, I fell asleep around 2 am. I got up at 6:30 am for work, so I'm beat.

I haven't watched tv in a week and a half so I am going to go fire up the tivo and watch the new episode of stargate and atlantis I missed on friday. Then I'm going to sleep.

Lacutis

Lacutis

 

Bleh.

Ok, so I didn't get to exactly where I wanted to. I'm having some issues with Torque2d and I needed to step away in order to get a fresh look at what I was doing. So I went to do laundry (wee, fun).

But what I did accomplish this weekend:

I got the server to do non-blocking character input while running so I could shut it down properly.
I fixed a few bugs in the MySQL wrapper I wrote.
I coded in all the communication code up to actually entering the game, and debugged it.
I created all the menu screens and dialog boxes from the main menu to the "choose your character" screen in Torque2d, which is all filled dynamically by the server.
I can log into the server and create a new character from Torque2d.

I'm having a wierd issue with the parsing of a particular message on the t2d side that I need to figure out before I can get to the actual game screen. I'll debug it tommorow after work and figure out whats wrong.

So even though I didn't reach my goal, I still feel like I accomplised a lot.

Plus I played some Nanodude, which is a really cool game by stro.

Lacutis

Lacutis

 

Hrmm.

I forgot I had volunteered to host a player run magic tournament on mtgo today, so I ended up doing that from noonish till around 10 pm. That killed most of my development time.

I worked on it a little bit after that, but ended up spending three hours chasing down a bizarre bug that I have no idea why it causes the server to crash. Well, its working again now.

I worked on the T2d end some as well, and got part of the networking going back and forth, Ill pick it up again in the morning but I have to do laundry and go shopping at some point so I'm not sure how much I will get done.

Anyway, off to bed!

Lacutis

Lacutis

 

Whew.

So I didn't get quite where I wanted to be, but I got damn close.

I've got all the code in the server completed up to the point of actual gameplay. I've got all the protocol messages up to there finished as well. I've added callbacks for all of those commands to Torque2D and I've created the callbacks on the script side.

Basically all I have left to do is create the "Choose your character" screen, and a "new character" screen, as well as the main game screen, and just code the transitions on the torquescript side. So I have another hour or two worth of work, but it's midnight so I am going to bed.

My goal of having a moving ship in game by the end of the weekend is definately doable.

Lacutis

Lacutis

 

Whew.

Ok, I'm still on schedule.
Tonight I :

Finished coding the Account class.
I coded the AccountDB class that keeps track of them while the server is running.
I coded the Character class. More will need to be added later, but I got the barebones of whats needed to meet my weekend goal.
I coded the CharacterDB class that keeps track of chars while they are logged in.
I made both the Account and Character classes MySQL aware, so they now can load and save themselves to and from the database.
I made both of the database classes capable of loading themselves from MySQL, instantiating the classes they hold as they do it.

Not bad for ~3 hours work.

Tommorow night being friday I need to finish up writing the protocol to allow a client to sign on, create a character and enter the game. Then Saturday I will add commands to the client to allow the character to move around.

It's nice to be able to look at your journal and see the progress you are making. Sometimes when you are just coding you lose sight of what you have done, and it gets discouraging or overwhelming.

Lacutis

Lacutis

 

Hmm

Well, I don't have any nifty pictures to show tonight as most of the work I did is all on the server side in the back end.

I finished coding the game states into the player handler up to the main game handler, which will be completed later.

Then I went and created the Account class, the tables to hold the data in MySQL and the accessor class for it. I then went and added an Account EntityId tracker in my entityid class.

It doesn't sound like a lot, but it was a good ~3 to ~3.5 hours of coding and database stuff.

What I'm planning on is having most of the account and player entity handling coded in by friday, so I can see how far I can get the client over the weekend. I've been reading a bunch of stuff on torque scripting at work during the lulls, and I've learned a lot about it.

I'm hoping by sunday sometime I will be able to connect to my server, log in, select my character (that I created from the client) and fly my little ship around in circles. Thats the milestone I want to hit by sunday.

Lacutis

Lacutis

 

More Progress

Ok so I made some progress, just not as much as I hoped.

I made a login screen (go programmer art):


So then you hit the login button:



So tommorow I'll work on the state machine on the server side to properly handle the connection, then once a player is logged on Ill try to upload his entity and get the game to spawn it.

Lacutis

Lacutis

 

Well, that sucks.

I was planning on putting in the code to pass the login/password data then send the player entity updates to see if I could get the player to spawn on the screen.

I was just about ready to vnc in from work when I got disconnected from my router (ssh). When it came back up I had to wait a few for my dynamic dns to update so I could find it. Once in I tried to vnc to my pc over the ssh tunnel and it just sat there. Thinking for a minute I did an uptime on my router and found it said 26 mins. Stupid power went out at my house.

So I guess I can't work on anything till I get home. Bummer. I was looking forward to messing with the GUI editor in Torque2d to create my login screens.

Edit:

As an extra note I decided how im going to handle the play screen on the client. I'm going to have a star pattern background (obviously) with the player ship in the center of the screen. On the server side I will instead of sending the actual coordinates of entities, I will send the relative coordinates with the player as a base. Then when the player "accelerates" I will change the speed and direction of the background scrolling to match the players velocity.

So what you end up with is a player in the center of the screen with everything moving around him as he plays. That way I don't have to worry about how big a playfield that T2D can handle. It also makes it so if I want I can make the entire game one huge map, since the server only sends players information about entities that are near him.


Lacutis

Lacutis

 

Progress.

Well, I've got the communication working both ways now.

Server:

E:\Development\Dev-Cpp\Projects\gtwserv>gtwserv
Loading EntityId
MySQLWrap::Connecting.
MySQLWrap::Connected.
MySQLWrap::Opening(SELECT * FROM EntityId WHERE Type = 'Player')
MySQLWrap::Open.
MySQLWrap::Field(0) = Type
MySQLWrap::Field(1) = CurrentValue
MySQLWrap::Close()
Call second Initialize()
Setting Connection.
Initializing Connection.
OnEnter()
Buffer : 0 Bytes.
Buffered 4 Bytes.
OnEnter() Finished. Buffered: 4
Buffered Byes: 4
Have 4 Bytes to send.
Sent 4 Bytes. 0 bytes remain.
1 sockets have activity.
Data to recieve!!
Recieved 4 bytes.
Translating 4 bytes.
Buffer currently has 0 bytes.
Need at least 4 bytes.
Not enough data, buffered 1 bytes.
Not enough data, buffered 2 bytes.
Not enough data, buffered 3 bytes.
Got COM_Hello in Handle()
1 sockets have activity.
Data to recieve!!
OnHungup()
OnLeave()
Saving EntityId
MySQLWrap::Connecting.
MySQLWrap::Connected.
MySQLWrap::Opening(UPDATE EntityId Set CurrentValue = 17)
MySQLWrap::Open.

E:\Development\Dev-Cpp\Projects\gtwserv>





Client:

NetObj = 1245
NetObj Var = 42
Recieved ComHello From Server, Sending Response.
Buffered 4 Bytes.
Sent 4 Bytes.





The source for the client (TorqueScript) looks like this now:

in setupT2DScene() :

$TestObj = new NetObj(testobj);
echo("NetObj = " @ $TestObj);
$TestObj.setVariable(42);
echo("NetObj Var = " @ $TestObj.getVariable());
$TestObj.Receive();
------------------------------------------------------
function TestObj::onHello()
{
echo("Recieved ComHello From Server, Sending Response.");
echo("Buffered " @ $TestObj.BufferData("ComHello") @ " Bytes.");
echo("Sent " @ $TestObj.SendBuffer() @ " Bytes.");
}




I can't really test spawning entities from the server yet as I am at work and vnc and graphical games don't really go hand in hand. So Ill continue with that after work.

As an aside, do I have the most boring Journal on gamedev or what? It's interesting to see what does and what doesn't get replies in Journalland.

Edit:
ComDisplay also seems to work without any changes:

OnEnter() Finished. Buffered: 4
Buffered Byes: 4
Have 4 Bytes to send.
Sent 4 Bytes. 0 bytes remain.
1 sockets have activity.
Data to recieve!!
Recieved 136 bytes.
Translating 136 bytes.
Buffer currently has 0 bytes.
Need at least 4 bytes.
Not enough data, buffered 1 bytes.
Not enough data, buffered 2 bytes.
Not enough data, buffered 3 bytes.
Got COM_Hello in Handle()
Not enough data, buffered 1 bytes.
Not enough data, buffered 2 bytes.
Not enough data, buffered 3 bytes.
Got COM_DISPLAY in Handle()
Message : Testing 1 2 3...
1 sockets have activity.
Data to recieve!!
OnHungup()
OnLeave()



From Torque2d:

function TestObj::onHello()
{
echo("Recieved ComHello From Server, Sending Response.");
echo("Buffered " @ $TestObj.BufferData("ComHello") @ " Bytes.");
echo("Sent " @ $TestObj.SendBuffer() @ " Bytes.");
echo("Sending Display Message : \"Testing 1 2 3...\"");
echo("Buffered " @ $TestObj.BufferData("ComDisplay", "Testing 1 2 3...") @ " Bytes.");
echo("Sent " @ $TestObj.SendBuffer() @ " Bytes.");
}



Lacutis

Lacutis

 

Rock On.

Ok, so I got it working.

My server waits for connection, and when a connection is achieved it creates a "CComHello" object, and pushes it to the other side.



So I have the script in Torque2d doing this:

$TestObj = new NetObj(testobj);
echo("NetObj = " @ $TestObj);
$TestObj.setVariable(42);
echo("NetObj Var = " @ $TestObj.getVariable());
$TestObj.Receive();




Which creates a new NetObj, calls some test functions that I havent removed and then calls the Recieve method.

Inside the C++ side of the T2d engine, I have this:


bool NetObj::Receive()
{
// receive the data
int bytes = m_Sock.Receive( m_buffer, 1024 );

// tell the protocol policy object about the received data.
Translate(m_buffer, bytes );

return (bytes > 0);
}

void NetObj::Translate(char *p_buffer, int p_size)
{
for( int i = 0; i {
// if the buffer isn't full, add it to the buffer
char c = p_buffer;
if(m_recbufsize 1024 )
{
m_recbuffer[m_recbufsize] = c;
m_recbufsize++;
}
if(m_recbufsize >= sizeof(CCommand)/sizeof(char))
{
switch(((CCommand*)m_buffer)->Type)
{
case COM_NONE:
if(m_recbufsize == sizeof(CCommand)/sizeof(char))
{
// printf("Got COM_NONE");
m_recbufsize = 0;
}
break;
case COM_HELLO:
if(m_recbufsize == sizeof(CComHello)/sizeof(char))
{
// Handle((CCommand*)m_buffer);
Con::executef(this, 2, "onHello", "Connected!");
m_recbufsize = 0;
}
case COM_DISPLAY:
if(m_recbufsize == sizeof(CComDisplay)/sizeof(char))
{
// Handle((CCommand*)m_buffer);
Con::executef(this, 2, "onDisplay", ((CComDisplay*)m_recbuffer)->m_Msg);
m_recbufsize = 0;
}
break;
}
}
}
}




Finally, back in torquescript land I defined this callback:

function TestObj::onHello()
{
echo("Connected()!");
}




The net result being:



So wow, some of the parts were harder than I expected, and others were easier, so I guess it evened out in the end.

Now I have a basis I can use to add more entity types, and spawn them from the server. The next step is to read through the torquescript documentation and figure out how to search for spawned entities inside the simulation. That will be needed for allowing the server to control their lcations, etc.

Unfortunately it's sunday, and that means laundry and shopping, which I will need to get started on in an hour or so.

Lacutis

Lacutis

Sign in to follow this  
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!