Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
iopred
Aug 14, 2005

Heli Attack!

Hanpan posted:

I actually have no idea why I typed Flex because I primarily used the Flash IDE. Out of interest, do you have any projects you can show me? My tile engines always seem sluggish but I am more than willing to admit it's probably because I code them badly.
(Although the last project only used two movieclips, the rest was all copypixels!)

Flash is more than capable of doing a 2d platformer, infact I would say that is is one of the better technologies to do it in, especially because AS3 is totally badical.

Edit: I had typed up a hint to use copyPixels, but it seems you are already doing that, perhaps you are doing something horribly inefficient, PM me if you would like to discuss it further.

Adbot
ADBOT LOVES YOU

StickGuy
Dec 9, 2000

We are on an expedicion. Find the moon is our mission.

biznatchio posted:

MS-RL is like the GPL. If you use any of the source code in a file of another project, that file of the project must be made available under the MS-RL license. It differs from the GPL in that copyrights and attributions in the source code must be left intact, even when incorporated into another project.
Judging from your summary, another difference with the GPL is that, under MS-RL, only the source files making use of MS-RL code must be made open source when redistributing. With the GPL, all source files would need to be made open source.

LordLobo
Dec 12, 2003

Not
gonna
take it
anymore
Does anyone have a recommendation for a 2d/sprite game engine in c#?

I have ideas, just not precisely the willpower to write the engine. Though I probably should, but then it's entirely possible someone has already done it and done it well.

Ferg
May 6, 2007

Lipstick Apathy

LordLobo posted:

Does anyone have a recommendation for a 2d/sprite game engine in c#?

I have ideas, just not precisely the willpower to write the engine. Though I probably should, but then it's entirely possible someone has already done it and done it well.
I know it's been said here a million times and it's pretty tired at this point, but look into XNA. You can easily setup a 2D game in XNA Studio.

biznatchio
Mar 31, 2001


Buglord

Twiggy794 posted:

I know it's been said here a million times and it's pretty tired at this point, but look into XNA. You can easily setup a 2D game in XNA Studio.

Very easily. I've been wanting to play around with XNA for a while and just got started with it a couple nights ago. Starting from scratch and no previous knowledge of the XNA classes, I've got a mostly functional side-scrolling platformer engine written. I'm surprised how easy it is.

devoir
Nov 16, 2007

biznatchio posted:

Very easily. I've been wanting to play around with XNA for a while and just got started with it a couple nights ago. Starting from scratch and no previous knowledge of the XNA classes, I've got a mostly functional side-scrolling platformer engine written. I'm surprised how easy it is.

Curious as to what your prior experience is in other languages, toolkits, game development in general is. Fascinating to hear the vastly differing viewpoints on XNA\.

Azazel
Jun 6, 2001
I bitch slap for a living - you want some?

LordLobo posted:

Does anyone have a recommendation for a 2d/sprite game engine in c#?

I have ideas, just not precisely the willpower to write the engine. Though I probably should, but then it's entirely possible someone has already done it and done it well.

This might fit your bill: http://www.garagegames.com/products/torque/x/ - they are working hand in hand with Microsoft to bring indy gaming to a broader market. This pretty much takes Garage Games hard work, mingles it with XNA, and gives you a pretty drat awesome 2d game building solution (and as of late, 3d in beta).

The engine is free, and scriptable. The Builder is on a 30 day free trial, but is worth the $100 if you don't want to edit a lot of code/xml scene files by hand.

Admittedly, I have yet to build a single game with any of the Torque Engine's I've purchased. I'm just a fan of the company, and have learned quite a bit using their code as an education resource.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

devoir posted:

... vastly differing viewpoints on XNA\.

Huh. I've always heard this: It's not really designed from professional production studio stuff, but for any sort of hobbyist, it can get you up and running very quickly. It's powerful enough to do some pretty cool 3d stuff, and has support for modern shaders. It's easy to develop with too!

IcePotato
Dec 29, 2003

There was nothing to fear
Nothing to fear
XNA is driving me crazy; I can't seem to use the right namespaces outside of my main game file to get the classes I need. For example, I am trying to write a class that takes a Vector2d, defined in Microsoft.Xna.Framework namespace, but even though I have
code:
using Microsoft.Xna.Framework;
up top, I can't loving compile without getting "The type or namespace name 'Vector2D' could not be found (are you missing a using directive or an assembly reference?)" on this line:
code:
        public [b]Vector2D[/b] moveTo(Coord dest)
        {
            return new Vector2D(x,y);
        }
