Micro Wars

Started by
12 comments, last by darkzerox 18 years, 10 months ago
You could do it like this:

BULLET *newBullet = new BULLET(id, px, py, 300, dir);
projectile.push_back(newBullet);

Remember to iterate through your list and call delete to free up your memory when you're finished!

-Mezz
Advertisement
Ah... I need new again. I was trying different combinations with * and ->... none of which worked :p

See, the first time I tried push_back I used new, but then I discovered I didn't need it... and now I do again... sheesh :p

Anyways, thanks!

BTW, projectile.push_back(new BULLET(id, px, py, 300, dir)); works just fine. But I've seen it done your way much more often... I like my shortcuts.

Now for my game I've planned out 12 different guns so far. Originally I had more, but I decided to give each one a secondary fire instead. So in a way... there's 23. I've tried to keep the weapons as different as possible from eachother, but there may be a few similarities here and there. I say 23, because I can't come up with a secondary for the Magnum... any suggestions?

I suppose I should tell you what the game is about first. Here's a screenie, it can do the talking for me.



There'll be blood and stuff in the newer version. I'm going to try and concentrate on game-play first. Which is really not my style, I usually get caught up in the physics and coolness of the game, but I figure having something playable for a change could get my rep up a little (haha).

I'm trying to keep my code clean this time through.. do it the proper and professional way....


Edit: Just noticed that you're Mezz :) *claps* You found my new thread.. I think I'll keep all my questions in here now (related to this game anyway).

[Edited by - darkzerox on June 3, 2005 5:23:45 PM]


Lightning came out a lot better than expected. Had anticipated a lot more problems, but it worked out quite well. It definately feels lightning-y.

I just can't decide on which I like better.

The first version shoots 8 bolts of lightning, which go in one general direction, but are fairly erratic.

The second version allows for "forking". This was all very nice, but I had it fork in the same general direction as the rest of the lightning, resulting in just a massive buildup at the end of the stream. So I let it branch off at different angles..

Now if one branches off at say 30 degrees, and another branches off at 30 degrees,... and everything has a 10% chance to branch...

Well, the lightning literally dissolved my map. It eventually filled the entire screen... and lowered my FPS to about 20. Which really isnt bad, given the number of lines it had to draw and calculate. But it will never have to do that in a real game :D

Now originally I had the lightning bolts draw the entire path of the lightning bolt from your character to where it hits, and when it hits the entire bolt disappears. Which I thought was sort of a neat electrical property type thing, but drawing only the last 10 segments of the bolt is pretty neat too.

Anyways, I can use two different versions for my final game, one for primary and secondary fire.

I want one to be fairly straight.. so perhaps no branching.

The other one I want to have a much wider spray, but shorter range. Or perhaps I could have it go in all 360 degrees? To form like a mini-protection shield...

Also... I could have it charge up. Depending on how much you charge, it could determine how much it branches... its chance to branch, the max number of branches allowed....... so many choices!

BTW, it looks a lot cooler in game, with full motion... I made each line segment randomly change to a different shade of blue every frame (the lazy way out).. but ya. It looks good.

Grenades and Fork Lightning have also been added...... maybe I should stop posting updates til I release something eh?

[Edited by - darkzerox on June 4, 2005 4:15:12 PM]
Got some basic networking in.
Was easier than I had newly anticipated.
I thankfully found a Dev-Cpp/mingw port of raknet.... which greatly helped.

Do wish they didn't install it to the folder they did... though its not a big concern. Just some minor adjustments and it works great.

Their tutorial/samples could have been better too I think.

But I've got it figured out now. The first time I ran my program they were nearly perfectly in sync, but now they are like 10 seconds behind eachother unfortunately... don't know what I'm going to do about that.

I'm using UNRELIABLE_SEQUENCED packets to send positions/velocities. I figured if it got behind, it would send a more recent packet and the character would warp to his new position as he should. However... it seems like nearly all the packets are being received.. just 10 seconds behind. Are the send times just slow?


[EDIT]
*WAHAHAHAA*

I think I just figured it out. I removed the FPS limiter to check how fast it would really be capable of going.. therefore there were no "waits". So the window in focus was using all the CPU....

Anyways.. thats awesome then :D

This topic is closed to new replies.

Advertisement