Side scrolling game programming

Jun 2, 2008
163
0
0
Hi, I would like to program a side scrolling game.

My languages that I know are C# and VB.NET, I have C++ experience but pointers and stuff like that are really foreign to me.

Any ideas?

Thanks.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
You can certainly do a side-scroller in .Net. All the basic blit operations you need are there for the graphics. Sound choices might be a little more limited.

But you'll really need to zero in on some specific areas of advice that you need, if you want relevant comments.
 

pcnerd37

Senior member
Sep 20, 2004
944
0
71
I would recommend getting the XNA framework and play around with it since it uses C#. I use it and love it. There are a ton of tutorials floating around on XNA which im sure you will find useful.
 
Jun 2, 2008
163
0
0
Well I'm just looking for a general all around guide. I have programming skills but it deals with more business like functions so I don't really know what game programming entails. I'll check out XNA, thanks!
 

dwell

pics?
Oct 9, 1999
5,185
2
0
You might want to look at Flash. Flash 9 uses ActionScript 3 which is a lot like C#/Java. Plus you have a wider distribution audience than with an installed game.
 

brandonb

Diamond Member
Oct 17, 2006
3,731
2
0
You can fart around with .NET, but honestly, if you really want to make a game, you have to learn C++. Blit Operations in .NET would be horribly slow and you won't make anything of professional type quality, and you will probably just get frustrated and resign the idea.

XNA is probably a better choice if you have to use .NET, but even still I think your best bet is C++.

Pointers are NOT that hard to learn. All they are is a variable (32 bit in 32 bit os, or 64 bit in 64 bit os) which holds a number. That number just happens to be a location in memory.

For example, if you have 1k of ram, you have a space in memory:


1 ----------------------------------------------------------------- 1024


If you have "Hello there", in location 500.

1 ----------------------"Hello There" ---------------------- 1024

The pointer points to 500. The pointer does not contain "Hello There". But with that pointer, you can read the bytes out of there and get "Hello There". Thats called dereferencing the pointer.

If the pointer is not used, it has to be initialized to 0 (null) which indicates its not used.

Alot of commands that do things like create a character string, return a pointer where it created the location in memory for you to use. Since you specify the size in code (50 characters) it assumes you know to only fill it 50 characters, so it only gives you the starting address.

Thats very basic pointer tutorial.

It wasn't so scary. ;)

Pointers are very powerful for doing certain operations, especially things done in video games. Thats why C++ code runs much faster and coding would be easier once you get over the learning curve.
 
Sep 29, 2004
18,656
68
91
learn and understand pointers first. Then learn to program a game. Figure out what you'll need to know in small chunks and do proof of concept programs just so you can prove to yourself that you can do things.

1) do a program with pointers
2) Learn to draw graphics to a screen
3) learn to move memory around in large chunks (possibly using video memory?)
4) keyboard/mouse inputs. Figure out how you want it to work, then figure out how to code such software.

The list can get bigger, but if you are new to C++ you need to take alot of baby steps first.
 

brandonb

Diamond Member
Oct 17, 2006
3,731
2
0
I'd just like to add: this is one example of using a C++ pointer that you cannot do in another language like .NET...

Lets say you have structure:

struct myStruct
{
char Name[50];
int Lvl;
int HitPoints;
int SwordSkill;
};

myStruct *Pointer = new myStruct[5]; // The data type doesn't mean anything, a pointer is a pointer, the only thing it does is make it so if you do math to the pointer, like Pointer++ it advances the pointer to the next part in memory of that type. So adding 1 to that actually advances 62 memory spots because that struct is 62 bytes big.

Now load up a saved game file. All kinds of crap in a byte stream.

memcpy(Pointer, sizeof(myStruct) * 5);

It loads directly from the file (which is just an array of bytes) directly into the structures. And it works just fine. In any other language, you have to copy each individual element from the file to the structure, since they don't allow pointers to do things in bulk. Pointers are much faster. That gives you the power of a pointer, and why games are made in C++.
 

fishjie

Senior member
Apr 22, 2006
234
0
76
www.youtube.com
This has been something that has interested me for a while but I've been too lazy to get into it. What would be a good graphics library for a sidescroller? Is directX pretty much overkill?
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Many moons ago I wrote one using DJGPP and Borland C++ IDE. Very simple double buffered operations used for the GFX.
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
Originally posted by: brandonb
I'd just like to add: this is one example of using a C++ pointer that you cannot do in another language like .NET...

Lets say you have structure:

struct myStruct
{
char Name[50];
int Lvl;
int HitPoints;
int SwordSkill;
};

myStruct *Pointer = new myStruct[5]; // The data type doesn't mean anything, a pointer is a pointer, the only thing it does is make it so if you do math to the pointer, like Pointer++ it advances the pointer to the next part in memory of that type. So adding 1 to that actually advances 62 memory spots because that struct is 62 bytes big.

Now load up a saved game file. All kinds of crap in a byte stream.

memcpy(Pointer, sizeof(myStruct) * 5);

It loads directly from the file (which is just an array of bytes) directly into the structures. And it works just fine. In any other language, you have to copy each individual element from the file to the structure, since they don't allow pointers to do things in bulk. Pointers are much faster. That gives you the power of a pointer, and why games are made in C++.

I thought this was basically what the Serialize (or something like that) interface is in various languages. Java, for instance, will do this for you on any class that you like.

Edit: I don't know anything about .NET -- does it have serialize?
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: degibson
Originally posted by: brandonb
I'd just like to add: this is one example of using a C++ pointer that you cannot do in another language like .NET...

Lets say you have structure:

struct myStruct
{
char Name[50];
int Lvl;
int HitPoints;
int SwordSkill;
};

myStruct *Pointer = new myStruct[5]; // The data type doesn't mean anything, a pointer is a pointer, the only thing it does is make it so if you do math to the pointer, like Pointer++ it advances the pointer to the next part in memory of that type. So adding 1 to that actually advances 62 memory spots because that struct is 62 bytes big.

Now load up a saved game file. All kinds of crap in a byte stream.

memcpy(Pointer, sizeof(myStruct) * 5);

It loads directly from the file (which is just an array of bytes) directly into the structures. And it works just fine. In any other language, you have to copy each individual element from the file to the structure, since they don't allow pointers to do things in bulk. Pointers are much faster. That gives you the power of a pointer, and why games are made in C++.

I thought this was basically what the Serialize (or something like that) interface is in various languages. Java, for instance, will do this for you on any class that you like.

Edit: I don't know anything about .NET -- does it have serialize?

It sure does.

You even have the option of creating your own formatting class in case you don't want to use the built-in XML or Binary formatting. In fact, it's one of the ways to do remoting in .NET. Use a BinaryFormatter and serialize your objects to your network stream.

It's not nearly as simple as what brandonb is talking about, but it sure has a lot of flexibility :)