I had the same problem with Content.Load in another class file. I've looked at definitions, I've looked at documentation, nothing seems to mention why you can't use this poo poo outside the main game class even when you copy-paste every single "using" directive from the header into your other class file. This is killing me, help plz.

e: Full disclaimer: I'm a Java programmer. Packages make sense to me. Namespaces mostly make sense to me... As far as I can tell, there's no super-huge difference.

No Safe Word
Feb 26, 2005

IcePotato posted:

XNA is driving me crazy; I can't seem to use the right namespaces outside of my main game file to get the classes I need. For example, I am trying to write a class that takes a Vector2d, defined in Microsoft.Xna.Framework namespace, but even though I have
code:
using Microsoft.Xna.Framework;
up top, I can't loving compile without getting "The type or namespace name 'Vector2D' could not be found (are you missing a using directive or an assembly reference?)" on this line:
code:
        public [b]Vector2D[/b] moveTo(Coord dest)
        {
            return new Vector2D(x,y);
        }
I had the same problem with Content.Load in another class file. I've looked at definitions, I've looked at documentation, nothing seems to mention why you can't use this poo poo outside the main game class even when you copy-paste every single "using" directive from the header into your other class file. This is killing me, help plz.

e: Full disclaimer: I'm a Java programmer. Packages make sense to me. Namespaces mostly make sense to me... As far as I can tell, there's no super-huge difference.

Did you add a reference to the XNA stuff in your project? In your little Solution Explorer sidebar under References, right click and choose "Add Reference..." and find the XNA stuff and add it. That should probably fix it (disclosure: never done XNA stuff, just plenty of stuff in Visual Studio)

edit: oh yeah, that would be the other half of "are you missing a using directive or an assembly reference?" :downs: But it's easy to just say "yeah, I've got the using directive, what gives?" :v:

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
I believe the class is Vector2, not Vector2D. ;)

IcePotato
Dec 29, 2003

There was nothing to fear
Nothing to fear

Pfhreak posted:

I believe the class is Vector2, not Vector2D. ;)

welp, i'm going to go kill myself now. thanks.

I'm making a bare-bones RTS game for an independent study and just now starting to get to the meat of it. This is by far the hardest poo poo I've ever done, but i'm loving it. I just hit roadblocks about once a day and get ultra-frustrated and quit, then pick it up the next morning.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Feel free to post, and we'll help you through.

Nibelheim
Jul 7, 2006

Oi, hello Game Development Megathread.

I'm really looking into starting game programming as a hobby. I'm a college graduate in computer sciences, and I've done nothing but administrative programming so far. I've narrowed my first project down, and I had a few questions.

I'll be writing a simple platformer (two simple levels - to set me an attaignable goal for the moment). This is going to be for the Nintendo DS.

My main question surrounds the collision detection. After doing some research, I've found that a lot (if not most) of the projects done for the DS use collision maps (A hidden background that includes certain coloured pixels, and the engine verifies if the sprite hits a certain pixel). Is this really the way to go? What do most platformers outside of the DS use for detection?

TSDK
Nov 24, 2003

I got a wooden uploading this one
Collision detection has always been, and still is, about spatial partitioning. Use bounding boxes for quick checks to trivially reject collisions that can't possibly happen. Maybe subdivide the screen with either a kd-tree or quad-tree so that you don't check object versus object when they're completely contained in different leaves.

Once you've pruned out all of the collisions that can't happen at a high level, then you're left with those that may happen at a lower level. How you check those will depend on what sort of sprites you've got and what sort of collision you want.

It may be good enough just to subdivide the sprite down further and do overlapping box checks on a smaller scale. If you want to go pixel perfect, then you could alway render the overlap region offscreen using a logical-and mode and then scan through the vram with the cpu to check for non-zero results. Or you could store the min and max extent values for each line of pixel data in the sprite, and then for the overlap lines you're doing a 1d min-max overlap check.

Basically, there are loads of options out there, and you'll only figure out which one is best after trying a few, profiling and weighing the cost up against memory footprint etc...

Nibelheim
Jul 7, 2006

TSDK posted:

