Algorithms and Editors

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Algorithms and Editors

Post by dejai »

Dejai here. I program in C++, I own www.dejaigames.com. I have a couple things I want to talk about in this post. The first is about 3rd person algorithms for 3d applications I helped develop this simplified version and if your smart you may just like it for some 2d or 3d application.. Secondly I want to talk about getting the source code for the Level and Class editor so I can build a new real time GUI system with GUI dialogs instead of the console. I would of course leave a button so you could still use console .. Seems stupid to type paths in each time on your machine since your on a windows. I might throw in some framwork advice.

Well before I get into it a bit about myself, I run 3 computers soon to be 4 in my room. A server .a laptop and a 2.6GHZ Dual Core, 64 AMD, Radeon Hd 2400 Pro, 2gb ddr ram. Belkin wireless F5D7000 card (for my Ubuntu partition) acer computer. I use NDISWrapper 1.52 for my main my machines ubuntu partition. Revision 1.51 for my 2 Gnome ubuntu desktops. And I don't need one for my laptop. I am so surronded by computers that they emmit more heat than your average 25 degree (Celsius) day. My server runs NST VM security Tool same with my laptop and they both have TShark, Wireshark, Nmap, and my Laptop has etheral. I don't want to get middle man hacked any time soon :D
In otherwords, I code a lot and I use GNU/Linux as well as a Windows partition in case I can't get my shit together.


Now onto the 3rd person rotation algorithms. I cannot be assed to translate this into Pseudo get over it.

Code: Select all

  if(keys[KEY_ESCAPE]) 
     {
     if (guiState == false)
     {
     GUI();
     }
     keys[KEY_ESCAPE] = false; 
    }

    if (keys[KEY_KEY_W])
    {
    playerpos.X += speed * cos((playerrot.Y) * 3.14/ 180);
    playerpos.Z -= speed * sin((playerrot.Y) * 3.14/180);
  //  keys[KEY_KEY_W] = false; 
    }

    if (keys[KEY_KEY_S])
    {
    playerpos.X -= speed * cos((playerrot.Y) * 3.14/180);
    playerpos.Z += speed * sin((playerrot.Y) * 3.14/180);
   // keys[KEY_KEY_S] = false; 
    }
    if (keys[KEY_KEY_A])
    {
    playerrot.Y -= 6;
    //keys[KEY_KEY_A] = false; 

    }
    if (keys[KEY_KEY_D])
    {
    playerrot.Y += 6;
   // keys[KEY_KEY_D] = false; 

    }
    if(keys[KEY_KEY_R])
    {
   playerpos = vector3df(0,0,0);
    keys[KEY_KEY_R] = false; 
    }
    if(keys[KEY_KEY_Q])
    {
    playerpos.X -= speed * cos((playerrot.Y +90) * 3.14/ 180);
    playerpos.Z += speed * sin((playerrot.Y+ 90) * 3.14/180);
   // keys[KEY_KEY_Q] = false;
    }
     if(keys[KEY_KEY_E])
    {
    playerpos.X += speed * cos((playerrot.Y +90) * 3.14/ 180);
    playerpos.Z -= speed * sin((playerrot.Y+ 90) * 3.14/180);
   // keys[KEY_KEY_E] = false;
    }


    sonic_node->setPosition(playerpos);
    
    sonic_node->setRotation(vector3df(playerrot.X, (playerrot.Y-90), playerrot.Z));

   sonic_node->addChild(camera);
   vector3df cameratarg = playerpos;
   cameratarg.Y += 200;
   camera->setTarget(cameratarg);

By not returning the state it provides smoother movement. sin* cos* Trig.. But its applying to a 360 circle. Umm I used to use decorates or whatever but simplified it... That runs in one of my apps called Sonic Revolution.


Um now onto your editors if you email me the source I will make them into GUI capable applications with OS independent engines. The engines I use work on Windows, Mac, Linux, Solaris, Xbox, PS3, I am helping with a port for the WII.


Also what framework do you have for the project? I have some advice on that.
Umm.
* CGame
* CGameManager
* CGameState
* CGamePlayState
* CGamePlayStateLevel01

CGame contains the game loop, and references to CGameManager put an object in the CGame class so you can access it for the loop.

CGameManager
This class is responsible for controlling the game flow logic using a 'State Pattern' approach.


CGameState
The main base state class, all states inherit from here. The 3 main functions, Init(), Update() and Clear().

CGamePlay
Inherits from CGameState to provide general game play functionality
Enjoy.

CGamePlayLevel01
Loads the level.


Anyway I will catch up with you guys later..


Some demo code for CGame would look like..

Code: Select all

bool CGame::Run()
{
     while (m_GameManager.device->run())
     {
           m_GameManager.Run();
     }
}
Note: You need to use constructors..


Ugh sorry for the rabble anyway. Hello!
www.dejaigames.com
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Well, I'm not exactly quite sure what to say.

First of all, we aren't using a "framework." We built every bit of our engine from the ground up.

I honestly can't make heads or tails of the little bit that you've given us from your "rotation algorithm", but it looks like nothing that's not standard z-axis, trig-driven rotation. We are using something similar, as are most everybody trying to rotate a polygon about any axis.

So it looks like you've posted a portion of some sort of input code, clearly rotating a sprite/poly/something depending on the keys you hit. The rest of it: sonic_node, and the other classes are indecipherable without seeing more code.

As for handing out our source code. First of all, the level editor is written in "BlitzPlus" and the console-based editors were all written in a scripting language named "Perl." Neither of these are going to be easily rewritten as multiplatform applications. And as this is a closed project, there's not even a purpose in doing so.
User avatar
Dr. House
Respected Programmer
Respected Programmer
Posts: 20
Joined: Tue Mar 18, 2008 7:54 am

Post by Dr. House »

Well, well, well.

I'm not sure if you've fully assessed your "3D rotation algorithm."

You've accomplished absolutely nothing other than posting 8th grade precalculus level trigonometry embedded into some sort of input structure that none of us have any way of knowing (let alone caring) about.
dejai wrote:I cannot be assed to translate this into Pseudo get over it.
Trust me when I say, my dear sir, the only thing that I could consider asking you to clarify for me is perhaps helping to decipher your cryptic and hardly coherent posts.

Or perhaps you said that because you haven't the ability to clarify it?
dejai wrote:By not returning the state it provides smoother movement.
"state"? What? How are we supposed to do anything with this statement other than gawk at it wondering why it was posted?

I do suppose that your true experience is shown here:
dejai wrote:sin* cos* Trig.. But its applying to a 360 circle.
You've put not only sine, but cosine as well to the test in your implementation. As if that wasn't extraordinary enough, you applied that to a circle instead of a hexagon, octagon, or any sort of arbitrary n-gon. But I must say, I'm most impressed that this implementation can handle a 360 circle. You could've stopped halfway at the 180 degree mark, but no--not you, my dear man--you've managed to cover both halves and do a full 360 with your circle.

And that is why I commend you, good sir.
Everybody Lies.
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Post by Arce »

Um now onto your editors if you email me the source I will make them into GUI capable applications with OS independent engines. The engines I use work on Windows, Mac, Linux, Solaris, Xbox, PS3, I am helping with a port for the WII.
Heh, actually, there *is* a GUI capable application in the working: my editor. I'm not quite sure how you fell under the impression that it wasn't, but it is.

Peter's scripts, on the other hand, exist only as quick, temporary measures until I get around to implementing whatever is needed in the editor. Their sole purpose for existing (in the most part) is temporary usability until they're rewritten. As for being OS independent, that's cool but completely unnecessary, as we've all got the same or have access to the same OS. We're not planing on releasing any of our game tools. They're just for us to create the game with.

