Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Top Down Faux 3d Engine Constrctn

(459 views • 26 replies)

This topic is 1 page long.

<< < > >>
None

KaynSlamdyke

Reply To Post Reply & Quote

Posted at: 10/14/06 07:43 PM

KaynSlamdyke LIGHT LEVEL 15

Sign-Up: 06/25/04

Posts: 4,144

Been a while since I did any semi decent AS coding. And it still is.

Lookit what I've made...Arrow keys to move in an 8-Way direction for now

Okay. My brain's not currently working, so I'd like people's input about now for an engine I'm making. As you should be seeing, it's a top down engine in the style of the original GTA games.

Rather than copy and paste the code (which would be pointless), I'll go through the steps I've done to make this.

Upon loading, it kicks off the Graphic Engine Start Function (was feeling bad with names)
- It spawns the red row (drag item out of library through linkage, give it a name and a depth) of dots along the screen according to locations stored in an array
- It then spawns the pink row of dots at the same place, but thier proportionate x and y to the blue dot (player) are scaled by how many stories it should be up (also stored in an array - it's faux Z value)

Then it kicks off the Refresh Graphic Engine Function as an Interval every 100ms.
- It then draws a line between the red and pink dot in a blank "Building" movieclip. So I know that it's working. And indeed it does.
- The roof information is stored in an array of integers. The numbers in the array correspond to the names of the spawned dots (so 0 is pinkdot0, 1 is pinkdot1, etc). Starting at the first item of the roof array, it draws a line from it's last item to the current item. If the current item happens to be -1 it closes the fill, and then jumps to the next point and opens a new fill. So far, so good
- Then it starts to draw in the walls. And this is where I'm having issues. It does this in a similar fashion - it draws them in by reading from two arrays of numbers (lets call them A and B) and draws a quad from pinkA to pinkB to redB to redA back to pinkA. This is all drawn in a blank "wall" movieclip.
- When the function next is called by the interval, the wall, building and roof movieclip contents are erased, so that they can be redrawn

Problems I've got
- Thanks to the way it just reads through the arrays for building walls, there is no actual Z-Buffer. All the walls are drawn in order, and that becomes a problem when you want to go up. I've had the colours of the walls drawn so that there's a sunrise lighting just to show what I mean - the walls seem to be going through each other in escherean fashion
- Solid colour bites. Eventually (after solving the above problem so that the walls with thier backs to the screen *don't* render) I'd like to fill them with bitmap fills that are distorted to the right size. Is this one a pipe dream? I think I've seen 3d engines do it before, and would like to know how I can do this myself
- Currently it scrolls by the actual world moving under the player and not the other way around. I'm not sure how the VCAM would mess up my engine as it currently stands, but I would like to know other people's thoughts of scrolling. I'm pretty sure making the entire world move just for the blob in the center is overkill...
- There's just too much data already. Those seven buildings comprise of 3 arrays of 27 points (X, Y, and Height), and three exceptionally long arrays (one for the roof, two for the walls) - making an entire city this way is going to kill me. Can anyone think of a way I'm going to be able to trim this down?

Your thoughts are always valued

- Kayn Slamdyke (KSd) - Motorcycle Moderator [[892646]]


None

XBigTK13X

Reply To Post Reply & Quote

Posted at: 10/14/06 07:48 PM

XBigTK13X LIGHT LEVEL 26

Sign-Up: 08/04/05

Posts: 349

Firstly, doing this sort of thing with ActionScipt just doesn't make any sense. Its not nearly powerful enough to handle any "real" 3D applications. I suggest using a better language such as C++ (I don't want to start a flame war, I love AS as much as anyone else here, but we all know its not very powerful ^_^.)


None

KaynSlamdyke

Reply To Post Reply & Quote

Posted at: 10/14/06 07:50 PM

KaynSlamdyke LIGHT LEVEL 15

Sign-Up: 06/25/04

Posts: 4,144

At 10/14/06 07:48 PM, XBigTK13X wrote: I suggest using a better language such as C++

Show me a C++ compiler that creates SWFs I can upload to Newgrounds and use to make web games and I'll take your advice seriously. Until then, understand that some people have done far more impressive things with 3d than I have with Flash alone...

- Kayn Slamdyke (KSd) - Motorcycle Moderator [[892646]]


None

BlackmarketKraig

Reply To Post Reply & Quote

Posted at: 10/14/06 07:52 PM

BlackmarketKraig NEUTRAL LEVEL 29

Sign-Up: 12/08/04

Posts: 6,373

I don't know much about AS, but I do know that that engine is pretty kickass. Well done.

: [ fl ] : + : [ art ] : + : [ dA ] : + : [ ms ] : + : [ <3 ] :
. l . o . v . e .

BBS Signature

None

bladerunner627

Reply To Post Reply & Quote

Posted at: 10/14/06 07:57 PM

bladerunner627 LIGHT LEVEL 03

Sign-Up: 10/18/03

Posts: 192

At 10/14/06 07:48 PM, XBigTK13X wrote: Firstly, doing this sort of thing with ActionScipt just doesn't make any sense. Its not nearly powerful enough to handle any "real" 3D applications. I suggest using a better language such as C++ (I don't want to start a flame war, I love AS as much as anyone else here, but we all know its not very powerful ^_^.)

Umm sir....I think he knows that, but making 3D stuff in Flash is a huge learning experience. Your practicaly designing your own rendering library. Yea, he could of done a few lines of code in OpenGL, but it's just not the same....and who the hell doesn't like playing a 3D game made in Flash buddy. It's Newgrounds! Sheeesssh..


None

KaynSlamdyke

Reply To Post Reply & Quote

Posted at: 10/14/06 08:07 PM

KaynSlamdyke LIGHT LEVEL 15

Sign-Up: 06/25/04

Posts: 4,144

At 10/14/06 07:52 PM, BlackmarketKraig wrote: I don't know much about AS, but I do know that that engine is pretty kickass. Well done.
At 10/14/06 07:57 PM, bladerunner627 wrote: and who the hell doesn't like playing a 3D game made in Flash buddy. It's Newgrounds! Sheeesssh..

Thanks for the support guys. Say hello to Thank-you credits should this game actually get finalised.

Solved problem #1. Naturally if I can ask certain walls to be of certain colours, I can have them individually turned off. Since no wall facing south will render if the player is north of it, it was a simple matter of making sure it drew no south walls that were below the player - and equivalents for every other direction. Whilst this'll make buildings that don't work in cardinal directions a pain, I can live with it...

REALLY want #2 sorted though...

- Kayn Slamdyke (KSd) - Motorcycle Moderator [[892646]]


None

jmtb02

Reply To Post Reply & Quote

Posted at: 10/14/06 08:11 PM

jmtb02 LIGHT LEVEL 29

Sign-Up: 03/01/04

Posts: 5,463

It's lovely :).

It's definitely refreshing to see after all the lack of perspective that has been floating through newgrounds recently. It makes the game that much better with this kind if styling.

NOM NOM NOM NOM NOM

BBS Signature

None

23450

Reply To Post Reply & Quote

Posted at: 10/14/06 08:11 PM

23450 LIGHT LEVEL 27

Sign-Up: 05/28/03

Posts: 7,300

friggin beautiful man. well done.

Halo 3 GamerTag: XCornDawgX


None

KaynSlamdyke

Reply To Post Reply & Quote

Posted at: 10/14/06 08:28 PM

KaynSlamdyke LIGHT LEVEL 15

Sign-Up: 06/25/04

Posts: 4,144

At 10/14/06 08:11 PM, jmtb02 wrote: It's lovely :).

It's definitely refreshing to see after all the lack of perspective that has been floating through newgrounds recently. It makes the game that much better with this kind if styling.
At 10/14/06 08:11 PM, 23450 wrote: friggin beautiful man. well done.

Thanks Guys. Hey look, 1900 posts.
Right... got the answers I needed. It's not looking good though, seeing as I'm still using MX04 and the beginBitmapFill function is Flash 8 only. Looks like something I'll have to add thirty days before release date. The transformation matrix is going to eat my brain alive methinks.

As for the arrays and movement system, I'll just have to grin and bear the rewrites...

I'll keepm updating this thread as I end up making my city more impressive though.

- Kayn Slamdyke (KSd) - Motorcycle Moderator [[892646]]


None

JorNcar

Reply To Post Reply & Quote

Posted at: 10/14/06 09:17 PM

JorNcar LIGHT LEVEL 17

Sign-Up: 04/26/04

Posts: 736

At 10/14/06 08:28 PM, KaynSlamdyke wrote:
Thanks Guys. Hey look, 1900 posts.
Right... got the answers I needed. It's not looking good though, seeing as I'm still using MX04 and the beginBitmapFill function is Flash 8 only. Looks like something I'll have to add thirty days before release date. The transformation matrix is going to eat my brain alive methinks.

As for the arrays and movement system, I'll just have to grin and bear the rewrites...

I'll keepm updating this thread as I end up making my city more impressive though.

I dont know to much about AS, so everything you just wrote makes very little sense to me, but just from the preview, I could think of so many possibilities. Great job

I cant wait to see this finished

Revolution Now

BBS Signature

None

Alphabit

Reply To Post Reply & Quote

Posted at: 10/14/06 10:16 PM

Alphabit NEUTRAL LEVEL 09

Sign-Up: 02/14/06

Posts: 3,505

At 10/14/06 07:48 PM, XBigTK13X wrote: Firstly, doing this sort of thing with ActionScipt just doesn't make any sense. Its not nearly powerful enough to handle any "real" 3D applications. I suggest using a better language such as C++ (I don't want to start a flame war, I love AS as much as anyone else here, but we all know its not very powerful ^_^.)

C++ isn't that great... You can't do anything decent by yourself. With AS3, you can make awesome 3D stuff coz AS3 is 10 times faster. Wait till it hits the shelves and they AS users will make fun of C++.


None

23450

Reply To Post Reply & Quote

Posted at: 10/14/06 11:41 PM

23450 LIGHT LEVEL 27

Sign-Up: 05/28/03

Posts: 7,300

At 10/14/06 10:16 PM, LolOutLoud wrote: C++ isn't that great...

umm.....yes it is. i mean sure, it is more practical to use flash for this little interenet game, but C++ is alot better and turns out much better results (Halo 2 anyone? (i think...))

Halo 3 GamerTag: XCornDawgX


None

Vengeance

Reply To Post Reply & Quote

Posted at: 10/15/06 12:13 AM

Vengeance EVIL LEVEL 28

Sign-Up: 03/18/05

Posts: 5,051

At 10/14/06 10:16 PM, LolOutLoud wrote: C++ isn't that great...

Yes it is

You can't do anything decent by yourself.

Yes you can

With AS3, you can make awesome 3D stuff coz AS3 is 10 times faster.

8 times faster, and even then, it's still not that great. C++ still runs around 30x faster than AS3

Wait till it hits the shelves and they AS users will make fun of C++.

No they wont... AS is for web games, C++ is for real games. major difference, both have there positives and negatives. It's like comparing apples to carrots.

========|| WWWWWWWW>[-[Blog] - [Audio] - [Userpage] - [Flash] - [Last.fm]-]<WWWWWWWW ||========

BBS Signature

None

JD77

Reply To Post Reply & Quote

Posted at: 10/15/06 12:16 AM

JD77 NEUTRAL LEVEL 17

Sign-Up: 03/30/05

Posts: 1,062

Ive coded in AS 3.0, trust me u cant compare with C++, Its pretty fast compared to AS 2.0 but not C++ fast. It can do a 10000 for loop without doing MAJOR lag. C++ is EXTREME! lol. And Kyan try using AS 3.0 it aint that different than AS 2.0. It took me less than an 30mins to learn and convert one of my 3D engines to AS 3.0.

*User Page under construction*

BBS Signature

None

mynamewontfitin

Reply To Post Reply & Quote

Posted at: 10/15/06 12:56 AM

mynamewontfitin NEUTRAL LEVEL 19

Sign-Up: 09/01/03

Posts: 4,031

I played with that engine longer than I play a lot of completed Flash games. :P


None

23450

Reply To Post Reply & Quote

Posted at: 10/15/06 01:01 AM

23450 LIGHT LEVEL 27

Sign-Up: 05/28/03

Posts: 7,300

At 10/15/06 12:56 AM, mynamewontfitin wrote: I played with that engine longer than I play a lot of completed Flash games. :P

and any time spent playing with this engine will never be considered wasted time in my eyes.

Halo 3 GamerTag: XCornDawgX


None

BobTheSuperPie

Reply To Post Reply & Quote

Posted at: 10/15/06 01:56 AM

BobTheSuperPie NEUTRAL LEVEL 01

Sign-Up: 04/26/05

Posts: 16

You guys that are bashing AS by comparing it to C++ would be astonished if you heard a game I know of that was originally made in AS and converted to C++.

I'm not allowed to tell, but just think of one of the best games out there, and then try to imagine it being made in AS.

So yes, it's possible.

ugh this is orb again. I should stop going to the general forums so I stop getting banned.

None

KaynSlamdyke

Reply To Post Reply & Quote

Posted at: 10/15/06 12:26 PM

KaynSlamdyke LIGHT LEVEL 15

Sign-Up: 06/25/04

Posts: 4,144

At 10/14/06 09:17 PM, jorncar wrote: I cant wait to see this finished
At 10/15/06 12:56 AM, mynamewontfitin wrote: I played with that engine longer than I play a lot of completed Flash games. :P
At 10/15/06 01:01 AM, 23450 wrote: and any time spent playing with this engine will never be considered wasted time in my eyes.

So much support for my little game engine. I'm so happy I could cry.

At 10/15/06 12:16 AM, JD77 wrote: Kyan try using AS 3.0 it aint that different than AS 2.0. It took me less than an 30mins to learn and convert one of my 3D engines to AS 3.0.

I'm still using Flash MX04... I don't even get blur filters or bitmap data yet.

Still, should this game earn me the $250 prize for the month, I'll put that towards buying Studio 9 when it gets released.

There've been some minor changes to it now. Same address, but those who've seen it already may need to clear thier cache to see those changes. You could also view the SWF directly within your browser as well (change .html to .swf), but I think the lag is fairly intense if your browser's maxed.

Added:
- Walls are not drawn if they're off screen.
- Camera follows nicely now
- Fixed the bug that stopped walls being drawn if the character was too far past them
- Upped the frame rate and interval times for smoother play

- Kayn Slamdyke (KSd) - Motorcycle Moderator [[892646]]


None

fuzz

Reply To Post Reply & Quote

Posted at: 10/15/06 12:38 PM

fuzz NEUTRAL LEVEL 21

Sign-Up: 06/02/04

Posts: 5,644

Nice engine. I played it for too long >:(


None

GuyWithHisComp

Reply To Post Reply & Quote

Posted at: 10/15/06 12:40 PM

GuyWithHisComp LIGHT LEVEL 23

Sign-Up: 11/10/05

Posts: 4,029

At 10/15/06 12:38 PM, fuzz wrote: Nice engine. I played it for too long >:(

Haha, and still it's only an engine.
I'm sure this will turn out to be a great game.

Atleast if I'm included in Thanks to list >:)
BBS Signature

None

Saza

Reply To Post Reply & Quote

Posted at: 10/15/06 12:41 PM

Saza LIGHT LEVEL 13

Sign-Up: 10/01/05

Posts: 1,160

Omg, awesome. Good luck with whatever your going to do with it o_o


None

Xeptic

Reply To Post Reply & Quote

Posted at: 10/15/06 12:46 PM

Xeptic LIGHT LEVEL 25

Sign-Up: 05/12/05

Posts: 1,557

It runs surprisingly smooth, impressive! I spent quite some time doodling around with it.

BBS Signature

None

henke37

Reply To Post Reply & Quote

Posted at: 10/16/06 11:26 AM

henke37 NEUTRAL LEVEL 16

Sign-Up: 09/10/04

Posts: 2,533

It realy looks sweet. For flash that is, but is still looks good.
And this is coming from somebody who have some kind of knowledge of what he realy is doing.

I strongly urge you to use classes, it will save your ass when it gets complex.

I used to recommend my article about php security, but my server is down, so all I say is: ActionScript version 2 sucks big time! Go learn ActionScript version 3 already!


None

Peturo

Reply To Post Reply & Quote

Posted at: 10/16/06 11:57 AM

Peturo LIGHT LEVEL 17

Sign-Up: 06/12/06

Posts: 731

At 10/15/06 12:16 AM, JD77 wrote: Ive coded in AS 3.0, trust me u cant compare with C++, Its pretty fast compared to AS 2.0 but not C++ fast. It can do a 10000 for loop without doing MAJOR lag. C++ is EXTREME! lol. And Kyan try using AS 3.0 it aint that different than AS 2.0. It took me less than an 30mins to learn and convert one of my 3D engines to AS 3.0.

when did you ever make a 3D engine?

i like what you have done with this set-up i would love to see more 3D games made in flash or even 2.5D but really in GTA only the buildings are 3D anyway so after you get this down you will be set!


None

The-Super-Flash-Bros

Reply To Post Reply & Quote

Posted at: 10/16/06 01:31 PM

The-Super-Flash-Bros LIGHT LEVEL 26

Sign-Up: 09/02/02

Posts: 1,163

At 10/14/06 07:43 PM, KaynSlamdyke wrote: Problems I've got
- Solid colour bites. Eventually (after solving the above problem so that the walls with thier backs to the screen *don't* render) I'd like to fill them with bitmap fills that are distorted to the right size. Is this one a pipe dream? I think I've seen 3d engines do it before, and would like to know how I can do this myself

You could do something like this (arrow keys)

I threw that together in a few minutes, its just a simple shape tween using guide points to make sure its neat, then resized and the frame set based on the position. You could probably work out a way to do it with bitmaps too.

Tom~


None

KaynSlamdyke

Reply To Post Reply & Quote

Posted at: 10/16/06 01:44 PM

KaynSlamdyke LIGHT LEVEL 15

Sign-Up: 06/25/04

Posts: 4,144

At 10/16/06 01:31 PM, The-Super-Flash-Bros wrote: I threw that together in a few minutes, its just a simple shape tween using guide points to make sure its neat, then resized and the frame set based on the position. You could probably work out a way to do it with bitmaps too.

Tom~

The problem lies with the way those buildings are actually drawn. They're drawn with AS, not with library items.

I'm going to get around it by having the walls draw the windows to buildings in with the same code, but it may cause the game to lag. After all, more drawing = more instructions = more processor power. But thanks for the idea though.

I swore it was you that made bitmaps distort with your Flash Racers game. Might have been mr Delta however...

At 10/16/06 11:26 AM, henke37 wrote: It realy looks sweet. For flash that is, but is still looks good.
And this is coming from somebody who have some kind of knowledge of what he realy is doing.
I strongly urge you to use classes, it will save your ass when it gets complex.

Thanks. I have knowledge too. I have a degree in 3d modelling, and I've been living around game coders for the past three years. But no argument there about classes. I'll be playing about with OOP for enemies, cars and whatnot. Might not be needed for the graphical rendering though.

At 10/15/06 12:38 PM, fuzz wrote: Nice engine. I played it for too long >:(
At 10/15/06 12:40 PM, GuyWithHisComp wrote: I'm sure this will turn out to be a great game.
Atleast if I'm included in Thanks to list >:)
At 10/15/06 12:41 PM, Saza wrote: Omg, awesome. Good luck with whatever your going to do with it o_o
At 10/15/06 12:46 PM, Xeptic wrote: It runs surprisingly smooth, impressive! I spent quite some time doodling around with it.
At 10/16/06 11:57 AM, Peturo wrote: i like what you have done with this set-up... after you get this down you will be set!

More people to add to the thank-you and playtesting list...
^_^

- Kayn Slamdyke (KSd) - Motorcycle Moderator [[892646]]


None

Claxor

Reply To Post Reply & Quote

Posted at: 10/16/06 01:55 PM

Claxor DARK LEVEL 10

Sign-Up: 10/21/05

Posts: 2,465

Thats some amazing shit dude! Brings back all the good memories of blowing up cars in GTA 1, and the mission where dogs ate people in GTA 2 (I'll never forget that mission :))

BBS Signature

All times are Eastern Daylight Time (GMT -4) | Current Time: 12:25 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!