Collision detection has always been, and still is, about spatial partitioning. Use bounding boxes for quick checks to trivially reject collisions that can't possibly happen. Maybe subdivide the screen with either a kd-tree or quad-tree so that you don't check object versus object when they're completely contained in different leaves.

Once you've pruned out all of the collisions that can't happen at a high level, then you're left with those that may happen at a lower level. How you check those will depend on what sort of sprites you've got and what sort of collision you want.

It may be good enough just to subdivide the sprite down further and do overlapping box checks on a smaller scale. If you want to go pixel perfect, then you could alway render the overlap region offscreen using a logical-and mode and then scan through the vram with the cpu to check for non-zero results. Or you could store the min and max extent values for each line of pixel data in the sprite, and then for the overlap lines you're doing a 1d min-max overlap check.

Basically, there are loads of options out there, and you'll only figure out which one is best after trying a few, profiling and weighing the cost up against memory footprint etc...


I'm a little confused on the tree solutions. Care to elaborate?

TSDK
Nov 24, 2003

I got a wooden uploading this one

Nibelheim posted:

I'm a little confused on the tree solutions. Care to elaborate?
For more detail you could always check wikipedia, but the basic idea is this:

You can put your sprites into two lists - those on the left half of the screen, and those on the right. Note that the lists are not mutually exclusive, as you can have a sprite straddling both. When running through the sprite versus sprite checks for sprites evenly distributed around the screen, then you've cut your work in half. You don't have to check the sprites in the left list against those in the right list, because they're nowhere near each other.

For the quad or kd-tree, you recursively split the halves in two, then in two again etc... until you get a suitable level of granularity whereby you've cut down the number of sprite-sprite collisions, but not at too much of a cost in memory or overhead maintaining the list.

Note that there are some different flavours of quad-trees, and node storage varies between them. For instance, earlier I could have said make 3 lists: left only, right only, and straddling both. What this means is that instead of duplicating pointers by keeping the elements in multiple lists, you're trading CPU time for memory by adding a traversal step where you check the lists in all of the parent nodes as well.

Nibelheim
Jul 7, 2006

TSDK posted:

For more detail you could always check wikipedia, but the basic idea is this:

You can put your sprites into two lists - those on the left half of the screen, and those on the right. Note that the lists are not mutually exclusive, as you can have a sprite straddling both. When running through the sprite versus sprite checks for sprites evenly distributed around the screen, then you've cut your work in half. You don't have to check the sprites in the left list against those in the right list, because they're nowhere near each other.

For the quad or kd-tree, you recursively split the halves in two, then in two again etc... until you get a suitable level of granularity whereby you've cut down the number of sprite-sprite collisions, but not at too much of a cost in memory or overhead maintaining the list.

Note that there are some different flavours of quad-trees, and node storage varies between them. For instance, earlier I could have said make 3 lists: left only, right only, and straddling both. What this means is that instead of duplicating pointers by keeping the elements in multiple lists, you're trading CPU time for memory by adding a traversal step where you check the lists in all of the parent nodes as well.

Things are much clearer now. Thanks.

This though, is regarding sprite vs sprite collision. Can the same theory be applied to the game's map? The level itself is not a sprite per se, but rather a.. well, map.

haveblue
Aug 15, 2005



Toilet Rascal

Nibelheim posted:

Things are much clearer now. Thanks.

This though, is regarding sprite vs sprite collision. Can the same theory be applied to the game's map? The level itself is not a sprite per se, but rather a.. well, map.

Sure. You can populate the tree with static entities representing level geometry, or some sort of reference to a subset of background tiles.

TSDK
Nov 24, 2003

I got a wooden uploading this one

Nibelheim posted:

Things are much clearer now. Thanks.

This though, is regarding sprite vs sprite collision. Can the same theory be applied to the game's map? The level itself is not a sprite per se, but rather a.. well, map.
You can, but it might be overkill for static map data. For an old-school platformer, I'd go with a tile based approach and define the level as an NxM array of tiles.

TSDK fucked around with this message at 13:48 on Feb 19, 2008

Nibelheim
Jul 7, 2006

TSDK posted:

You can, but it might be overkill for static map data. For an old-school platformer, I'd go with a tile based approach and define the level as an NxM array of tiles.

Very much appreciated. I'll get back to this thread when things unravel :V

Murodese
Mar 6, 2007

Think you've got what it takes?
We're looking for fine Men & Women to help Protect the Australian Way of Life.