Oh, and btw, I checked out your site and I'm impressed. It's pretty nice looking! Also, your sonic demo was nice as well. Keep working on it, I can't wait to see it when it's done.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Post by dejai »

Sorry for the horrible post above, I was tired obviously I can make no valid excuse.

1. You are not using a framework? Ok this doesn't make any sense at all if you plan on creating an RPG. Yes you have built your own engine up using what OpenGL? But and engine is not a game..

Quote from Wikipedia:
A game engine is the core software component of a computer video game or other interactive application with real-time graphics. It provides the underlying technologies, simplifies development, and often enables the game to run on multiple platforms such as game consoles and desktop operating systems such as Linux, Mac OS X, and Microsoft Windows. The core functionality typically provided by a game engine includes a rendering engine (“renderer”) for 2D or 3D graphics, a physics engine or collision detection (and collision response), sound, scripting, animation, artificial intelligence, networking, streaming, memory management, threading, and a scene graph. The process of game development is frequently economized by in large part reusing the same game engine to create different games.
Now going back to my major point, I hope and expect you to have a framework for your engine and that is all very well and good, yet I was specifying as to the game/s. You need a framework to handle repeated code, and cut out huge chunks of work. I am sure you have one in both your game and in your engine. In fact if you did not have a framework in either it would seem stupid and illogical.

But as I watched your videos I noticed you were also using LUA, and PERL, thus an interest was raised on my behalf as to how your game framework runs. I was just taking an interest and suggesting another possible route for your framework should you want to make it more sophisticated or at least consider other options.


Now lets move onto the consideration of this quote from Dr.House:
You've accomplished absolutely nothing other than posting 8th grade precalculus level trigonometry embedded into some sort of input structure that none of us have any way of knowing (let alone caring) about.

Yes, I have developed it using precalculus. And I mentioned the following in my post:
The first is about 3rd person algorithms for 3d applications I helped develop this simplified version

Hmm Mr.House if you must insist and go onto flaming me again with this remark:
I do suppose that your true experience is shown here:
dejai wrote:
sin* cos* Trig.. But its applying to a 360 circle.
You've put not only sine, but cosine as well to the test in your implementation. As if that wasn't extraordinary enough, you applied that to a circle instead of a hexagon, octagon, or any sort of arbitrary n-gon. But I must say, I'm most impressed that this implementation can handle a 360 circle. You could've stopped halfway at the 180 degree mark, but no--not you, my dear man--you've managed to cover both halves and do a full 360 with your circle.
Well in fact it does show my experience, I have used the above algorithms in one of my games. If you would like to download it you can be my guest, then we can see how this formula OBVIOUSLY DOES NOT APPLY TO ANY REAL LIFE SITUATIONS. Gosh, I believe you may download the current version of the project (or any of my projects I fell like sharing) at: projects.dejaigames.com or you can download this specific project from
"www.dejaigames.com/download/Sonic/Sonic Revolution1.3.exe" (Leave the space).

Arce, thanks for actually looking at my project I have a great admiration for someone who researches before they post. As you can see I obviously didn't and thats why I have to write this mammoth post just to explain my actions and decrypt my own shit.

Now onto GyroVorbis, first off I apologies for the shit I posted previously.
Making something cross platform is not as hard as you may think. It is much harder however if you have decided to use libs and .dll that are windows dependent. Noting of course linux doesn't use .dll's. It makes it even harder if you have decided to use DirectX.

Moving on I have made a cross platform capable picture viewer. I have not compiled it on mac or linux but I could if I wished. Goto project.dejaigames.com and read more about "ITexture" you will see the ability for a file browsing system.
And as this is a closed project, there's not even a purpose in doing so.
Really, why would you make the project closed. I assume you mean closed source? I license all my projects under GNU, or MIT. I have seen huge 3d RPGs licensed under GPL. Why have you chosen to close the source?
"BlitzPlus" and the console-based editors were all written in a scripting language named "Perl."
The sarcasm was not needed, I know what Perl is. And I know what BlitzBasic is at least, is BlitzPlus the paid version?

Dr.House if you want me to show you a more complex version that accomplishes the same result just ask.
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Post by dejai »

Oh and why are you using www.hostway.com as your host.. Seems like a bit of a rip off to me.
DJ Yoshi
Game Developer
Game Developer
Posts: 1021
Joined: Wed Mar 02, 2005 9:12 pm
Location: Madison, AL

Post by DJ Yoshi »

So you come in here, say we're making our game wrong, ask for our source code, and tell us to make it available to the general public? Not only that, but tell us we don't work on linux (which...we never said we cared about?) and then go on to tell us we should go GPL (even though it's time consuming, lets everyone use the engine our team has made without us first using it, and basically sets us up for failure as it constantly showcases a half-working prototype, which while getting people excited also bolsters our morale for a short time before making us once again realize how much work there really is to do), and to top it all off, criticize the host for the site (which is our affairs not yours)?

You know, originally I defended linux nerds. Now I'm just not so sure.
There is no signature.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Actually, we use http://gate.com as our host, and it is a complete and total rip-off. We're getting a new site, domain, and host fairly soon, so I'm not really making a big deal of the sub-ass service as of late.
dejai wrote:I am sure you have one in both your game and in your engine. In fact if you did not have a framework in either it would seem stupid and illogical.
I don't know what you're classifying as "framework." If you just mean the backbone of the project, yes, we have one. The term "engine" seems to encompass everything I believe you're trying to make a "framework" out to do. I'm sure we have a framework, as does every piece of software, but it's been created custom by us.

The engine is written in OpenGL and SDL for the PC and uses KallistiOS and the PVR for Dreamcast. I guess our "framework" would be our system of handling the the two platforms. But again, we created that backbone ourselves.

I appreciate your recommendations, but we are fine with our own framework. I don't think any of those would be more "sophisticated," as ours has been custom built and tailored to our needs.
dejai wrote:Making something cross platform is not as hard as you may think. It is much harder however if you have decided to use libs and .dll that are windows dependent. Noting of course linux doesn't use .dll's. It makes it even harder if you have decided to use DirectX.
Yes, we have experience. Our two platforms are Dreamcast and Windows at the moment. We aren't using any platform dependent DLLS (except for lua, but we've recompiled that library for Dreamcast).

No DirectX. I'm not a big fan.
dejai wrote:Really, why would you make the project closed. I assume you mean closed source? I license all my projects under GNU, or MIT. I have seen huge 3d RPGs licensed under GPL. Why have you chosen to close the source?
I mean "closed" in the sense that the only people helping to develop this are the few of us in the team. We aren't recruiting members, and we aren't looking for any more programming help.

We aren't disclosing the source until the game is done.
dejai wrote:The sarcasm was not needed, I know what Perl is. And I know what BlitzBasic is at least, is BlitzPlus the paid version?
That wasn't intended sarcastically. I honestly wasn't sure whether or not you knew what Perl was. I didn't want to be rude, so I tried to introduce it.
User avatar
Dr. House
Respected Programmer
Respected Programmer
Posts: 20
Joined: Tue Mar 18, 2008 7:54 am

Post by Dr. House »

