PDA

View Full Version : Multiplexity: MechaChess



3_of_8
14-02-2007, 09:59 PM
Allright, I'm gonna tell you something about our project "MechaChess". That's the working title, I think we'll figure out something better somewhen.

The game combines traditional chess with EarthSiege2-style mech combat. The game starts with chess and every time a piece tries to strike an enemy one, a battle starts. Each piece is represented by a mech whose properties and equipment (such as weapons, armor and speed) correspond to the attributes which the pieces in chess have.

In addition to that, each kind of mech has a special module which also corresponds to its chess piece attributes. The pawn gets a strafe module, the knight gets a jump/flight module, the tower gets an extra armor and so on. Of course these modules consume energy, so they can't be activated all the time.

We are trying to get the game running on three platforms: Win32, Linux and Mac.

We're working with Delphi, I'm using Delphi 7, the others use Delphi 2006, I think. We try not to use any of Delphi's standard units (except System.pas, of course ;) ) and we use OpenGL for the graphic stuff, SDL for the platform independence and Newton for realistic physical behaviour.

This is one of our most important aims: Making the whole thing realistic. Well, as realistic as a science fiction game can be. We want the mechs to walk physically correct and to be blown up physically correct.

When we got that stuff working and still have some time left, we're gonna try to put some simulation in it: The player should be able to choose weapons, armor and change the mechs configuration within some constraints. This will make the whole thing a little more flexible and add a decent strategical part.


These are my current thoughts to the project. It's definitely the largest and most difficult project I've ever been working on. At first I did not think I'd be the lead programmer, I rather thought DGL-Luke would be that. But for some reason, I am now the lead programmer and I have written some fair code in these one and a half weeks. Let's see what we can make out of that.

Thank you for reading that.

Huehnerschaender
14-02-2007, 10:27 PM
Sounds like a funny game :)

It would be awesome if you could jump into the cockpit of your mechs and steer them like vehicles (simulation part :) )...

pstudio
14-02-2007, 10:32 PM
I like the idea. It reminds me of Mortal Kombat chess, a quite fun minigame. However it didn't require much chess skill :?

Good luck with the project, so that I can start playing some Mech combat :D

jdarling
15-02-2007, 02:20 AM
Your idea sounds pretty good, unfortunately, if you use Delphi you won't get Linux or Mac support. Look into SDL and FPC/Lazarus, then you can get Linux and Mac quite easily :)

3_of_8
15-02-2007, 03:16 PM
We use SDL. And we already got it running on Linux, Mac should be no problem.

@huehnerschaender: (how did you figure out that name? :shock:)
Of course you can. You will fight the enemy mech in cockpit view. ;)

DGL-luke
15-02-2007, 05:43 PM
@jdarling: We're coding platform-independently with Newton and SDL. So in principle we should be able to just set FPC loose onto our source code in order to get linux binaries.

EDIT @huehnerschaender: You're not gonna steer them like vehicles, you're gonna steer them like Mechs ;-)
I could even imagine sitting there with two joysticks, one for the gears, one for aiming. But I'm not doing the coding work right now, so I'll better be quiet before 3_of_8 starts slapping me ;-)

WILL
15-02-2007, 06:08 PM
I've not played a Mech game since the 90s man... this'll be kind of fun for me. :)

Just too bad for you guys that I have no say in the final judgment though. ;)

Huehnerschaender
15-02-2007, 06:17 PM
sounds cool so far :)

I am very curious about your entry...

PS: Explaining my name is a long story :)

3_of_8
15-02-2007, 06:20 PM
D'oh, Luke... Now I gotta implement Joystick steering, and not only with one, but even with two of them. I don't know whether this is possible anyway... :lol:

Whatever, I gotta get that object selection stuff done first. I feel a little tired, anyone got a coffee? :?

3_of_8
16-02-2007, 07:47 PM
Alright. I have now completed the very first aim.

You can play chess. Well, kinda. You can't choose the piece for promotion (promotion is when a pawn reaches the rearmost enemy line and is exchanged to another piece), pieces are displayed as cuboids and you can only play it in "hotseat", I mean it doesn't work over LAN. But, hey, pretty good for 2 weeks, isn't it?

So here it is: The first official screenshot of MechaChess.

http://img510.imageshack.us/img510/7638/mcscreenshot1xa3.th.png (http://img510.imageshack.us/my.php?image=mcscreenshot1xa3.png)

savage
16-02-2007, 10:52 PM
Great stuff, what does the diagonal yellow line mean?

Robert Kosek
16-02-2007, 11:07 PM
Great stuff, what does the diagonal yellow line mean?Valid moves. ;) Didn't you ever play computerized chess before? The "illuminated" always mean that those are your valid moves.

3_of_8
17-02-2007, 06:16 AM
Right. If you click on a piece, the moves you can do, are allowed.

By the way, 3069 LOC so far.

Huehnerschaender
17-02-2007, 08:49 AM
The whole chess logic is ready to go?

Bah! Don't tell me again you are not that far as I am :)

DGL-luke
17-02-2007, 01:55 PM
To be honest, he had this one "prepared before", as they say in cooking shows ;-)

But yes, he's really a discovery. I think I'm gonna kidnap him and tie him to a workstation in my basement. :)

3_of_8
17-02-2007, 03:16 PM
Again, you're giving away my secrets.

Alright, I gotta concede: The chess code is from a chess project I could not finish due to problems in the network classes.

@huehnerschaender: And I'm definitely way behind your project, you just gotta take a look at the graphic: I have no idea how to get the antialiasing and particle effects done. I'm not really the one to do 3D-things, but there's noone else to do it for now.

savage
17-02-2007, 09:49 PM
Can you post a simple SDL code example that would recreate the slowness you described in Dirk's thread?

Maybe some of us can help you speed things up.

3_of_8
18-02-2007, 02:37 PM
Seems like everything was nothing but an optical illusion. FPS counter says 60 FPS all the time.

3_of_8
18-02-2007, 07:16 PM
Correction: It was not an optical illusion.

In fact the DeltaTime (the time between two rendering steps) is 7 ms in window mode and 17 ms in fullscreen mode. I have no idea why, but that's not the problem, as it still looks fluent. The real problem about it is that NewtonUpdate seems to be slower. I mean the objects fall slower.


NewtonUpdate(FNewtonWorld, DeltaTime);

DeltaTime is the time since the last call of NewtonUpdate. Is there any possible reason for this strange behaviour?

Huehnerschaender
18-02-2007, 08:23 PM
After creating Newton you should set Newtons minimum framerate (which is set to 60 by default). In my case I want Newton to update 100 frames a second. If the game runs too slow, Newton will interpolate the Newton steps to the current framerate.

So in my case (100) I call:

NewtonSetMinimumFrameRate(NewtonWorld,100);

My DeltaTime is calculated between 0 and 1, so I update Newton by calling:


NewtonUpdate(NewtonWorld,(1/100)*time_);

where time_ is my Deltatime...

As you can see, I tell Newton to update 100 frames per second, no matter what framerate I have (because I multiply by my delta)...

What you do is telling Newton it should update as fast as the current framerate is, which of course differs from PC to PC... So this is no good idea.

Try my way and tell me if it works better...

Greetings,
Dirk

3_of_8
18-02-2007, 09:43 PM
What do you mean, "bewtween 0 and 1"?

Huehnerschaender
18-02-2007, 09:45 PM
0..1 means the multiplicator of time since last frame, where 1 is one second and 0.5 is half a second, 0.25 is a quarter of a second etc....

3_of_8
18-02-2007, 09:55 PM
That doesn't work at all.


NewtonUpdate(NewtonWorld, (1/100)*(deltatime/1000));

I think that is what you were thinking of, right?

Well, that's way too slow. My objects are hanging in the air, as they should not.

Huehnerschaender
18-02-2007, 09:56 PM
deltatime / 1000?

What happens if you use just deltatime?

3_of_8
18-02-2007, 10:00 PM
Deltatime is in milliseconds.

Anyway, I tried it out. They fall faster, but still not fast enough in fullscreen mode. Which means, there is still a speed difference between low FPS and high FPS.

Sascha Willems
18-02-2007, 10:12 PM
If you want to free your physics calculation from rendering use accumulative time stepping, as it's the way to go for doing fps-independent physics. Do a search on the Newton forums, there is a thread about this topic which includes all necessary information.

I'm using that method too in my newer newton demos like the NewtonPlayGround and my physics calculation run always at the same speed no matter at what FPS the application runs at.

3_of_8
18-02-2007, 10:17 PM
Just seconds before you wrote your post, I stumbled upon this: http://walaber.com/newton_wiki/index.php?title=What_value_should_I_pass_to_%22New tonUpdate%3F

I now do it like this:

inc(FTimeSlices, DeltaTime);

while FTimeSlices>16 do
begin
NewtonUpdate(FNewtonWorld, 16/1000);
dec(FTimeSlices, 16);
end;

Works fine. Thank you two.

DGL-luke
19-02-2007, 11:57 AM
(Posting here, cause 3_of_8 isn't online on ICQ, and people might want to know in general)

If you've got your framerate stuck at 50/60/85 fps, watch out for VSync! the graphics card will then sync the render loop with the screen's frequency.

Huehnerschaender
19-02-2007, 12:35 PM
inc(FTimeSlices, DeltaTime);

while FTimeSlices>16 do
begin
NewtonUpdate(FNewtonWorld, 16/1000);
dec(FTimeSlices, 16);
end;

What happens if its not the video card which is the reason for low FPS but the processor, because your AI, pathfinding, physics etc are too complicated to achieve good results on slow CPU's?

In my opinion, your code would let the game stall very soon, because you "punish" the CPU for being slow by giving it more physics to do :)

So every cycle the CPU would call NewtonUpdate more often, which results in higher Deltatime, resulting in more NewtonUpdate-calls... is this the way to go? I don't know... just my thought... or am I wrong?

3_of_8
19-02-2007, 12:47 PM
I know what you mean.

I have no idea if this is right or not.

3_of_8
19-02-2007, 02:31 PM
Oh yeah, that's really cool:

http://img89.imageshack.us/img89/6813/screenshot2ti0.th.png (http://img89.imageshack.us/my.php?image=screenshot2ti0.png)

Note that mirroring-effect.

Huehnerschaender
19-02-2007, 02:35 PM
Hey, cool... now you just need to set transparency to the mirror effect...

then add your nice models with nice textures and there ya go :)

3_of_8
19-02-2007, 05:10 PM
You mean... like that?

http://img355.imageshack.us/img355/2140/screenshot3iy8.th.png (http://img355.imageshack.us/my.php?image=screenshot3iy8.png)

Huehnerschaender
19-02-2007, 06:19 PM
Yep! Now it looks like reflection :)

IlovePascal
19-02-2007, 10:25 PM
in your last screenshot, it seems like the reflections of the black 'units' are white... is it meant to be so?

3_of_8
19-02-2007, 11:19 PM
I think it's like this in reality, too. A gray cuboid on a white, reflecting surface is reflected more white than gray. If it's reflected on a gray surface, it seems gray.

Robert Kosek
19-02-2007, 11:21 PM
You could try drawing them with a slightly higher opacity. I'm not sure exactly why it is doing that.

3_of_8
19-02-2007, 11:30 PM
Well, atm I'm just blending it on the chessboard texture. Like this:


glBlendfunc(GL_SRC_COLOR, GL_ONE_MINUS_DST_COLOR);

Changing the Alpha value won't take any effect, cause there is no alpha value in this blending function.

Robert Kosek
19-02-2007, 11:45 PM
One minus dest color for black would return a white surface; 1-0 = 1. Unless you start doing stuff like texturing them.

3_of_8
20-02-2007, 02:33 PM
Um.... what? What shall I do?

Robert Kosek
20-02-2007, 03:14 PM
Well, have you tried GL_ONE_MINUS_SRC_COLOR or GL_DST_COLOR? I really don't know what to say since I know enough to point out the problem, just not the solution. I'm not a 3D guy either, honestly.

3_of_8
20-02-2007, 04:05 PM
That looks awful. The whole board is covered with some kind of yellow. Additive blending, I think.

Robert Kosek
20-02-2007, 04:33 PM
Well, sorry I can't be of more help. I'd say you're best off sticking with GL_ONE_MINUS_DST_COLOR as I'm not sure exactly how to help. :? Been forever and a day since I messed with OpenGL directly, and even then I wasn't particularly good at it.

Well, 'least I tried. :)

3_of_8
28-02-2007, 10:33 PM
It took some time, but here's the next screenshot, and, I have to concede I'm not particularly objective in this case, but I think it's just KICKASS.


http://upload6.postimage.org/491285/mc_screenshot_2.jpg (http://upload6.postimage.org/491285/photo_hosting.html)

savage
28-02-2007, 10:38 PM
It's coming along nicely.

3_of_8
28-02-2007, 10:41 PM
Alright. From now on, I'm no longer the lead programmer. Now I'm the steel programmer. xD

3_of_8
02-03-2007, 02:24 PM
I'm somewhat concerned about my entry not running when being judged. So, I now this is a little close in time, but would some of you please be so kind to download and test this: http://www.pascalgamedevelopment.com/competitions/2007_files/t118_2007_03_03_wup.zip

Traveler
02-03-2007, 02:57 PM
No worries :) It works just fine.

My current pc (I'm at work (or should be)) is not exactly a gaming pc, so I assume the pause after selecting a gamepiece is because of that. Other minor issues are the similarity between the pieces. After having played for a bit, it became a bit hard to see what piece was what.

Good stuff so far though!

pstudio
02-03-2007, 03:28 PM
It's hard to play chess, when all the pieces are cubes :D

But the game runs fine on my machine at work, and that computer isn't fit at all to play games, so I don't think you have to worry about your game not running when being judged.

3_of_8
02-03-2007, 04:09 PM
Well, I have no model loader so far. And the thing I concerned was not the game running to slowly but more missing DLLs/textures/whatever or other things.

Thank you for testing.

By the way, this is not the latest version. The actual version shows a landscape rendered from a heightmap, so you can't do anything there apart from moving around, so I uploaded the older version.

Sascha Willems
02-03-2007, 05:34 PM
Runs fine on my system here at 500 to 700 fps with enabled AA and AF. Seletcing the "figures" and moving them also works fine.

WILL
02-03-2007, 05:47 PM
Runs fairly well on a P4 3.06HT w/ 1GB RAM and Geforce 6200

Huehnerschaender
02-03-2007, 07:12 PM
Running smoothly on my machine. No problems found.

DGL-luke
24-03-2007, 11:26 PM
Introducing the "Long night of Coding".

Goals:

- make a rudimentary AI - 5%
- enable the player to shoot 50%
- do it before 5am GMT+1 25%

3_of_8
25-03-2007, 12:44 AM
Supplement:
MacGyvering an entry which is not too bad: 95%
Get some sleep: 0%
Close the window before I freeze to death: 0%
Not getting a tendovaginitis: 0%

DGL-luke
25-03-2007, 07:17 AM
OK... we did submit an entry, but 3_of_8's and my opinions wether it would meet criteria seem to differ a bit.

WILL
25-03-2007, 07:27 AM
Just curious... was mech mode supposed to work?

I got an early jump on checking them out and when I ran it and hit F9 to go into mech mode, it crashed on me. :?

http://upload7.postimage.org/373733/mc_mechmode_crash.jpg (http://upload7.postimage.org/373733/photo_hosting.html)

3_of_8
25-03-2007, 10:31 AM
Argh, D'oh!

Of course it was supposed to work. It works here... crap...

3_of_8
25-03-2007, 10:37 AM
Okay, fixed. I'm so mind-bogglingly stupid. I forget to upload the bloody heightmap. Here's the link: http://baaa.ba.funpic.de/upl/file.php?file=2c445d9ae6f0b6f79c23ec677c3dac87

Just put it into the game directory.

WILL
26-03-2007, 02:45 PM
Yup, that fixed it.

Not bad so far. I'd like to see how the mech mode will perform with a full blown mech with missiles and explosions. :D

3_of_8
26-03-2007, 08:04 PM
Me too. Most of all I'd like to know how to code that. :?