Welcome, Guest. Please Login or Register.  • Help
SMF Underground
+ SHMUP-DEV » RAPID PROTOTYPE SESSIONS » Older Sessions » Session 4
|-+ Jakman4242's entry(Leech)

Pages: [1]   Go Down
0 Members and 1 Guest are viewing this topic. Topic Tools  
Read September 08, 2008, 10:02:58 PM #0
jakman4242

Jakman4242's entry(Leech)

Hey all. I can't guarantee much to this Session, but you can bet on it I'll try something out. I'll be making this in C++

The game's name now if officially Leech. A Vertical shooter, cyber-punk/fantasy. You shoot enemies, they die. Wow. You shoot an enemy enough and it will turn red in some way. Collide with an enemy when reddened, and you'll merge with it. Giving you different characteristics depending on the ship you merged with. Simple for a first-C++ shmup. So far things are going great, I'll get a screenshot posted once there's actually something worth seeing.


« Last Edit: September 10, 2008, 03:55:18 AM by jakman4242 »

My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 09, 2008, 10:48:19 PM #1
jakman4242

Re: Jakman4242's entry

I fixed all my errors, with a little look at motorherps bullet management tutorial.(I can't believe I never noticed that before.)

But, my game crashes after I fire only three or four bullets... why? I have no idea. A little hinderance on my progress, so.. Gah. I'll be totally rewriting this to use motorherps tutorial in whole this time.
« Last Edit: September 09, 2008, 10:59:45 PM by jakman4242 »

My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 10, 2008, 12:25:14 AM #2
jakman4242

Re: Jakman4242's entry

Okay, I need serious help. I converted the whole system to motorherps, and the game still crashes a few seconds after I start firing bullets. I don't get it? At this point I feel just totally de-motivated, I've been trying to get this to work for almost five hours to no avail. I've included the source, absolutely everything is in it so you can just compile it from the get-go... If it helps. I've been using SDL and Code::Blocks thus far.



My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 10, 2008, 12:39:06 AM #3
kdmiller3

Re: Jakman4242's entry

If you use Visual C++ 2005 or 2008 Express Edition, you'll have access to a full-featured debugger so you'll be able to see exactly where it crashes.  Figuring it out by inspecting code is not going to get you very far if you aren't that familiar with C++.
Offline  
Read September 10, 2008, 12:46:59 AM #4
jakman4242

Re: Jakman4242's entry

If you use Visual C++ 2005 or 2008 Express Edition, you'll have access to a full-featured debugger so you'll be able to see exactly where it crashes.  Figuring it out by inspecting code is not going to get you very far if you aren't that familiar with C++.

Code::Blocks has one as well, for the record. I'm really not sure how to use the debugger for this type of situation, though.


My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 10, 2008, 01:00:57 AM #5
kdmiller3

Re: Jakman4242's entry

Ah.  I did figure out your problem, by the way: you're calling "delete" on a Bullet object that wasn't allocated with "new".  In addition, adding or removing elements from a vector will invalidate any iterator pointing to it.  I'll see if I can come up with something to fix it for you later tonight.
Offline  
Read September 10, 2008, 01:03:36 AM #6
jakman4242

Re: Jakman4242's entry

Ah.  I did figure out your problem, by the way: you're calling "delete" on a Bullet object that wasn't allocated with "new".  In addition, adding or removing elements from a vector will invalidate any iterator pointing to it.

Yeah. Since that was a little left-over from my original(badly made) bullet management, and for the fact I forgot to free my bullets when they went outside the play-space, instead. I think it's ironic how I get choked over the easiest problems, yet I seem to be able to work out the hard ones. Thanks for that ^_^

[EDIT]
Yahoo! Woo-hoo! I seriously just applauded myself -- I do this very rarely. I've now successfully created a ship that can move and shoot, and bullets that manage themselves. After ten hours of work I've finally accomplished what Game Maker can do in about five minutes worth of work. I think it's a tad ironic, but I feel truly accomplished now. I don't know how well everything else will go, but at this point I don't plan on quitting!
« Last Edit: September 10, 2008, 01:16:15 AM by jakman4242 »

My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 10, 2008, 03:28:08 AM #7
kdmiller3

Re: Jakman4242's entry

So I take it you got it fixed, then?  Grin
Offline  
Read September 10, 2008, 07:29:32 AM #8
Sar

Re: Jakman4242's entry

I think it's a tad ironic, but I feel truly accomplished now. I don't know how well everything else will go, but at this point I don't plan on quitting!

Heh - it's not ironic at all! There's a lot more worth to being able to do something and understand how it all works than just doing something and having someone else worry about the particulars for you. ;-)
Offline  
Read September 12, 2008, 02:58:07 AM #9
kdmiller3

Re: Jakman4242's entry(Leech)

You're doing something few people attempt, so you should feel accomplished.  C++ is a hard language, and it's very easy to trip up and break things and not know why.

I do recommend getting a revision control system like Subversion to keep a history of your code changes, by the way.  I use the TortoiseSVN client and hosted the repository on my network attached storage device before switching over to Google Code.  It's not that hard to set up, and once you've got it, you'll always be able to go back if you break something.
Offline  
Read September 12, 2008, 04:06:42 AM #10
the2bears

Re: Jakman4242's entry(Leech)

I do recommend getting a revision control system like Subversion to keep a history of your code changes, by the way.

I second the recommendation.

Bill


the2bears - the indie shmup blog
Offline  
Read September 12, 2008, 08:37:32 PM #11
Pixel_Outlaw

Re: Jakman4242's entry(Leech)

Great feeling when things go right.
Thanks you for the continuation of Project Game.

We wish good luck please.



Aviator sunglasses are pretty much the shmups of the sunglasses world.
Offline  
Read September 13, 2008, 05:28:29 AM #12
jakman4242