dejai wrote:Yes, I have developed it using precalculus. And I mentioned the following in my post:
Actually, no. You didn't develop it with precalculus; it is precalculus. I believe that Sir Isaac Newton did that, not you. Rewriting a mathematical concept in code isn't something you can claim to have developed. That would be plagiarism.
dejai wrote:Moving on I have made a cross platform capable picture viewer. I have not compiled it on mac or linux but I could if I wished. Goto project.dejaigames.com and read more about "ITexture" you will see the ability for a file browsing system.
These people have no interest in porting their engine to either of those two platforms.
dejai wrote:Really, why would you make the project closed. I assume you mean closed source?
Probably so that people like you won't take advantage of their work as you just did with Isaac Newton.
dejai wrote:The sarcasm was not needed, I know what Perl is. And I know what BlitzBasic is at least, is BlitzPlus the paid version?
Mr. Vorbis was just trying to be nice. Do you blame him for questioning your knowledge based on your first post?
dejai wrote:Dr.House if you want me to show you a more complex version that accomplishes the same result just ask.
A more complex implementation of a simple rotation? Jesus Christ, last I recalled the goal of programming was to keep things simple and efficient. It's already nothing but a simple rotation. I can't imagine why anybody would be impressed at a more complex version of it.
Everybody Lies.
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Post by dejai »

Dr.House, sorry it was the way you phrased the response that confused me :D
8th grade precalculus level trigonometry

In fact the above sounded as if you were talking about pre - calculus. Sorry if you thought I was stealing someones idea but as I remember you saying saying

Code: Select all

You didn't develop it with precalculus; it is precalculus
Thats not exactly true, I had to develop the key input system I am sorry if you have been confused but the simplicity of the key input is the "development'. I would post the code, but now seeing as your closed source.. (JJ).

I am not criticizing you just snooping out the project. In fact, House I am offended you would think that I would steal source. You obviously have not researched the meaning of GPL. In fact your post reminds me of the letter Bill Gates sent to the Homebrew Computer Club years back.. Its not just a rotation system as well its a input system for Keys, Buttons, Camera movement, Collision, GUI etc I just didn't post the surrounding code as it was not of interest.

As for everyone else, yup sorry for wasting your time. For christ sakes why did I even bring Linux or GNU licensing into it. Its obvious to me now how you feel on the issue. If I could give one piece of advice it would be to take open source or free software (they are not the same) seriously.

Anyway while we are here do you use SVN or CVS or GIT?
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

We use SVN.

And honestly, it's not a matter of not taking free software or open source seriously. It's a matter of that not being right for us at this particular point in our development.

We may very well go open source in the future, but this project is in no position at the current point in time to be shown off to the world. We also haven't created anything with it, and we have nothing to prove that it's even our code other than our word at the moment. I wouldn't release the engine until after we've demonstrated our capabilities by creating a game with it.

Sure, we may consider these in the future, but not currently.

Don't think that we're trying to be assholes here (well, House is always an asshole). We've seen your site and we know that you know what you're talking about. :D
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Post by Arce »

Oh, and btw, I appreciate the support and willingness to help. Thanks alot!
Ignore house's douchebagism. He's always like that. :cheers:

And btw, I like your computer setup. I wish mine was similar. xD

And, again, cool site. I'll sign up when I get time.

And yes, our hosting is ass. You wouldn't believe the message we just sent to tech support. :mrgreen:
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Post by dejai »

Thanks.
I am sorry If I seemed a bit pushy. That is just the open source community talking. When you stick around on open source community forums for a while you begin to act like they do. I always like to try to push developers including myself. If someone makes a great game, you still give feedback, and sometimes it may seem harsh, but they just want you to notice what they say. Anyway, I have a Dream Cast lying around here somewhere, I may dig it up sometime. Its a great console for its time.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Post by MarauderIIC »

Your code looks like slightly modified nehe code. I'd be interested in seeing something a little more complex. I mean, even I can rotate something. Heck, I can even make a particle shoot towards the mouse cursor (oh snap :P). What I'm trying to get at here is that the code you posted doesn't show me much... Admittedly, I haven't downloaded your project, but if it's as cool as Arce said, why not show something, well, cooler? And then explain it so we know you know what it means? 'Cause if you can't translate your code into psuedo, it's like doing "Hey do you know what this means?" "I think so. What do you think it means?" "I'm not telling 'cause then how do I know you know what it meant?" sort of thing.

Good luck with your coding :)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Post by dejai »

Um, ok. I made this:
Image
XD
Post Reply