Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Multiplayer Spacefighter WIP

Author
Message
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 24th Jan 2012 16:27
May I draw your attention to my WIP guys.

http://forum.thegamecreators.com/?m=forum_view&t=193667&b=8

I had it as a WIP last year, for my coding stint during the winter, but then left it for the summer.

Back on it again this winter and have refactored and eliminated all memory leaks.

Server seems rock solid now but it needs a thorough testing.

This version is all about perfecting the flight model and networking. Please give feedback.

It's not my fault!
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 25th Jan 2012 10:16
How to handle the bullets?

At the moment I'm instancing one object for each individual bullet fired. That's two bullet objects per click of the mouse button. The way the firing works, there can be upwards of a thousand bullets in the air quite quickly. Needless to say, frame rate suffers, and the problem is compounded with more players firing.

Any suggestions guys?

It's not my fault!
vitinho444
9
Years of Service
User Offline
Joined: 12th Oct 2010
Location:
Posted: 25th Jan 2012 13:25
Hey McLaine, sorry for no help you with your question but i just want to say it looks pretty good

C++ Medium 3.5/5
www.oryzhon.com <-- My company's website (W.I.P)
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 25th Jan 2012 13:28
Cheers Vitinho.

The model is from the net, free, so I'll hold my hands up to that one. I'm rubbish at modeling.

It's not my fault!
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 25th Jan 2012 17:24
Make sure you are instancing the bullets and not cloning them. Also, if you need to make a butt-load of bullets, you may want to use a linked-list.

The fastest code is the code never written.
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 25th Jan 2012 18:02
Hi Hawkblood.

Yeah, switched to instanceObject last night and saw improvement, but instances lose scaling. Not properly investigated it yet.

I am storing the bullets in a list already. The bottleneck is just having to create so many bullets and then move them around, it can be trying to create hundreds of bullets PER SECOND!

Contemplating having a store of bullets objects that are pre-created and hidden, then just recycled as needed. This would remove the object creation (clone/instance/make) from the main loop.

It's not my fault!
vitinho444
9
Years of Service
User Offline
Joined: 12th Oct 2010
Location:
Posted: 25th Jan 2012 18:29
McLaine, im not the best modeler either

I dont even know how to animate and stuff, so i stick to 2D..

Where did you learn the 3D Skills for making your game? Can you point me in some direction? It would be greate

Thanks

C++ Medium 3.5/5
www.oryzhon.com <-- My company's website (W.I.P)
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 25th Jan 2012 20:34
The basic positioning of 3D objects is made easy by Dark Basic. You either use primitives (spheres, cubes, etc) and texture them, or you dl models from the net.

Where you might struggle is the maths, but then again DB makes this easy with the Pitch/Yaw/Roll commands, at least for simple stuff. There is currently nothing more than that in this game.

Basically, I've been teaching myself programming since the days of the BBC micro, and have a strong math background from school.

It's not too hard if you keep things basic and avoid the need for matrices and such.

It's not my fault!
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 25th Jan 2012 21:12
Yes vitinho444, play with 3D. It's not as hard as you think.

@McLaine
What are you instancing? Is it a box, a plane, or a sphere? You should make your "original object" the size you want all your bullets to be and that way you don't have to scale the instanced object.

Most space ship games have cool glowy bullets. I suggest using billboards for that and dbDisableObjectZWrite(bullet); this will make for a much cooler effect.

The fastest code is the code never written.
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 25th Jan 2012 21:53 Edited at: 25th Jan 2012 21:54
The Bullet is basically 3 plains and I've sorted the scalling issue. I was just being lazy trying to change as little code as poss from when I was cloning.

A billboard ain't going to be much faster than 3 plains is it?

Correct me if I'm wrong, but a billboard is a plain that allways faces the player?

Check it out Hawkblood, and you can tell me what you think/suggest for the bullets.

It's not my fault!
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 25th Jan 2012 23:56
I'll have a look.

The code used to face the plane at the camera has minimal effect on the performance. When a mesh is calculated in 3D space and sent to the GPU it has a matrix (math not db) that is a part of it. In that matrix is the position, scaling, and rotation of the object. So the math is done no matter what. The GPU has less overhead with a billboard vice 3 planes.

The fastest code is the code never written.
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 26th Jan 2012 00:14
Thanks for trying it out Hawkblood.

What did you think of the flight control?

I'll give it a go with the billboard. I suppose it makes sense that it would be a 2/3rds less overhead.

It's been a while since I've done any research on billboards. Would the planes be locked to the screen and just scaled to give impression of the bullet moving off into the distance, or would you move the plain like a normal 3d object but just keep it facing the camera?

It's not my fault!
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jan 2012 00:34
When you update the bullets, just dbPointObject(bullet,cx,cy,cz);
where cx,cy,cz is the camera location. I have a "camera" stucture because I like to keep all the info in one spot. In it, I do position and rotation of the camera, so I already have the cx,cy,cz variables updated. I even have my time between frames variable updated so I can call them anywhere in the game like Cam.cx or Cam.fTBF

The flight controls are nice. Keep up the good work.

The fastest code is the code never written.
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 26th Jan 2012 00:40 Edited at: 26th Jan 2012 10:59
Hehe, thanks.

DB certainly has something. Despite all the niggles, I keep coming back.

It's not my fault!
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jan 2012 00:50
What are niggles?

The fastest code is the code never written.
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jan 2012 01:01
I just noticed you are using MultiSync for your networking. This uses TCP only. TCP is slower than UDP. This could cause speed issues in your network. It's not a big deal if you plan on having only a small number of players and minimize the number of network updates.

The fastest code is the code never written.
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 26th Jan 2012 01:09
Niggles = little problems

Yeah, using multisync, just because it's free and easy and has got me up and running. And as an old hat, it's what I'm familiar with.

If I get far enough, I'll replace that with something that can handle more players.

It's not my fault!
Noley
9
Years of Service
User Offline
Joined: 13th Dec 2010
Location:
Posted: 26th Jan 2012 07:34
OMGGGGggggggg MCLAINE!!!!!!!!!!!!!!!!!!!!!?!?!?!

WHERE HAVE YOU BEEN ALL MY LIFE?

I remember watching your thread lol, tbh most of the reason for me coming back to checkout the GDK forum was for your thread, not gonna lie
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 26th Jan 2012 15:24
I'm flattered!

Server is currently up by the way.

It's not my fault!
McLaine
13
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 26th Jan 2012 22:26
Well, it seems instanced objects cannot do collision detection, so I've switched back to cloning until I can write an alternative approach.

From here on, I'll update and discuss in the WIP thread only:

http://forum.thegamecreators.com/?m=forum_view&t=193667&b=8

Can a MOD please lock this thread?

It's not my fault!

Login to post a reply

Server time is: 2019-12-13 21:02:38
Your offset time is: 2019-12-13 21:02:38