Re: Jakman4242's entry(Leech)

Thanks for all the support! ^_^

I've accomplished a pretty nice thing lately, my first enemy. It's only a modification of motorherp's management system, but it works. I'm worried a tad though, since I'd have to make a new copy of the system every time, to meet the new enemy's specifications. Is this bad? Or should I change it to one system to manage all of the enemies, instead of having a separate one for each enemy. I don't really know how, exactly. But I can take another look into typenames and probably implement it. I don't really know. My goal right now is to just make a working shmup. So far I feel ecstatic. I've attached a screenshot showing my progress.


My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 13, 2008, 07:53:16 PM #13
kdmiller3

Re: Jakman4242's entry(Leech)

Pretty snazzy so far.

If enemies differ only by property values (image, size, speed, health, and so forth), you can define them as the same object type and pack them into the same array.  That's the easiest case.

If the enemies differ enough that they need to be different object types, the traditional C++ way is to uses inheritance (driving classes from a base class) and polymorphism (virtual functions).  Define a common base class for all enemies (or even all objects) and provide a virtual function for each object activity (update, collide, whatever).  Each enemy class then derives from that base class and provides implementations of those functions.  The main loop then goes through a list (or array) of pointers to objects of the base type, and the objects dispatch the function calls to the appropriate implementations.  It's very powerful.

Alternatively, you can use lists (or arrays) of function pointers (or, better yet, delegates).  That's what I use in my application framework, since delegates perform the function lookup (including virtual functions, multiple inheritance, and virtual base classes) once, and then use the result over and over again.
Offline  
Read September 13, 2008, 07:59:13 PM #14
jakman4242

Re: Jakman4242's entry(Leech)

So, like, use a hierarchy of classes? I'm not to sure how well that'll work, since I don't know much about how they work. It seems like that'd be that smartest thing to do, since the enemies will all be quite different.


My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 13, 2008, 08:49:36 PM #15
kdmiller3

Re: Jakman4242's entry(Leech)

You'll do something like this for your base class:
Code:
class Enemy
{
public:
// object unique identifier
unsigned int mId;

public:
Enemy(unsigned int aId)
: mId(aId)
{
// common enemy initialization
}

virtual ~Enemy()
{
// common enemy cleanup
}

virtual void Update(void)
{
// common enemy update
}
}

Then, for a specific enemy that does something interesting:
Code:
class Enemy1 : public Enemy
{
public:
Enemy1(unsigned int aId)
: Enemy(aId)
{
// enemy 1 specific initialization
}

virtual ~Enemy1()
{
// enemy 1 specific cleanup
}

virtual void Update(void)
{
// enemy 1 update

// also do common update
Enemy::Update();
}
}

You would then maintain a list (or array) of pointers to Enemy, like this:
Code:
Enemy *enemyarray[64];
unsigned int enemycount = 0;

Creating an specific enemy works like this:
Code:
Enemy *enemy = new Enemy1(id);
enemyarray[enemycount++] = enemy;

Even though the enemy is really an instance of Enemy1, the main loop can treat it as if it were an instance of Enemy.
Code:
for (unsigned int i = 0; i < enemycount; ++i)
{
enemy->Update();
}
Offline  
Read September 19, 2008, 10:37:01 PM #16
jakman4242

Re: Jakman4242's entry(Leech)

Might as well give a proper progress update... None.

I got food poisoning(didn't someone from the last one get it? I think it might become an epidemic for Session goers) and really didn't feel like doing much with my brain, truthfully.

Too big a step for me, really. So I'll slowly be developing this instead. As I promised, I provided my participation at least.

Good day,
-Jack


My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 19, 2008, 11:26:34 PM #17
kdmiller3

Re: Jakman4242's entry(Leech)

Don't feel too bad; I haven't made much progress either and don't have food poisoning as a justification.  Grin
Offline  
Read September 23, 2008, 11:23:54 AM #18
hima

Re: Jakman4242's entry(Leech)

Even if it's too big of a step, but you've already made a step! You really inspired me to start making the game from library/framework and not using GM. Keep it up and I hope you join us in the next session Smiley
Offline  
Read September 23, 2008, 10:03:10 PM #19
jakman4242

Re: Jakman4242's entry(Leech)

I'm glad something came out of this, best of luck to you!

And, I will definitely be (at least) participating in the next Session.


My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 24, 2008, 03:15:07 AM #20
Pixel_Outlaw

Re: Jakman4242's entry(Leech)

The best you can do is just keep pressing on.
You will only be defeated if you give up.

Rome wasn't built in a day and the same holds true for a seasoned programmer.  Wink



Aviator sunglasses are pretty much the shmups of the sunglasses world.
Offline  
Read September 24, 2008, 05:15:09 AM #21
jakman4242

Re: Jakman4242's entry(Leech)

The best you can do is just keep pressing on.
You will only be defeated if you give up.

Rome wasn't built in a day and the same holds true for a seasoned programmer.  Wink

Why, of course.

Today, I've implemented a nice little collision system all on my own, bounding box style. Grin
Sorry motorherp, I knew how to do this one on my own Sad (But the bit about the iterators with vectors kind of helped when making it...)


My game design blog -- A bit outdated, but you might like to take a read anyway~
Or read my new blog!~ (which I do update)
My blog.
Offline  
Read September 24, 2008, 05:27:22 AM #22
kdmiller3

Re: Jakman4242's entry(Leech)

Neat.  I had started writing my own collision system, but went with Box2D because I wanted something that "just worked".  It also fit with my generally "simulationist" approach.  Grin
Offline  
Pages: [1]   Go Up
Jump to:  

Page created in 0.099 seconds with 18 queries.