Page 1 of 1

Any patterns

Posted: Wed Jul 20, 2011 5:10 pm
by sprenio
Hi,

i would like to ask if there is any tutorials, so exact tutorials how to create a 2d engine, or a 3d engine? Or anything like this... Yes i know there is a tutorial about a 2d game in the purearea but it is in french.
No english resources about this, i found someone posting a 2d engine, but i wouldnt want to copy the whole of it ( his whole hard wokr... ), it would be better a tutorial on it...

thanks,

Re: Any patterns

Posted: Fri Jul 22, 2011 9:27 pm
by Zach
Actually I'm very interested in this topic myself..

Every time I try to look up information on the subject of actually writing your own engine, the kind of work involved, how calculations are decided upon / come up with, how you skelletalize the system and tie it together.. Both on the subject of 2D and 3D, I generally either find something that looks interesting and just get lost in complex statements, or I can't find anything in a language I can truly understand and say "I see what you did there!".

Its quite unsettling.

It would be really neat to see tutorials on writing games engines, or at least portions of the engines such as the Rendering & Sound /AI subsystems that cover the very basics and then show you a better way to improve upon it and TELL you why it is a better way, etc.. Explain conceptual ideas but also express them as well-explained code samples..

Re: Any patterns

Posted: Sat Jul 23, 2011 12:03 am
by TomS
Rendering? That's what DX/OpenGL is for.
A 2D-Game engine. There are tons of different kind of games in 2D alone. They all have different parameters. That goes so far that you can't use ANY part of one engine for an engine for a game of a different genre.

The basis would probably be a tile engine. And here we go. We have side-scrolling, isometric, top-down (2,5D (like in most 2D RPG's). Quadratic tiles, rectangular tiles, hexagons, octagons...
Maybe we have no defined geometric shape at all. Like an island with free-hand drawn paths...

Let's say we make a side-scroller. Fixed background or paralaxed background (simulation of depth - nearby trees move fast, far away mountains and clouds move slowly).

Next: Collision engine.
I know of two different methods. Object based map, each object has a property "solid".
Or an area-collision engine, where you "draw" the area of air, and the area of solid ground and draw your world on this map.

See? It's not possible to write a tutorial for a 2D-engine. There are so many possibilities.
The only thing that can be used in every game is a sound engine. Maybe a particle engine, too.

Re: Any patterns

Posted: Sat Jul 23, 2011 3:15 am
by Zach
Yes I am aware "that's what OpenGL/DirectX are for", however that doesn't effect my original statement. It's one thing to learn the API required, its another to use that API the create a rendering system that does what you want it to, much less something you are able to use easily from within your chosen language platform, while keeping an understanding of how its working.. No ?


Yes there are many kinds of ways to render graphics, but I suppose that is the whole point of having this kind of "easy to digest" information available to people. It would teach those of us in the dark, not only how to think about and tackle these problems, but which solutions may be the most appropriate for specific subsets of problems we are trying to solve.. i.e "Well gee I need to learn how to render graphics the way I want it to look, but I also need to learn the best method of rendering for my goals", etc.

The leap from tutorial to tutorial series is not very hard to make after all. This is a funny thing that has perplexed me about a lot of Hobbyist/pro licensed languages, as well as long established, easily accessible ones. There always seems to be a distinct lack of information where it really counts (I'm talking beyond the basic fundamentals that have 1000 tutorials in 100 languages).. When it comes to really complex tasks or challenges, there may be some hints or two dropped.. But it always comes down to either "good read this book" or similar, or "just mess around with it"..

It almost feels like everyone else says "Well I had to learn the hard way, from scratch and tortuous trial and error; so now everyone else has to for the rest of time!". It's one thing to be all "gimme teh codez!" which I am not about.. But I think some really good tutorials, possibly ones that can be as language neutral as possible, still need to be written on a variety of subjects.

Of course there are good people who always explain things and help others, like TomS, so don't take that the wrong way, friend. It's more a vibe I get from the programming culture as a whole. Sometimes its hard to come up with specific questions, when you don't even know how to start, or what you're actually doing.

Re: Any patterns

Posted: Sat Jul 23, 2011 12:16 pm
by TomS
Well it's hard to help somebody if they don't know what they want to do.
It's not possible to write a tutorial on "2D gaming". That was the point of post.
However if somebody wanted to create a "2,5D" RPG more information could be offered.
I think there also some general (meaning, not aimed ata specific language) information about different genre of games, if you look it up on wikipedia or google.

1. Know what you want to do.
2. Write an engine for that.
3. Create your game with that engine.

2 is often skipped and that's why everybody's beginning from scratch everytime.
Also lots of specific stuff is put into that engine, so that it's still a 2D-tile-engine but it can't be used for other games, because of all that "hard-coded" information.

Re: Any patterns

Posted: Sat Jul 23, 2011 8:53 pm
by Zach
I heat what you're saying. I think we both have very valid points.

I completely understand trying to help someone who doesn't know what they want to do, or doesn't know how to ask about it, etc..


But again I think this highlights the necessity for communities in general (Not just PB, but all languages) to encourage people who are willing to write tutorials on extremely complex subjects. I really wish I had the knowledge, because trying to teach others in such a way is probably something I would enjoy writing a thesis-length tutorial on..

I think its a little convoluted to say "But there are xyz ways to do this subject" and give up for that reason though.. Hypothetically, if I did know all kinds of stuff about 2D game programming, and the hard work of creating an engine, then I would simply start with where my preference or expertise lay. Just because I am interested in making an RPG with a tile rendering system as the backbone, doesn't mean I wouldn't learn useable skills from a tutorial on... a 2D racing game, or side-scroller / action game.

That does not excuse the sheer difficulty of the topic we are discussing, however. I don't think it's a matter of "Come on its easy, just write up a scenario showing people how to do x, y, z".. But I still think tutorials on advanced topics such as these, would be great. Especially if they were broken into a series, that would make it a lot easier on the author. Instead of having to cram everything into X amount of pages in X amount of time.. Just decide how the lesson plans will progress, and work on one lesson at a time, putting out new ones on a weekly/bi-weekly/whatever basis.

But personally, putting my own personal interactions with great people aside.. I really do get this feeling of "When I was a kid we walked to school 3 miles in the snow, up hill, both ways; and so should you" from the overall Internet community when it comes to certain topics. Maybe I'm just overly sensitive :mrgreen:


Overall I think PB has one of the better small communities out there. Everyone is usually willing to give a hand, or even just debate ideas with you, as long as you put the effort in to learning and show it.

Re: Any patterns

Posted: Sun Jul 24, 2011 12:27 am
by TomS
TomS wrote:[write an engine] is often skipped and that's why everybody's beginning from scratch everytime.
Also lots of specific stuff is put into that engine, so that it's still a 2D-tile-engine but it can't be used for other games, because of all that "hard-coded" information.
That's why there are not tutorials, I think.
There's nobody who knows how to write a game-engine in PB. And if somebody tries to write one, they're busy with it and don't even think about writing a tutorial for that.

As nice as it may be to have tons of tuts for every aspect, it's probably not gonna happen.
If we had tuts for every program, we wouldn't need the forums.

So my advice for OP and everybody else, is to post a thread on a specific problem and put their own thoughts into it, as well.
Don't just demand a tutorial.

Zach, you did and I think you learned something from the threads about your RPG.
If you would have waited for a tut, you weren't any farther with your project.

There are threads e.g. about top-down 2D-racing. There were many responses and some pretty neat codes about path-finding and bezier-curves etc came to be.

Just ask, and we try to find a solution. That's what this forum is for.

Re: Any patterns

Posted: Sun Jul 24, 2011 12:43 am
by J. Baker
If people spent time writing tutorials on it, then they wouldn't get there own work done. And explaing a tutorial on programming would take longer then just doing it. So, just start what you want to do and if you have a question, ask here on the forum. It's best to learn PB and do small test of different things then do what you want. ;)

Re: Any patterns

Posted: Sun Jul 24, 2011 11:47 pm
by Zach
Yes, I picked up a lot of ideas and learned some stuff from my Text RPG discussion thread. Which I plan on coming back to and starting more discussions about, when I have the time.

In my particular case, I don't think its a matter of strictly PB tutorials that I want. But I would probably read anything that was well-written and language neutral, with ideas and concepts easily laid out so the reader could translate them into the desired language.

Within the scope of PB, I'm sure no one has lots of times on their hands as its user base is pretty small, and used by actively working professionals trying to make a living. But I guess I was speaking more on the global aspect of things. There are lots of people on the 'net with such free time, and probably the skills to do so, at least I would like to think there are.

But ultimately, Tom's advice is the best you can get in this thread.. Start from the bottom, and start with what you know. Ask questions about specific topics that you are trying to understand, etc.

Re: Any patterns

Posted: Tue Aug 02, 2011 5:52 am
by xorc1zt

Re: Any patterns

Posted: Tue Aug 02, 2011 7:04 pm
by Danilo
Try "Game Coding Complete, 3rd" by Mike McShaffry.
http://www.amazon.com/Game-Coding-Compl ... 584506806/

It brings together all the required parts. Input, Files, Memory Managment,
Time Management, Threads, Network, Remote Game Client, Scripting,
Resource Management, Game State & Data Structures, Physics, Event System,
Process Manager, Command Interpreter, Display (3D Scenes,User Interface,Video),
Options, Audio (SFX,Music,Speech), AI, ...

The book does not use PureBasic but C++,C#, Lua and it uses OOP to bring all
this together. You would need to translate it to procedural PB programming yourself,
but you should definitely learn something about the big picture from this book.

Re: Any patterns

Posted: Tue Aug 02, 2011 8:24 pm
by Foz
I bought "Programming 2D Scrolling Games" by John "Krylar" Logsdon which uses an old version of PureBasic, but it does convey the ideas and tutorials very nicely.

Sourcing it though, may be a challenge...

Re: Any patterns

Posted: Sun Aug 07, 2011 10:52 pm
by Zach
Thanks for those book recommendations..

I found Game Coding Complete, hope to get some good stuff out of it. Also looking for the others in electronic form.