PDA

View Full Version : My Pong



Bijo
03-06-2007, 03:29 AM
Hello there, PGD-goers.


I'm sick and tired of my text adventure and haven't coded anything in Pascal for a little while now (though I've been checking out Modula-2 and man, ain't it a pain to use forced case-sensivity).

So I'm gonna go back at it! I fear I might lose the touch with writing code and such so I should get moving and start this damn thing! :)

What do you think of my little plan here: http://img529.imageshack.us/img529/4088/bijopongjg0.th.jpg (http://img529.imageshack.us/my.php?image=bijopongjg0.jpg)

The representation therein is a spin-off of my first on paper. With this one I just went crazy :clown: (Paint is really a piece of trash by the way.)

(I don't know why and how, but the visual quality of that picture is diminished when uploaded.)


EDIT: as for my question: is that scheme any good?

pstudio
03-06-2007, 11:55 AM
Your scheme is a bit messy to look at, but it seems to me that there is some idea in it.
I believe you know exactly what's going on in the diagram. so you should be good to go.

Know my qusetion is: What's a sneaky move in Pong? ;)

About the quality of your image. I wouldn't recommend you saving images as jpg in Paint (Paint is an excellent programm btw). The quality sucks when you save a bitmap as jpg. Use PNG instead or some other graphics program.

Huehnerschaender
03-06-2007, 12:04 PM
I still wonder why you are going to make a game using graphics.pas or other DOS units. Is there a particular reason for this? I mean, even if you are beginner and just try to learn, you should better use "uptodate" interfaces and make a simple game. But you will learn the basics of "modern" gameprogramming from the beginning. A DOS game which just runs in a "while" statement will not help you learning gameprogramming in OpenGL or DirectX anyway.

Away from that, your scheme seems a little messy to me, too. You should take a look at some standards if you really want to use graphical schemes. It will bring absolutely no benefit if you are the only one who can read/understand your scheme :)

Greetings,
Dirk

Bijo
03-06-2007, 12:12 PM
Know my qusetion is: What's a sneaky move in Pong? ;)


Heh heh, I was thinking of that as something like: check_playerpos; check_ballpos; calc_unexpected; goto_ball_irregularly; hit_ball ---> confuse player to make better game :)

But it sounds a bit too much.



EDIT: here's my simpel text game, btw, if anyone wants to see (http://files.filefront.com//;7680563;;/ ). It contains some a little strong language here and there. Not so much.

pstudio
03-06-2007, 02:26 PM
Just tried it out a bit


Arrgh: missed!
He missed!
Your shot misses!
He missed!
You missed, come on!
He missed!
You missed, come on!
He missed!
You took a shot and hit 'im!
He has 0 HP left.
He missed!
You wasted him!
You found an item! A healing potion.
What's the point about all those misses? It wouldn't hurt if the player and enemy hit each other more often than every 5th time ;)
And it seems that you have made the mistake to code player attack, then enemy attack withouth checking inbetween if anybody had die. This means that even do the enemy has just lost his last hitpoints he can still attack for one round :?

The game isn't really my type. It doesn't mean it's bad. I just got bored of reading all the story since I wasn't in the mood for reading a complete novel :P

It's clear you want to start from the beginning and I wish you luck. I love dosgames so make some fun stuff and I'll play them :)

Bijo
03-06-2007, 02:45 PM
Just tried it out a bit


Arrgh: missed!
He missed!
Your shot misses!
He missed!
You missed, come on!
He missed!
You missed, come on!
He missed!
You took a shot and hit 'im!
He has 0 HP left.
He missed!
You wasted him!
You found an item! A healing potion.
And it seems that you have made the mistake to code player attack, then enemy attack withouth checking inbetween if anybody had die. This means that even do the enemy has just lost his last hitpoints he can still attack for one round :?
You're right: I did do that. At the time I was too lazy to redo it, so I left it, but to quickly... "correct" it I included in the story afterwards that the player says something like "He even tried to shoot at me while he was going down!" heh heh :D




It's clear you want to start from the beginning and I wish you luck. I love dosgames so make some fun stuff and I'll play them :)
Thank you :) I'm putting my Pong idea to rest for now and will do it another time, because I think I need something even simpler (or maybe I just need more rest), 'cause it looks like I just can't start coding away. Maybe programming just isn't my thing.

The simpler game is an old DOS game I played as a kid. It was a bowling game where on the right side you had a couple of ASCII bowling pins, and on the left side a bowling ball moving up and down. The player had to press the key at the right moment to throw (and then probably a randomizer was used upon hit, and maybe during ball travel).

pstudio
03-06-2007, 07:15 PM
The bowling game should be relative easy to make, but I would say the same thing about a pong game.
Perhaps you're making things to complicated. A typical mistake for programmers (not only beginners) is to be too ambigious (spelling?) when starting on a new game. If you started with some small steps, I think you would have a playable Pong game in no time.
If you just started making the ball move on the screen and bounce on the wall you're already half done with the game. Then you could add some player controlled bars in each side and in the end make on of the bars be controlled by the computer. In no time you'll have a Pong game done.
An other advantage with making small steps to complete is, that you will feel a certain succes factor, every time you complete such a step. This will motivate you to continue developing.

Research has shown, that a project usally will be more succesfull if the development has been split into small goals, rather than just one big end point.

It's you're choice if you want to make a bowling game or whatever. Just split your game develpoment into small achievable goals and I guarentee it will be a lot easier.

