PDA

View Full Version : Momen 3d



Ñuño Martínez
31-03-2012, 11:46 AM
Finally, I decided to rescue an old project of mine: a 3D space shooter but in the style of Xenon, Turrican and Nemesis/Gladius.

Now I'm finishing the dirty 3D engine I started few days ago. Yesterday I wrote this (http://www.pascalgamedevelopment.com/showthread.php?13192-Article-2nd-PGD-Challenge-The-Journey&p=83650&viewfull=1#post83650):


... a dirty&simple 3D engine to show you what you can do with latest Allegro.pas.
https://p.twimg.com/ApPZji5CEAAIyBG.png It isn't very spectacular but now I can "easily" manage cameras, lights, fog, skybox and materials. Of course it needs model and map loaders but the hardest was done yet.

This morning I did some cleaning and added an octree structure:
https://p.twimg.com/ApT_M7xCQAExwQ7.png
At the moment I'll not do frustum culling but I'll add a distance culling, if the nearest vertex of a node is farther than <d> then it doesn't renders it nor their child nodes. I'll use it for collisions also.

[edit]

If you have Twitter, I'm using the #2PGDchallenge (https://twitter.com/#!/search/realtime/%232PGDchallenge) hashtag.

WILL
01-04-2012, 06:29 PM
I like the misty space dust scene. :) Should be interesting to see a 3D game made with Allegro.pas.

BTW, why not tweet in both English and Spanish? It'd double your interest from English readers. :)

So the idea is that you will warp to other locations? Will the game be open sandbox or scripted missions?

Ñuño Martínez
01-04-2012, 11:54 PM
I was busy implementing model loaders and doing testing and so. Also I was thinking about how the game will be and it will be a bit different than I initially imagined. It will be similar to the "Roge Squadron" and "Wing Commander" series but with some bits of Gladius/Nemesis and/or Xenon. I mean I'll try to do it more arcade and less simulation, including those "pills" or "expansions" that appears after destroying an enemy... And may be final bosses too.

The background of the above screen-shots is a skybox I found at Open Game Art (http://opengameart.org/content/interstellar-skybox). Also the scene has a nice green fog that integrates the objects with the background despite they're pure red cubes.

Today I've recruited a graphic designer (not professional), so I will have more time to code. :)


So the idea is that you will warp to other locations? Will the game be open sandbox or scripted missions? The game will have scripted missions.

Initially it will be two missions: the training and the first mission. As the player complete missions more one will appear "connected". Some times the player will be forced to an specific mission or may be he/she will be able to decide, and may be the decision will affect which missions will be unlocked. May be if the player doesn't succeed new missions would appear (and those missions will disappear if he/she repeat and succeed).

As I've said, similar than "Roge Squadron" and "Wing Commander".

At the moment I'm coding it as a "concept-test". The engine is very simple and I'm sure I can improve it a lot, but not now. Now I want to focus in the game. Actually the game engine was "finished" yesterday but it hasn't a model loader. Tomorrow I can start coding the game itself.


BTW, why not tweet in both English and Spanish? It'd double your interest from English readers. :) I don't tweet a lot, so I'll try to do it. :)

Ñuño Martínez
02-04-2012, 04:33 PM
Last engine testing image. Next one will be in-game (I hope :)):

http://img189.imageshack.us/img189/204/pantallazo03.png

The ship is a Wavefront model so now I can use models.

Ñuño Martínez
08-04-2012, 12:32 PM
I haven't work a lot on the project the last days due to familiar issues, but I did something. Now the game framework is almost complete (the previous one was the "3D engine framework" which is a bit different) by hacking some classes from my KOFFE and "Duke of Dragonfear" projects. So now it creates an empty space and renders it. Much like the engine testing program but better organized (I hope).

Oh, and it creates a log file (can be disabled by configuration):

vvvvvvvvvvvvvvvv
Init log file...
Level -> 2
WARNING: debug_level configuration is forced for debugging. Change this before beta release.
WARNING: FullScreen configuration modified for debugging. Change this before beta release.
Initialising system...
Initialising Allegro5...
Creating Display...
Setting display options...
Creating display...
Hideing the mouse cursor.
Setting Ortho mode...[Ok]
Display created [OK]
System initialised.