Become part of the Legend. Defence Jobs.

TSDK posted:

Collision detection has always been, and still is, about spatial partitioning. Use bounding boxes for quick checks to trivially reject collisions that can't possibly happen. Maybe subdivide the screen with either a kd-tree or quad-tree so that you don't check object versus object when they're completely contained in different leaves.

Once you've pruned out all of the collisions that can't happen at a high level, then you're left with those that may happen at a lower level. How you check those will depend on what sort of sprites you've got and what sort of collision you want.

It may be good enough just to subdivide the sprite down further and do overlapping box checks on a smaller scale. If you want to go pixel perfect, then you could alway render the overlap region offscreen using a logical-and mode and then scan through the vram with the cpu to check for non-zero results. Or you could store the min and max extent values for each line of pixel data in the sprite, and then for the overlap lines you're doing a 1d min-max overlap check.

Basically, there are loads of options out there, and you'll only figure out which one is best after trying a few, profiling and weighing the cost up against memory footprint etc...

Similar to this, how do I go about 3d collision detection for non-regular objects? They won't be massively complex, but something like a bounding sphere or aabb won't be precise enough.

I had a look at http://www.gamasutra.com/features/20000203/lander_02.htm which was kinda helpful but fairly old, and the journal articles I want to read on the subject aren't available to me :( We're not allowed to use external libraries, it all has to be coded by us.

Obviously I can use the above stuff to cut down the possibilities, but what about lower-end methods?

haveblue
Aug 15, 2005



Toilet Rascal

Murodese posted:

Similar to this, how do I go about 3d collision detection for non-regular objects? They won't be massively complex, but something like a bounding sphere or aabb won't be precise enough.

I had a look at http://www.gamasutra.com/features/20000203/lander_02.htm which was kinda helpful but fairly old, and the journal articles I want to read on the subject aren't available to me :( We're not allowed to use external libraries, it all has to be coded by us.

Obviously I can use the above stuff to cut down the possibilities, but what about lower-end methods?

Usually the easiest way to do this is to implement a set of primitives and then assign each of your colliding objects a number of these to form their shape.

I don't know how complex or precise your collisions have to be, but you can fill just about any model with spheres and cylinders and get it close enough for a 3D game.

Scaevolus
Apr 16, 2007

You guys might be interested to learn that Havok is releasing their Physics and Animation libraries as free for non-commercial use.

The full press release is here.

brian
Sep 11, 2001
I obtained this title through beard tax.

While we're on the subject of physics i've been trying to do a simple 2D implementation of Jakobsen's Verlet intergration system of using projection instead of penalty or impulse based collision and i've run into a snag. Basically for some reason the integration when combined with constraints is generating its' own torque and it actually looks pretty realistic if it wasn't for the fact it's not meant to be happening.

code:
void CParticleSystem::verlet()
{
	for(int i = 0; i < m_vParticles.size(); i++)
	{
		SParticle* p = m_vParticles[i];
		Vector2 temp = m_vParticles[i]->position;
		p->position += p->position - p->oldPosition + p->forces * (m_timeStep * m_timeStep);
		p->oldPosition = temp;
	}
}

void CParticleSystem::satisfyConstraints()
{
	for(int iterations = 0; iterations < NUM_ITERATIONS; iterations++)
	{
		for(int i = 0; i < m_vParticles.size(); i++)
		{
			m_vParticles[i]->position = 
                Vector2::vmin(Vector2::vmax(m_vParticles[i]->position, Vector2(0.0f, 0.0f)), Vector2(1000.0f, 1000.0f));
		}

		for(int i = 0; i < m_vConstraints.size(); i++)
		{
			Vector2 &x1 = m_vConstraints[i]->pParticleA->position;
			Vector2 &x2 = m_vConstraints[i]->pParticleB->position;
			Vector2 delta = x2 - x1;
			float rLength = m_vConstraints[i]->restLength;
			delta *= (rLength * rLength) / ((Vector2::dot(delta,delta)) + (rLength * rLength)) - 0.5;
			x1 -= delta;
			x2 += delta;
		}
	}
}
Basically the vector of particles is just a struct holding the current position, the old position and the current acceleration (accumulated forces) and a constraint just consists of pointers to the two relevant particles and a length (like a stick).

