Archived

This topic is now archived and is closed to further replies.

wiseachoo

Question about Jim's Core_System.h

Recommended Posts

Chapter 10, Jims Book. I'm attempting to use his cApplication object with my own cApp, however I noticed the application window doesn't stay open. After debugging it, I found where the problem is. Just before entering the message pump, there is the line of code if(Init() == TRUE){ //enter message pump here //... } It never enters the message pump. I'm sure i'll figure this out on my own, but nevertheless, if anyone has already gone through this, feel free to help. By the way, has anyone here used all of Jim's game engine for their own games yet? I feel its a great place to start. 'Chris [edited by - wiseachoo on November 10, 2002 11:25:22 PM]

Share this post


Link to post
Share on other sites
Thanks Jim, I just realized that it was the Init() of my cApp since I just caught glance of the virtual Init() in your cApplication. Thanks for your assistance either way. Not that your opinion is bias since its your own book, but would you recommend I write my first game using your engine? I''m a very experienced C/C++ programmer, but still trying to conquer the first game leap using DirectX. I''d ''like'' to write my first game in 3d, but something within scope of my understandings and not too unreasonable (since I realize that is the #1 cause for not completing game projects for most people - unrealistic goals initially). Good book by the way, it''s a great pleasure to read.

''Chris

Share this post


Link to post
Share on other sites
quote:
Original post by wiseachoo
By the way, has anyone here used all of Jim''s game engine for their own games yet?


Yep. It''s very useful stuff.


pan narrans
Study + Hard Work + Loud Profanity = Good Code

Share this post


Link to post
Share on other sites
I've done some demos with it and plan to use it in the future, but I had to go back and make my FIRST game more simple. Instead of trying to manage a full RPG as your first game, I'd recommend the gamedev "For Beginners" section. I'm currently working on Breakout (I skipped Tetris. I can't stand it ).

I did alot of "demos" over the last 2 years, and have never completed a game. Keeping your first game small, then progressively incrementing the difficulty until you feel you are ready to manage a RPG will be much more productive for you in the long run. Yeah, Breakout is .. well, what it is. Finishing projects is very important. Just my opinion. Two years of frustrations summed up in 2 paragraphs . I would hope that you can learn from my hard knocks.

Good luck.

Much greatness is achieved thru perseverance and faith.

[edited by - Paladin__ on November 11, 2002 8:15:48 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Paladin__
I had to go back and make my FIRST game more simple. Instead of trying to manage a full RPG as your first game...


The code really isn''t that specific, you don''t have to use it just for RPGs. I used the Windows and DirectX wrapper code as a jumping off point for my first, small games: pong and tetris. So long as you make sure you understand what you''re using, you can use the wrappers, and then you are able to concentrate on game rather than system specifics.


pan narrans
Study + Hard Work + Loud Profanity = Good Code

Share this post


Link to post
Share on other sites
pan: Precisely, my intentions aren''t even to write an RPG at this time. I am focusing on using his Core_System and Core_Graphics components so that I can concentrate slightly more on the ''game'' as opposed to the low-level areas of DirectX. One thing I came across last night, after using his cVertexBuffer to create a test square for rendering, the square did appear where I wanted it to, however the background behind the square was a ton of scrolling alternating green bars...This isn''t the first time i''ve seen this, but I forgot how I fixed it a while back. Anyone have a quick fix off the top of their head?

I haven''t dug too deep into the engine so there can only be so many things causing it at this point. I''ve basically only implemented a cGraphics object along with a cVertexBuffer object to for holding the vertices for my square...I never had any ''scrolling problems'' when I implemented it all by hand, but I''d like to narrow down the bug so that I can start to learn all of the engine functionality. Thanks guys.

''Chris

Share this post


Link to post
Share on other sites
hmm, I agree that some parts like the Graphics Core and System Core are not RPG based, but at the same time, it''s good to understand the basics outside his code. i.e. when DirectX 9 comes out, are you going to upgrade the Graphics and System Core?

I think if you alienate yourself from DirectX code, you COULD find yourself in a pinch come upgrade time.

I personally love Jim''s Core classes and will use them myself, and I agree, Core_System will probably never change. Just a thought. As long as you understand DirectX, I think you''re fine either way.

Much greatness is achieved thru perseverance and faith.

Share this post


Link to post
Share on other sites
quote:
Original post by Paladin__
hmm, I agree that some parts like the Graphics Core and System Core are not RPG based.


I''m pretty sure that many types of games use characters, triggers, scripts, barriers, frustums, automaps, nodetrees...

quote:
but at the same time, it''s good to understand the basics outside his code.


Yes, hence: "So long as you make sure you understand what you''re using"

quote:
when DirectX 9 comes out, are you going to upgrade the Graphics and System Core?


Yes, that''s the point of having a seperate wrapper. It can be updated independantly of the game code.

quote:
I think if you alienate yourself from DirectX code, you COULD find yourself in a pinch come upgrade time.


I''m not advocating alienation. I''m suggesting you get to grips with the DX code, and THEN use it in your own projects. I experimented with each part of the graphics, sound, input, and system cores before moving on to a full game. Once onto a full game I wanted to concentrate on the game code rather than the system stuff so I used the provided wrappers. I made sure I understood the DX stuff though, so I''ll have no problem updating my wrappers (which are already considerably revised anyway).

quote:
As long as you understand DirectX, I think you''re fine either way.


Exactly. Now I have two full games under my belt, I understand DX very well and I''m blasting through my third game project


pan narrans
Study + Hard Work + Loud Profanity = Good Code

Share this post


Link to post
Share on other sites
quote:
Original post by wiseachoo
Thanks for the input guys, what about my scrolling green bar issue? Anyone have any ideas?


Not sure exactly what you mean by it. Are you clearing the back buffer each frame?


pan narrans
Study + Hard Work + Loud Profanity = Good Code

Share this post


Link to post
Share on other sites
pan: thx for reminding me...yea I forgot to call ClearDisplay() before calling BeginScene()...I've done some testing....I drew out a little spaceship and saved it as a texture. Loaded it into my application as a cTexture. Then Blitted it to the screen and created a cInputDevice object for the keyboard. Couple questions. Number 1, I noticed that whenever I check for any of the following:

if (m_Keyboard.GetKeyState(KEY_LEFT) == TRUE)
if (m_Keyboard.GetKeyState(KEY_RIGHT) == TRUE)
if (m_Keyboard.GetKeyState(KEY_UP) == TRUE)
if (m_Keyboard.GetKeyState(KEY_DOWN) == TRUE)

I get this issue: truncation from 'const int' to 'char'
However, if I use any other keys on the keyboard such as the numpad keys, or escape, or lettered keys, I have no problem. All of the keys are typedefined the same way in Core_Input.h. I see no reason for there to be any differences between which keys I am checking... Have you tried creating a cInputDevice for the keyboard and calling GetKeyState on the arrow keys? I'd 'like' to get those working since those are the first place most people's hands flock when playing around with a game.

My second question is regarding the application losing focus. Since I am running in windows mode, I often times click over to other apps while its running, however this seems to lag my system to death until the application gains focus again. I think I read a post about this a while back but the solution has slipped my mind.

Thanks.

[edited by - wiseachoo on November 13, 2002 3:40:33 AM]

[edited by - wiseachoo on November 13, 2002 3:42:42 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by wiseachoo
truncation from ''const int'' to ''char''

Assuming you''re using VC++ 6.0: go to project->settings->C/C++ tab->Project Options and add /J to the end. Look at the appendices for the reason (char becomes unsigned char).

quote:
My second question is regarding the application losing focus.

Not quite as simple
You need to detect when the window loses focus and halt the processing of the game until your app regains focus.


pan narrans
Study + Hard Work + Loud Profanity = Good Code

Share this post


Link to post
Share on other sites
Ok, the /J switch has been added and it did appear to remove that truncation issue. However, the KEY_LEFT, KEY_RIGHT, KEY_UP, and KEY_DOWN just don''t respond unlike the other keys which do...i''ll look more into it when I have some time this evening...its just strange that they don''t act the same as the rest of the keys (which are working).

As for checking when the application loses focus, that sounds like a check that should be done within each frame call since the user can alt-tab or click over to another application at any given time, correct?

''Chris

Share this post


Link to post
Share on other sites
You need to add a check for the WM_ACTIVATE message in the message pump.

case WM_ACTIVATE:
if (!HIWORD(wParam)
// Program is being activated
else
// Program is being deactivated

You probably would add a boolean to easily track the window''s state. Then all you do is to check if that bool is true, in your main loop, and then render or not.

while(msg.message != WM_QUIT)
if (PeekMessage(yadayada)
// check for quit message blahablaha process msgs
else
if (Active)
// Render


(lazy)

/Sandman

Share this post


Link to post
Share on other sites