Bijo
03-06-2007, 08:41 PM
Heh heh, you say it like it's so easy :) I can't help but think of the following.


In a Win32 "DOS-like" setting I might use a 2D array of 80 by 50 (or crt with gotoxy, and simple colors) to represent the screen. But to have a ball move around depending on the cursor position would not cut it, 'cause I foresee the flow'd be ugly. It's like having only few block positions where characters can be, instead of many pixels to smooth things out.

*

For Pong (regardless of what library I use) I'd probably start the program by making a loop that quits when the player presses Escape so I'd have to register that.

But if I'm going to rely on the standard units, I foresee trouble. The keyboard unit is a bit tedious. I've been looking through the RTL .pdf, and it's just.... bah! Not to even mention graph.

I've seen that SDL is very popular and (from what I've heard) easy. I've only used Allegro before with C++ but not so long. Do you think using JEDI-SDL's a good idea?

*

During the game loop a simple ball bitmap I made would have to bounce on-screen. I'd have to use double buffering to avoid flickering probably, maybe with pointers?

Perhaps I should have a look at JEDI-SDL, or one of the others. Too bad there are no good SDL tutorials for Pascal. I'd have to translate C/C++ code (...again): :shock:


EDIT: but maybe there are good tutorials I just don't know of.

Huehnerschaender
03-06-2007, 09:01 PM
If you are aiming on 2D games, then I can advise to take a look at Apshyre 3.1 component set for Delphi. It is the best 2D DirectX framework I know. You can find it at http://www.afterwarp.net and there are many many demo sources on the forums.

pstudio
03-06-2007, 09:26 PM
True, Asphyre is great, but make sure to get 3.1 and not a 4.X snapshot.
The only problem with Asphyre is lack of documentation, but there's a forum at afterwarp and naturally there's PGD :D

I haven't tried SDL out yet, but it most be good at something, cause the other guys are always talking about it ;)

Bijo
03-06-2007, 09:37 PM
According to the FAQ FPC isn't supported :?: But it doesn't make sense to me (but I'm probably overlooking something): I thought FPC could handle Delphi code. What can you tell me about it?


Any other suggestions? I've been lookin' around a bit, and I've been considering using (I should actually say learning, heh heh) OpenGL for 2D (http://www.freepascal.org/packages/opengl.html). But from what I understand OpenGL only handles graphics, is that correct? And maybe it's too difficult.

Otherwise I might give JEDI-SDL a shot.

Huehnerschaender
03-06-2007, 09:48 PM
FPC CAN handle Delphi code.... but not in the manner of "Delphi" code, but Object Pascal code.
FPC is aiming crossplatform (Win, Unix, Linux, MaxOS etc), Delphi is not.

Asphyre is a DirectX framework. That alone is reason enough to make it unnecessary for FPC to support frameworks like Asphyre or DanJetX because they are frameworks for DirectX which is developed by Microsoft for Windows platforms :)

pstudio
03-06-2007, 10:35 PM
OpenGL is only for graphics and perhaps it would be a good idea to start with something higher level programming than that.

If you want to use FPC I suppose SDL would be a good choice, and you should be able to write OpenGl code together with SDL.

Bijo
03-06-2007, 10:54 PM
Thanks for all the information and help, guys :)


pstudio, about higher-level programming: are you saying I should go for scripting languages and such to make life easier (Python, etc.)?

I will have a go at SDL then for the time being.

wodzu
04-06-2007, 08:22 AM
True, Asphyre is great, but make sure to get 3.1 and not a 4.X snapshot.



Why not 4.X? I've never used 3.1 and I am very happy about 4.x usage.


The only problem with Asphyre is lack of documentation, but there's a forum at afterwarp and naturally there's PGD :D


Yep :cry:

Huehnerschaender
04-06-2007, 09:10 AM
True, Asphyre is great, but make sure to get 3.1 and not a 4.X snapshot.



Why not 4.X? I've never used 3.1 and I am very happy about 4.x usage.



Asphyre 3.1 is stable and supports older Delphi versions. There are tons of samples, even whole game skeletons for jump&run, RPG, and many many other things.

Asphyre 3.1 is much more easy to understand for beginners.

Asphyre 4.x is more advanced, providing really powerful features, especially in 3D. But in my opinion, for a beginner which tries to learn programming/game programming at all, this is way too much (and I guess he will not understand the whole concept/structure/usage of it at all).

pstudio
04-06-2007, 10:20 AM
True, Asphyre is great, but make sure to get 3.1 and not a 4.X snapshot.



Why not 4.X? I've never used 3.1 and I am very happy about 4.x usage.



Asphyre 3.1 is stable and supports older Delphi versions. There are tons of samples, even whole game skeletons for jump&run, RPG, and many many other things.

Asphyre 3.1 is much more easy to understand for beginners.

Asphyre 4.x is more advanced, providing really powerful features, especially in 3D. But in my opinion, for a beginner which tries to learn programming/game programming at all, this is way too much (and I guess he will not understand the whole concept/structure/usage of it at all).
Yes- that's what I would have said :D


pstudio, about higher-level programming: are you saying I should go for scripting languages and such to make life easier (Python, etc.)?
oh No - I didn't mean scripting. I meant that OpenGL is low level API. In OpenGL to draw a simple sprite, you would have to do something like defining a quad with 4 vertices and give it a texture. In libraries like Asphyre, SDL Phoenix you would typically just have a function like DrawImage(X,Y,Image);
A lot easier for a beginner. ;)