Click here to Skip to main content
12,997,210 members (75,441 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am currently creating a small 2D game engine for my final year project at university, but when ever i think im going in the right direction i get stuck on things like real time rendering in c#, creating and rendering a BSP tree in c# which I have come to find is a difficult task.
So i turn my questions to you guys....
1: which would be the best and most efficient way of creating a making it render in real time...should i create a time or stick with my update method etc?
2: Im also creating the editor to go with the engine, which is so far being made using the windows forms, in this editor i hope to have an accessible list of assets available, which can then be dragged and dropped into a list of level entities etc and also have a game preview (see unity 3d for similar lay out)
3: Which data structure would be best for this, baring in mind a tree structure is what i need for a high grade on this.

thanks in advance for your answers
Posted 4-Jan-11 7:06am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Part of being a programmer is being able to analyze the problem, and then design and implement the solution. If you ask someone else what *they* would do, then it becomes that person's solution instead of yours. How are going to learn from doing what someone else would do?

Lastly, you should embrace this time in your development career, because you're not going to be anything more than a code monkey for the next 5-10 years, implementing someone else's ideas instead of your own. This is truly your last opportunity to be truly creative until you've been in the biz for a length of time.
AbnormalCreations 4-Jan-11 13:46pm
Thank you for the answer, however im not so much as asking for the coding answers, more of a nudge in the right direction.
Marc A. Brown 4-Jan-11 14:13pm
You're correct, of course, John; however, the question reads to me like the poster has actually spent at least some time considering solutions. He still has to correctly implement whatever solution he selects (whether that solution is recommended by one of us or not) which in the end makes it "his" solution.
Love your second paragraph. Definitely something for a new developer to take to heart.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

RE: #3

I think the choice of data structure depends on how you intend to use the game engine. If you're thinking of games along the lines of a space shooter like Defender or Asteroids, then you may want to consider a quadtree for hit detection. If it's something with walls or a maze like PacMan, a BSP might be more appropriate.

One thing to note is that a tree structure might not be needed, or even appropriate, for the rendering process. I haven't created any game engines myself, but from my understanding the trees are used to help speed up the rendering process by organizing all of the scene geometry so that it's easier and faster to determine what geometry doesn't need to be rendered at all, what geometry is affected by shadows or other effects, and so on. A little 2D engine doesn't really need to worry about those things so much for rendering. In 2D it makes more sense for collision detection or some other feature.
AbnormalCreations 4-Jan-11 13:53pm
Thank you for your reply.
As a demo game, produced by the engine I was hoping to be able to make either a simple platform game showing the functionality or something as simple as Asteroids, so yes in this case a quad tree would be appropriate, thank you for the advice.
I considered using other methods for storing and displaying objects such as arrays and such, for a possible tile based game engine, but was recommended by my tutor that marking wise if i go with a tree structure such as a BSP tree, i would get greater marks etc
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

#3) I think demonstrating that you know how to use the right structures and algorithms for the various tasks your project has to perform will be fairly important. It's often equally important to show that you have thought your way through this, possibly showing more than one approach and discussing pros and cons in your paper.

#2) Designers are fun, and since you are building a 2D engine – it could make sense to take a shot at tightly integrating things with the .Net design environment. Here is a useful article on this:

#1) It sounds like you are using forms, and if you are using GDI+ it will probably make sense to invalidate the areas that need repainting. Since your game probably is, or is going to be, partially driven by timed events, don’t repaint during the timer event handler – just invalidate. Windows combines outstanding regions that need repainting to reduce the number of paint events.

Good luck
Espen Harlinn

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 4 Jan 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100