Anyway for some reason when the length isn't exactly correct the constraints don't act like they should and cause some odd behaviour that cause semi-realistic torque/angular rotation which is confusing the hell out of me.

Here's the project, for some reason unknown to me it requires both VC8 and VC9 CRTs installed which I can provide seperately or you can get them off the MS site, it's called Terrain because it was just a test project I had set up so ignore that.

If anyone can take the time to help me out on this it would be fantastic because i'm trying to understand the best I can and it's confusing the crap out of me, I have a feeling it's to do with either floating point problems or generating the correct lengths but I can't find out what the crap i'm doing wrong.

The Jakobsen GDC paper on advanced character physics is the one i'm trying to implement, found here.

Femtosecond
Aug 2, 2003

I'm interested in making a game that would be very text heavy, like a simulation or an rpg. I'm thinking that the best way to store all the different text strings would be in a database, but I've never written a program that made use of a real database before or done any database programming, so I don't really know where to start.

What should I be looking at for integrating a database with a game? I really don't know anything about the issues involved or if there are any good libraries that deal with the situation. Basically I just don't know anything about databases.

I'll likely be working in C++.

Doc Block
Apr 15, 2003
Fun Shoe
Try SQLite, an embedded SQL database.

Honestly, though, I don't think you need a full-on database for this. Just simple name value pairs in a text file would probably be enough:
code:
npc37_string1 = "Why, hello there traveller!"
npc37_string2 = "No, I don't have any of those..."
Load the strings into a hash map, and from there on refer to them by name (show_dialog(your_string_hash_map["npc37_string1"]). Plus, it'll make internationalization easier if you ever need to.

Cedra
Jul 23, 2007
I have 2 questions (I use XNA and C#):

What's the basics needed for a shoot 'em up ala Ikaruga or Touhou? So far I've gathered that there should be a Game class for the logic, a Player class for the player sprite and projectile class for the bullets. There probably should be an enemy class as well.

My main problem is figuring what goes inside those classes, mainly projectile. How would one go about setting up all those fancy bullet patterns, the timings of when a particular enemy appears and how they fly into the screen?



Secondly, I was hammering away at XNA and tried making a sprite jump like Mario. My code is this:

code:
(Input method within Game.cs)
            KeyboardState newState = Keyboard.GetState();

            if (newState.IsKeyDown(Keys.Space) && (oldState.IsKeyDown(Keys.Space) == false))
            {
                jumpOK = true;
                spritePosition.Y -= 1;
                yvel = 2.01f;
            }


(Update method within Game.cs)

float initialTime = (float)gameTime.ElapsedGameTime.TotalMilliseconds;

            if (jumpOK == true)
            {
                if (spritePosition.Y < 400)
                {
                    ypos += yvel; //* elapsedSeconds;//(float)gameTime.ElapsedRealTime.TotalSeconds;
                    yvel += yacc * (float)gameTime.ElapsedRealTime.TotalSeconds; //* elapsedSeconds; //0.0166...666667f;
                    spritePosition.Y -= ypos;
                }
                else
                {
                    spritePosition.Y = 400;
                    yvel = 0;
                    ypos = 0;
                    jumpOK = false;
                }
            }

            base.Update(gameTime);
        }
The commented out parts were experiments trying out different variables. If there's anything missing that you need to better understand the code please let me know.

Anyway, I've been trying to achieve a consistent apex with no luck. It's been about 6 months since I looked at the code but from what I remember the apex sometimes differs due to the reliance on gametime as part of the velocity calculation. Also, the sprite doesn't quite have that snappyness of a classic Mario jump.

Basically, is there a better way to program a jump function, or can this current code be modified to allow a faster ascent while coming down slower (I think this is what Mario does)?

Cedra fucked around with this message at 16:17 on Feb 25, 2008

TSDK
Nov 24, 2003

I got a wooden uploading this one

brian posted:

While we're on the subject of physics i've been trying to do a simple 2D implementation of Jakobsen's Verlet intergration system of using projection instead of penalty or impulse based collision and i've run into a snag. Basically for some reason the integration when combined with constraints is generating its' own torque and it actually looks pretty realistic if it wasn't for the fact it's not meant to be happening.
Your constraint code is wrong. I was trying to work out exactly how you managed to remove the sqrt, and so I looked up the paper:
http://teknikus.dk/tj/gdc2001.htm

This gives the constraint satisfaction code as:
code:
// Then satisfy (C2)
Vector3& x1 = m_x[0];
Vector3& x2 = m_x[1];
Vector3 delta = x2-x1;
float deltalength = sqrt(delta*delta);
float diff = (deltalength-restlength)/deltalength;
x1 += delta*0.5*diff;
x2 -= delta*0.5*diff;
Which makes a lot more sense.

brian
Sep 11, 2001
I obtained this title through beard tax.

Thanks for the help, however I linked said paper at the end of my post, the reason for the changed constraint code is because it's using the later faster revision in the paper used to remove using costly sqrt() calls.

quote:

We now discuss how to get rid of the square root operation. If the constraints are all satisfied (which they should be at least almost), we already know what the result of the square root operation in a particular constraint expression ought to be, namely the rest length r of the corresponding stick. We can use this fact to approximate the square root function. Mathematically, what we do is approximate the square root function by its 1st order Taylor-expansion at a neighborhood of the squared rest length r*r (this is equivalent to one Newton-Raphson iteration with initial guess r). After some rewriting, we obtain the following pseudo-code:



// Pseudo-code for satisfying (C2) using sqrt approximation

delta = x2-x1;

delta*=restlength*restlength/(delta*delta+restlength*restlength)-0.5;

x1 += delta;

x2 -= delta;


More to the point however, even with the slower and maybe marginally more accurate way from earlier in the paper the same behaviour appears with the constraint causing some odd torque. I really want to get onto intersection tests and proper rigid bodies so this is really annoying me :(

TSDK
Nov 24, 2003

I got a wooden uploading this one

brian posted:

Thanks for the help, however I linked said paper at the end of my post, the reason for the changed constraint code is because it's using the later faster revision in the paper used to remove using costly sqrt() calls.
That's under the cloth sim part though and you can get away with more inaccuracies with that. I don't think it'll be accurate enough for rigid bodies. The best way to speed up that loop is to use SSE intrinsics, and the __m128_mm_rsqrt_ss instruction.

brian posted:

More to the point however, even with the slower and maybe marginally more accurate way from earlier in the paper the same behaviour appears with the constraint causing some odd torque. I really want to get onto intersection tests and proper rigid bodies so this is really annoying me :(
The first thing I'd try is bumping up the number of iterations to make sure it's converged to a decent solution, and then double-check that you've not accidentally doubled up any constraints (i.e. A-B and B-A in the constraint array).


EDIT: The other possibility is just that the order of constraint application is introducing the torque. It's been a few years since I last looked into this method, so my memory is hazy as to what results should be expected.

TSDK fucked around with this message at 20:37 on Feb 25, 2008

Excedrin
Jun 24, 2002
The Headache Medicine
There's a bug in the constraint init code, in CParticleSystem.cpp:
code:
61    pConst->restLength = (m_vParticles[2]->position - m_vParticles[1]->position).getLength();
62    pConst->restLength = 200.0f;
Remove line 62, problem solved.

pseudopresence
Mar 3, 2005

I want to get online...
I need a computer!

Cedra posted:

My main problem is figuring what goes inside those classes, mainly projectile. How would one go about setting up all those fancy bullet patterns, the timings of when a particular enemy appears and how they fly into the screen?

Those fancy bullet patterns and enemy movements and timings have to be authored; you need to decide what you want to happen and either implement it in code or in some data-driven fashion.

The most straightforward way of specifying when enemies should be created would be to check the time since the start of the level at the start of your game loop, and spawn enemies that should be spawned by that point. A slightly more general/flexible approach would be to have an ordered list of level events and times, and in the main loop run and remove from the list any events that should occur at a time <= current time. The level events can then be cutscenes, enemy creation, powerups, etc.

The list of level events can be populated from your code, or from some kind of level definition file (XML, Lua, whatever).

As an example of a data-driven approach, Kenta Cho created a markup language for bullet patterns, BulletML. It might be overkill for a first project depending on your experience, since from what I can tell there's no C# implementation and you'd have to write your own. Just browsing the docs might give you some ideas, though.

Cedra posted:

Anyway, I've been trying to achieve a consistent apex with no luck. It's been about 6 months since I looked at the code but from what I remember the apex sometimes differs due to the reliance on gametime as part of the velocity calculation. Also, the sprite doesn't quite have that snappyness of a classic Mario jump.

Basically, is there a better way to program a jump function, or can this current code be modified to allow a faster ascent while coming down slower (I think this is what Mario does)?

The correct implementation of pos/vel/acc using Euler integration in a framerate-independent manner is:
code:
Each frame:
pos += vel * dt
vel += acc * dt
Where dt is the time since last frame. Having had a quick look at XNA docs, I think what you want is dt = ElapsedGameTime.TotalSeconds. It sounds like by default frametime will be fixed to 16.67ms unless you tell the framework to do variable time steps (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1132587&SiteID=1); in either case this code should be correct.

The acceleration here would include the acceleration due to gravity, but potentially also the acceleration due to wind, explosions, etc.

HauntedRobot
Jun 22, 2002

an excellent mod
a simple map to my heart
now give me tilt shift
Acquisition of a laptop has led to a resurgence of activity in my game, I can now pick it up and work on it in short bursts when I have an idea, code in Starbucks and whathaveyou.

As such the engine is progressing nicely, albeit in a slightly uncontrolled way. I read a lot of advice which said "be wary of making everything too general on your first game" which I realise I'd been doing, so I stopped. That said, I have what appears to be a neat layered OpenGL canvas solution which renders a bunch of layers in turn, and I can switch them around when I need to on the fly. Tile engine lives in one layer, menus and ui in other layers.

But I'm thinking of swapping out the tile engine for something a bit more 3d, going for the oldschool isometric perspective, or something equivalent. Maybe. I think I can get better puzzles going with the addition of a bit of 3d.

Lank
Sep 16, 2002

WHERE IS THE CHANCELLOR?!

HauntedRobot posted:


But I'm thinking of swapping out the tile engine for something a bit more 3d, going for the oldschool isometric perspective, or something equivalent. Maybe. I think I can get better puzzles going with the addition of a bit of 3d.

You may not need to go fully into 3d if you restrict the isometric view to a certain angle. Think Final Fantasy Tactics but without the 3d rotation or camera elevation levels. As long as you draw tiles starting at the back, and doing an entire Z-level (height level) at once before moving up, the view would turn out correctly using overlapping sprites instead of 3d objects.

It just sounds like you have a good setup to be able to easily implement tile layering already. It might be worth a shot unless camera movement would be really important or you just have an itch to try a 3d world.

Sounds good though. :)

SnakeByte
Mar 20, 2004
FUCK THIS COMPANY THAT HASNT PRODUCED THE GAME IN QUESTION FOR YEARS BECAUSE THEY SUSPENDED ME FOR EXPLOITING A BUG FUCK THEM IN THE ASS I AM A MORON
https://www.directxtutorial.com/Tutorial9/tutorials.aspx

Someone recommended this website to me. These tutorials are really well thought out, and good for those wanting to transfer their skills to DirectX. I dunno about the "professional" tutorials though.

Sigvatr
Jan 7, 2008

by elpintogrande
Does anyone like making games, knows C or C++ and wants to make money? I will be making graphics and also have a sound and music design guy. We got that artistic stuff under our belts but need a programmer dood.

Email me at me@sigvatr.com

iopred
Aug 14, 2005

Heli Attack!

Sigvatr posted:

Does anyone like making games, knows C or C++ and wants to make money? I will be making graphics and also have a sound and music design guy. We got that artistic stuff under our belts but need a programmer dood.

Email me at me@sigvatr.com

Strange, I would have thought MM would've had the skill (and ego) for anything you'd want to make.

Vinlaen
Feb 19, 2008

Are there any game engines (or frameworks/libraries) that include automatic network synchronization of game objects?

For example, if I create a Worms or Scorched Earth game I would to shoot a projectile (using simple physics) and have it follow the same trajectory on every game client. I'd also like to include environment physics objects like black holes, etc, etc.

It seems like no game engines include automatic network synchronization... :(

Adbot
ADBOT LOVES YOU

more falafel please
Feb 26, 2005

forums poster

Vinlaen posted:

Are there any game engines (or frameworks/libraries) that include automatic network synchronization of game objects?

For example, if I create a Worms or Scorched Earth game I would to shoot a projectile (using simple physics) and have it follow the same trajectory on every game client. I'd also like to include environment physics objects like black holes, etc, etc.

It seems like no game engines include automatic network synchronization... :(

Unreal, although that's not exactly what you're looking for in a Worms clone engine :)

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply