2d engine
2d engine
2d engine
2d engine
2d engine
2d engine 2d engine 2d engine 2d engine 2d engine 2d engine 2d engine 2d engine
2d engine 2d engine
2d engine
Go Back  Xtreme Visual Basic Talk > > > 2d engine


Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2010, 08:18 AM
lord_lazy lord_lazy is offline
Newcomer
 
Join Date: Nov 2010
Posts: 14
Default 2d engine


i want to work on a vb game and have been looking for a 2d engine tutorial, i know the is loads of them but they all seem to be vb6 where as im using vb08. i dont want directx just gdi
Reply With Quote
  #2  
Old 12-22-2010, 06:27 AM
Leade's Avatar
Leade Leade is offline
Junior Contributor
 
Join Date: Jul 2005
Location: Wherever i fall over
Posts: 222
Default

a little tip when doing a 2D engine is NOT to use the predefined sprites as they are extremely slow. instead create a vertexbuffer box and render a image to that instead, its 4 times faster and allows you to rotate the image.
__________________
Fact: The best ideas come when your smashed of your face. So drink beer and be merry!!!
Reply With Quote
  #3  
Old 01-16-2011, 08:34 PM
HellfireXP's Avatar
HellfireXP HellfireXP is offline
Freshman
 
Join Date: May 2010
Location: South Carolina
Posts: 41
Default

I wrote a game called Pat Man awhile back (basically pacman). Check out the code, it may help you... http://www.mediafire.com/file/tyyokd3zydw/Pat-Man.zip
Reply With Quote
  #4  
Old 06-26-2011, 03:38 PM
lord_lazy lord_lazy is offline
Newcomer
 
Join Date: Nov 2010
Posts: 14
Default

thanx for your help but i kinda abandoned this project and i think i've become a little better with 2d game programming
Reply With Quote
  #5  
Old 06-28-2011, 12:05 AM
45minutes 45minutes is offline
Regular
 
Join Date: Jan 2011
Posts: 75
Default

Quote:
Originally Posted by HellfireXP View Post
I wrote a game called Pat Man awhile back (basically pacman). Check out the code, it may help you... http://www.mediafire.com/file/tyyokd3zydw/Pat-Man.zip
I've noticed you include all your images as one PNG image. Looks really efficient. How do you manipulate it in visual studio? do you just cut them up as if you're using paint?
Reply With Quote
  #6  
Old 06-28-2011, 06:17 AM
passel's Avatar
passel2d engine passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

It's a common technique to have a "sprite sheet" and the code just "blits" a portion of the sheet to a destination area.
Look at the code, in the DrawOnSurface sub.
The line:
clsGraphicsBuffer.DrawImage(source, destRectangle, srcRectangle, GraphicsUnit.Pixel)

That line will transfer a rectanglar area, defined by srcRectangle, from the 'source' bitmap to the rectangular area defined by destRectangle on the bitmap associated with clsGraphicsBuffer.
That particular call will stretch/shrink the image if the two rectangular areas are not the same size.
Below that you see calls where instead of a destination rectangle, an X,Y point is used. In that case, the source image is not stretched, it is just copied to the destination X,Y position.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #7  
Old 06-28-2011, 07:33 AM
45minutes 45minutes is offline
Regular
 
Join Date: Jan 2011
Posts: 75
Default

Quote:
Originally Posted by Leade View Post
a little tip when doing a 2D engine is NOT to use the predefined sprites as they are extremely slow. instead create a vertexbuffer box and render a image to that instead, its 4 times faster and allows you to rotate the image.
Is that why this 'pat man' is so slow? it didn't use a vertex buffer?
Reply With Quote
  #8  
Old 06-28-2011, 09:14 AM
AtmaWeapon's Avatar
AtmaWeapon2d engine AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

I believe the main reason it looks slow is the choice of the Windows Forms Timer as the timing source. Read the documentation and you'll find the minimum resolution it can support is 55ms. That gets you a choppy 18 frames per second maximum. Sure, the Interval property is set to 5 ms, but the documentation makes it clear you can only get what you ask for if it's equal to or greater than 55ms.

Game libraries tend to use something else as their timing source; what it is I don't know. Perhaps the API multimedia timers? Either way, it's hard to get better than 30 FPS out of Windows Forms. I've experimented with threaded timers and been able to get 60 FPS, but experimentation doesn't inspire trust that it'd be a constant 60 FPS on all machines. (For example, I have to ask for a tick rate that should be getting me 90+ FPS to get 60; if I ask for the 60 FPS tick rate I get more like 45.)

Windows Forms is not a good platform on which to base a high-performance 2D engine. If you want that and want to use .NET XNA is a good choice, but I'm sure there's some OpenGL wrappers that are nice too.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
2d engine
2d engine
2d engine 2d engine
2d engine
2d engine
2d engine 2d engine 2d engine 2d engine 2d engine 2d engine 2d engine
2d engine
2d engine
 
2d engine
2d engine
 
-->