Creating test flight universe...
Creating the Universe...[Ok]
Loading models...
Loading Wavefront model "./data/navecilla.obj"...[Ok]
Models loaded.
Populating the Universe...[Ok]
Adding a test camera. MUST BE REMOVED.
Created.

>>> Starts flight.
>>> MainLoop starts...
Esc key pressed.
WARNING: Remove Esc key response from MainLoop procedure!!!!
<<< MainLoop ends...
<<< Ends flight.

Destroying flight resources...[Ok]
Releasing global stuff...[Ok]


Actually it helped me to organize the code and find some glitches... :-[

Also I've described the missions to be completed. Initially there are 12 missions but may be not all them will be included in my entry. Time is short.

Ñuño Martínez
11-04-2012, 12:41 PM
http://www.youtube.com/watch?v=Mou1ihyLEiU
Here you have the player ship motion.

I'm a little late, but it's not a big trouble. If I can make the basic collision system today I'll be almost in time.

Cybermonkey
11-04-2012, 02:37 PM
Cool! I am looking forward to Allegro.pas 5 ;)

de_jean_7777
11-04-2012, 07:31 PM
That looks cool. Nice work. For small objects you can make a sphere or bounding box collision detection. As for the big ships I don't know.

User137
12-04-2012, 05:46 AM
Small ship to big ship can be done with sphere to triangle-mesh collision. At least my nxPascal can calculate nearest point on a model and a normal at that point. You may use the information for collision.

Big ship to big ship might need triangle to triangle collision, which might be much harder to implement, and slower.
edit: Actually vertex to triangle would be enough in most cases. Just don't have the polygons so big that ship section could pass through them.

Jimmy Valavanis
12-04-2012, 06:15 AM
Mayby can be used ellipsoids for easy collision detection of large ships ?

Eric
12-04-2012, 06:48 AM
Nice start.

I too would say not to worry too much about accurate collisions for the challenge, as this can be a time-waster in ho-so-many many ways, go with ellipsoids ;-)

Ñuño Martínez
12-04-2012, 08:58 PM
I did a basic collision system. It uses both bounding sphere and bounding box and you can select one or another as your wish. I've also fixed some of my Math3D unit functions (for example, it didn't normalized vectors correctly and it did draw stars instead of spheres) and now the octree is updated when you move objects.

http://www.youtube.com/watch?v=1jYkUzkB0PQ As you see I've also changed the camera motion.

Now the game engine is almost complete. If I can add an height-map scenery object and the mission loader then I'll be "on time".

Right now I don't know how I'll do the HUD, and game needs some kind of radar system because it's hard to find the objectives. :S

Ñuño Martínez
13-04-2012, 06:07 PM
Easy work but a lot of things done. Moved some stuff from an unit to another unit, fixing some bad-desinged stuff...

Now I can shoot small icy cubes. Also I've found an old utility I did to create landscapes. It was written in C and it generates nice sceneries like this:
https://p.twimg.com/AqXIgy0CQAE-4sB.png
This week-end I'll add an height-map object for the "planet missions" and create the first AI-ships. 8)

And I've post my advances here (https://twitter.com/#!/search/realtime/%232PGDchallenge) too, as Will suggested. :)

paul_nicholls
13-04-2012, 10:30 PM
Very very nice work :D

Ñuño Martínez
16-04-2012, 11:38 AM
Thanks Paul. :)

I've lost the week-end with a height-map system. The problem was that I tried to link it with the octree and use the octree for culling and collision, but I did something wrong because it wasn't works. Finally I changed my mind and now it worked:
https://p.twimg.com/AqmTCY2CAAEGeqQ.png
Also I've discovered that maps created by my plasma program didn't look nice in 3D, but that doesn't bother me ATM.

So I'm again out-of-time. :( BTW there are a few things to do before to start the gameplay itself: 2D sprites (for explosions, smoke...) and write text on screen (for GUI, scoring...).

paul_nicholls
16-04-2012, 12:52 PM
I think the plasma still looks good in the screenshot and I really love the planet in the background :)

Ñuño Martínez
16-04-2012, 05:15 PM
Actually the landscape of the screenshot wasn't created by my plasma program. I found it on the Internet a lot of years ago in Geocities (IIRC) so I can't give the actual credits for it. :-[

BTW I've found that I can use my plasma to create a rough terrain description and then use The Gimp to fix the height-map layer.

Ingemar
16-04-2012, 06:05 PM
I think the plasma still looks good in the screenshot and I really love the planet in the background :)

I am more interested in the terrain, but the skybox is nice too. And skyboxes aren't very easy to make. I tried making some for the previous challenge, but ended up using an existing one that didn't have any visible seams at the edges.

Ñuño Martínez
17-04-2012, 07:19 PM
Today I've added an "Explosion object" and some sound. Also I've compiled and tested it on Windows (I was coding on Linux) and it runs reasonably fast in my old PentiumIV, since I didn't optimized anything from the engine (except the octree for objects, and I think I can do it "better") and I forget to use -O3! So once I optimize the engine may be you can play in a PentiumIII...

Then I did some cleaning on my code so tomorrow I'll start with the "mission description" and AI. So two weeks to code the UI and create the game missions. Not bad. 8)


I am more interested in the terrain, but the skybox is nice too. And skyboxes aren't very easy to make. I tried making some for the previous challenge, but ended up using an existing one that didn't have any visible seams at the edges. The problem with skyboxes is to create the texture. Render it is quite easy. I just draw a 10x10x10 cube with rotation and no translation (and no Z-Buffer, no fog, etc).

If you have problems with it, I can post the code here. :)

Ñuño Martínez
18-04-2012, 05:09 PM
I've used GW-BASIC to study an algorithm I've stolen from Shawn Hargreaves' Marauder (http://www.shawnhargreaves.com/marauder/). BTW Marauder is written in C++. This disqualifies me from the competition? ::)

https://p.twimg.com/AqxqNQICMAAq08N.png:large

Ingemar
18-04-2012, 06:53 PM
The problem with skyboxes is to create the texture. Render it is quite easy. I just draw a 10x10x10 cube with rotation and no translation (and no Z-Buffer, no fog, etc).

Absolutely. The code is no problem, but you can't draw a skybox by hand.

paul_nicholls
18-04-2012, 08:49 PM
I've used GW-BASIC to study an algorithm I've stolen from Shawn Hargreaves' Marauder (http://www.shawnhargreaves.com/marauder/). BTW Marauder is written in C++. This disqualifies me from the competition? ::)

Not as long as you rewrite it in Pascal :)

Ñuño Martínez
18-04-2012, 09:02 PM
Not as long as you rewrite it in Pascal :) I hope, because it was a hard work to port it from "screen space" (used by Shawn's game) to "OpenGL space".

Now I have an autopilot that forces every ship (including playership) to stay in the battlezone. So, you can't run out of the problems. :D

Ñuño Martínez
18-04-2012, 09:05 PM
Absolutely. The code is no problem, but you can't draw a skybox by hand. That's why I use the ones I've found at Open Game Art website. :)

WILL
19-04-2012, 03:50 AM
Lookin' good Nuno! This work impresses me since before I've only seen game library stuff from you for the most part. Nice to see quality game dev, and resourceful stuff too.

And no, porting C++ to Object Pascal is perfectly legit. ;)

Ingemar
20-04-2012, 07:43 AM
And no, porting C++ to Object Pascal is perfectly legit. ;)

I would call that "code improvement" or something like that. Sanitizing C++ code.

Ñuño Martínez
21-04-2012, 05:47 PM
Had some troubles but finally the game itself is finished so I started with the mission design. Here you have a view of the "Briefing Mission" screen:
https://p.twimg.com/ArBdVzGCIAEHS7S.png:large
The problem here is that Allegro's text drawing procedures corrupts the stack so I can't use them; note that I'm using last SVN-Work In Progress Allegro.pas. I had to create my own text drawing procedures. 8)


I would call that "code improvement" or something like that. Sanitizing C++ code.
Just what I said... :D

WILL
21-04-2012, 07:46 PM
Very cool! Could use a bit more variety of colour, but the design is more important than the appearance first off.

Ñuño Martínez
25-04-2012, 10:44 AM
A lot of things done, but there's a lot of things that should be done.

For example, I'm having problems because the engine isn't well designed (as I said, it's a dirty engine ;) ) so it needs to be refactored (is it the correct spelling? ::)) but obviously I have no time now. Anyway I'm happy with the results and I've learned a lot.

A big trouble is that I can't make it run in Windows. I'm sure the problem is my Allegro's to Pascal wrapper, but I can't fix it now. :( Anyway Linux can deal with it (which makes the Windows issues more bizarre).

Here you have a solo fighting. You can see the title screen, the AI in action, the radar and the targeting device, which makes things a lot easer.

http://www.youtube.com/watch?v=dWQ1ue4mIM0

paul_nicholls
25-04-2012, 09:04 PM
Looks awesome mate! Well done :)

Ñuño Martínez
25-04-2012, 09:32 PM
Thanks Paul. I must confess that I was fired few months ago, the company was "bankrupted" (not sure if it's that the phrase), so I have all the time for this project, +10hours per day.

BTW I'm having a lot of "signal SIGSEV, segmentation fault" errors randomly. I've lost time tying to fix it using CONST parameters and seems to work, but may be there's a problem with the object management in the engine.

Tomorrow I'll start with the definitive gameplay (I hope ::)), creating the definitive maps.

Ingemar
26-04-2012, 08:12 AM
Thanks Paul. I must confess that I was fired few months ago, the company was "bankrupted" (not sure if it's that the phrase), so I have all the time for this project, +10hours per day.

Losing the job is not fun, but it does give you an edge here - and maybe even an extra incentive to do something really nice. What we have seen looks promising, but figuring out crashes can be time consuming.

Ñuño Martínez
28-04-2012, 10:34 AM
Game is complete. Now I'm designing the missions. :)

https://p.twimg.com/Arj8P4nCQAExDTt.png
I added the "shield" and give 3 lives to make it less hard. Unfortunately I'll have no time to calibrate the "difficulty level". Also I haven't time to add the "expansion capsules" (extra weapons, extra shield, extra extra...). ::)

The game has a lot of "green" so I added some "blue" and "red" on the "Victory" and "Game Over" screens. They're really ugly. >:(


Losing the job is not fun, but it does give you an edge here - and maybe even an extra incentive to do something really nice. Yes, it is. :)

WILL
28-04-2012, 10:08 PM
Great work Ñuño! Don't forget to upload it when you are done. :)

Ñuño Martínez
29-04-2012, 10:34 PM
I did uploaded the game just now and I'm exhausted :S. Tomorrow I'll try to write something more.

WILL
30-04-2012, 03:29 AM
Yeah, it's only 9:28pm here in good ole' Alberta, Canada. And I'll be watching Celebrity Apprintace so I'll probably loose track of time and forget to turn off the FTP at midnight or even later tomorrow. *shrug* I'm just guessing. ::)

Ñuño Martínez
01-05-2012, 01:15 PM
Ok, you win. I've revised the game a bit and uploaded a new version with (more) cheats and few more levels.

AFAIK it's not possible to complete the game without cheat. I have no more time so I can't fix this. Anyway I think it's a great game, and better with the wonderful 3D models created by Rubén. :)
849850

Now I'll rest a bit more, and I have work to do, but I think I should finish this game.8)

WILL
01-05-2012, 10:13 PM
It's so hard to keep up with you guys sometimes. "No thanks", "ok you gotcha buckaroo!" *shrug* I guess the end result is ultimately screenshots. ;)

Nice work Ñuño! I think it would be pretty neat if you had more time to continue working on it and I hope you finish it. Too few game projects mentioned around here on a game dev site. lol

paul_nicholls
02-05-2012, 03:48 AM
Ok, you win. I've revised the game a bit and uploaded a new version with (more) cheats and few more levels.

AFAIK it's not possible to complete the game without cheat. I have no more time so I can't fix this. Anyway I think it's a great game, and better with the wonderful 3D models created by Rubén. :)
849850

Now I'll rest a bit more, and I have work to do, but I think I should finish this game.8)

Wow! that looks awesome mate! well done :)

Ñuño Martínez
02-05-2012, 05:43 PM
Thanks Paul. :)

But I have a problem. I've updated my Xubuntu to 12.04 and everything stops working correctly. So I can't do anything until I find what's wrong. :(

paul_nicholls
02-05-2012, 10:22 PM
Thanks Paul. :)

But I have a problem. I've updated my Xubuntu to 12.04 and everything stops working correctly. So I can't do anything until I find what's wrong. :(

major bummer dude!

de_jean_7777
03-05-2012, 08:19 AM
Thanks Paul. :)

But I have a problem. I've updated my Xubuntu to 12.04 and everything stops working correctly. So I can't do anything until I find what's wrong. :(

Sorry to hear that. I usually end up with problems when I upgrade my Fedora too. Hopefully you'll fix this soon.

Tried your game, and it's awesome. Except the part I can't shoot anything, either because it's hard to target, or actually see a dark enemy on the dark background :D The game is impossible to play without cheats, which I had to dig up from the source code. Other than that, this is very impressive.

Cybermonkey
03-05-2012, 08:40 AM
But I have a problem. I've updated my Xubuntu to 12.04 and everything stops working correctly. So I can't do anything until I find what's wrong. :(

Everything means everything? Or just the Allegro/FPC part? I usually don't use the update but do a new install. So I've installed Xubuntu 12.04 a few days ago and everything works perfectly.

Ñuño Martínez
04-05-2012, 12:05 AM
major bummer dude!


Everything means everything? Or just the Allegro/FPC part? I usually don't use the update but do a new install. So I've installed Xubuntu 12.04 a few days ago and everything works perfectly.

Initially it was "almost everything" because graphics drivers weren't installed correctly. When I fix that it worked, except most of the Allegro.pas Version 5 stuff (version 4 works perfectly though). There are some glitches with Allegro.pas 5 that I can't see and I must fix them. :(


Tried your game, and it's awesome. Except the part I can't shoot anything, either because it's hard to target, or actually see a dark enemy on the dark background :D The game is impossible to play without cheats, which I had to dig up from the source code. Other than that, this is very impressive. Glad to know it works in other computers.

I know, dark enemy on dark bacground is evil, but I have the same problem with Roge Squadron , Wing Commander and Vega Strike. ::) But painting starships in wright-green or electric-blue...

I know also that AI is bad, but it isn't unbeatable. You need a lot of practise, of course, but it's possible. I hope it will be better when I finish it.

de_jean_7777
04-05-2012, 07:21 AM
Glad to know it works in other computers.


If you're interested, it's an i3 540, 4 GB DDR3, a Fedora 16 with open source nouveau drivers ona GF210 graphics card. It's a fresh install. I'll try the game home too, I wanted to play it for a bit and see if I can pass at least one or two levels without cheating :D.


I know, dark enemy on dark bacground is evil, but I have the same problem with Roge Squadron , Wing Commander and Vega Strike. ::) But painting starships in wright-green or electric-blue...

No need to paint them, but some indicators would be nice. Like in freelancer for example, there were these red indicators for the targeted enemy (a square of sorts on the HUD), and a motion adjusted indicator where you should shoot to hit that enemy, which made things a lot easier. A lot of the games of similar type I played used the same indicator mechanism.



I know also that AI is bad, but it isn't unbeatable. You need a lot of practise, of course, but it's possible. I hope it will be better when I finish it.
I'm quite sure it will be better. A good AI is not easy.

WILL
04-05-2012, 08:06 PM
Hey whatever happened to Video "[3]"? :)

Ñuño Martínez
06-05-2012, 02:34 PM
No need to paint them, but some indicators would be nice. Like in freelancer for example, there were these red indicators for the targeted enemy (a square of sorts on the HUD), and a motion adjusted indicator where you should shoot to hit that enemy, which made things a lot easier. A lot of the games of similar type I played used the same indicator mechanism. That's not a bad idea. Actually I play a lot with old Microprose's F-19 that has that HUD indicators.


Hey whatever happened to Video "[3]"? :)Er... I don't know what are you talking about... ::):D

I've found it!

https://www.youtube.com/watch?v=BjOevZqi09c&feature=g-upl

And here you have one with Ruben's 3D models: video [5] :)

http://www.youtube.com/watch?v=LYPHFHZclCQ


BTW, if judges can't run my entry (SIGSEGV or that), I've found that it only hapens with the "release" version of Allegro, but using the "debugging" version of Allegro it is more stable. Unfortunately it's necessary to make a modification in one file of Allegro.pas (or use the latest SVN), and recompile with "-g -dDEBUGMODE".