• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

144 Neutral

About slynk

  • Rank
  1. Help for a newbie

    For C++, I'd recommend SFML or Allegro as your first graphical API. They are great for beginners and easy to understand. [url="http://www.sfml-dev.org/"]http://www.sfml-dev.org/[/url] [url="http://wiki.allegro.cc/"]http://wiki.allegro.cc/[/url] The only other alternative I'd recommend is C# and XNA. It's pretty simple to grasp. I would not recommend having your first exposure to graphical programming with DirectX or OpenGL... while they are very powerful, they can be hard to understand.
  2. Game Engine from Scratch...Why?

    Question is, why stop there? Why not write your own language? Or why are you coding on an OS that you didn't build? Aren't you using someone elses's device drivers to use your computer to program? At some point you have to reliquish control and just rely on other people's creations for the sake of productivity. There's nothing wrong with researching it, as long as it doesn't hinder your other projects (which in your case, it sounds like it is.) I myself on wims will research how a linux kernel works, or how device drivers work, etc. But I don't let that curiosity force me to stop production until I fully understand the technology behind what I'm using.
  3. Bullets Not Updating

    Assuming you don't move the ship from the starting position, the bullet would be at 37 imediately upon firing, be at 637 within one second, and off the screen in 363/600 of a second. My guess is it's moving too fast. I have to ask... why don't you put your prototype's into their classes? ex: ship.moveUp() or bullts.update()
  4. Loading a tiled map

    It's been a while since I used C#, are objects automatcally passed by ref? You may need to implicitly pass it by ref... seems I remember a ref keyword *shrug*
  5. Which level of programming detail is best?

    My advice is to go for polished, quality games that you've made. It's tangable and even the HR guy can see your comitment. I'd say a portfolio of different APIs and languages would show your ability to adapt. Show them your comitment and skill. But this is coming from someone not yet part of the industry, still in school myself.
  6. Loading a tiled map

    Did you remove Begin and End from grass or game1? (should remove from grass) and did you place grass.Draw AFTER Begin but BEFORE End just like player.Draw and crosshair.Draw?
  7. Loading a tiled map

    [left][background=rgb(250, 251, 252)]Grass.cs[/background][/left] [left][color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][background=rgb(250, 251, 252)][CODE] public void Draw(SpriteBatch spriteBatch) { for (int row = 0; row < 19; row++) { for (int col = 0; col < 25; col++) { spriteBatch.Begin(); spriteBatch.Draw(GrassTexture, WorldSize[row, col], Color.White); spriteBatch.End(); } } } [/CODE][/background][/size][/font][/color][/left] Try this instead: [left][font=helvetica, arial, verdana, tahoma, sans-serif][size=2][color=#282828][CODE] public void Draw(SpriteBatch spriteBatch) { spriteBatch.Begin(); for (int row = 0; row < 19; row++) { for (int col = 0; col < 25; col++) { spriteBatch.Draw(GrassTexture, WorldSize[row, col], Color.White); } } spriteBatch.End(); } [/CODE][/color][/size][/font][/left] [left][color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][background=rgb(250, 251, 252)]Or better yet, I don't see where you call grass.Draw() but I'm going to assume it's in Draw() inside Game1.cs (though I only skimmed your code.) If this is the case, just strip the Begin() and End from Grass.Draw to begin with. I assume it works like OpenGL in that it batch's the draw code together so that it only has to draw once. It speeds things up. Give it a try. ^^ EDIT: ah, I didn't read that your world wasn't drawing. That's because you never call grass.draw().[/background][/size][/font][/color][/left]
  8. I tried looping in the draw thread until it locks... this... works but it's not smooth. I'd like the draw thread to be guaranteed a lock when it wants it. Anyone know how I'd go about this?
  9. Hmm. I'm a little closer... I added a ReentrantLock to the statemanager. Then in the update method I try to lock the state manager before updating it. Same for on the Renderer thread. Now the triangle flickers occasionally onto the screen. lol I assume the problem is that the draw thread isn't guaranteed a lock. How do I guarantee it a lock?
  10. The program is pretty simple right now. I have a triangle that I want to bounce around the screen. I have a moveTo(x,y) function in the triangle class. The triangle moves if the function is called on the Renderer thread but the screen is blank if I try to use the function on another thread. This is the first time I've dealt with threading, I'll be honest. I figure I need to use a Lock but I don't really know how to go about doing it... When I comment out running the game thread from the activity, the triangle is drawn and even moves around as I touch the screen as input is received on the rederer's thread. When I let it run, I get a black screen. [code]public class GLView extends GLSurfaceView { private StateManager _manager; private GLRenderer _renderer; public GLView(Context context, StateManager m) { super(context); _manager = m; _renderer = new GLRenderer(_manager); setRenderer(_renderer); } public boolean onTouchEvent(final MotionEvent event){ queueEvent(new Runnable() { public void run() { _manager.Input(event.getX(), event.getY()); } }); return true; } }[/code] [code]public class GLRenderer implements GLSurfaceView.Renderer { private StateManager _manager; public GLRenderer(StateManager m){ _manager = m; } public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT); _manager.Draw(gl); } public void onSurfaceChanged(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); GLU.gluOrtho2D(gl, 0, width, height, 0); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); } public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glShadeModel(GL10.GL_FLAT); gl.glDisable(GL10.GL_DEPTH_BUFFER_BIT); gl.glDisable(GL10.GL_DEPTH_TEST); gl.glDisable(GL10.GL_CULL_FACE); gl.glDisable(GL10.GL_DITHER); gl.glDisable(GL10.GL_LIGHTING); //gl.glEnable(GL10.GL_TEXTURE_2D); //gl.glTexEnvx(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_MODULATE); } } [/code] [code]public class GameThread implements Runnable { private StateManager _manager; private GLView glV; private boolean paused = false; public GameThread(State firstState){ _manager = new StateManager(firstState); } public void setView(Activity main){ glV = new GLView(main, _manager); main.setContentView(glV); } public void pause(){paused = true; glV.onPause();} public void resume(){paused = false; glV.onResume();}; public void run() { while(_manager.IsRunning()){ if(!paused){ _manager.Update(); } } } }[/code] (I'm aware that dx doesn't change, I made it static in case the screen was just blank because the triangle moved off the screen before being drawn) [code]public final class TestGL extends State { private Triangle triangle; private float dx, dy; public TestGL(){ triangle = new Triangle(); dx = 100; dy = 0; } @Override public void Input(float x, float y) { triangle.moveTo(x, y); } @Override public void Update() { triangle.moveTo(dx, dy); } @Override public void Draw(GL10 gl) { triangle.draw(gl); } }[/code]
  11. Scripting Idea... good or bad?

    I know there are people on this forum who can answer this question *bump*
  12. My Pong game isn't working

    By just a glance, don't flip the y velocity when hitting the paddle; you should only flip the x velocity. If the ball gets stuck in the paddle, you need to apply the new velocity to the ball's X right after flipping it: [code] xVel *= -1; x += xVel; [/code]
  13. I started a thread here: [url="http://www.gamedev.net/topic/611484-boostpython-help/"]http://www.gamedev.net/topic/611484-boostpython-help/[/url] which still hasn't been responded to, so I was thinking of a work around. I think my issue is I'm trying to expose a class inherited from another class inherited from another class... so I was wondering if composing a iScript interface which has all the functions allowed to be called from a script. The interface would contain a pointer to the game state manger and work only with it. Ex: iScript.LoadImage(PathToImage) would access the LoadImage function of the state on the top of the state manager's stack. Of course I'd do type verification to make sure the functions exist within a given state. Then I just need to expose this simple, but most likely large class of functions to python. My question is, is this bad design? Is there a better approach? Please be specific as to what makes it bad design so I can learn. XD
  14. Boost::Python Help

    I think it may be due to inheritance issues as sMainMenu is derived of sMenu which is derived of GameState... I'm not really sure how to wrap it all up: GameState: [code] class GameState { public: virtual const void Init(GameStateManager* g) = 0; virtual const void Cleanup() = 0; virtual const void Pause() = 0; virtual const void Resume() = 0; virtual const void HandleEvents() = 0; virtual const void Update() = 0; virtual const void Draw(sf::RenderWindow* window) = 0; void ChangeState(GameState* state); /// Utility functions for Python mostly void LoadImage(std::string path); void LoadSprite(int textureNum, int x, int y); protected: std::vector<sf::Texture> textures; std::vector<sf::Sprite> sprites; std::vector<sf::Text> text; GameStateManager* game; bool isPaused; }; [/code] sMenu: [code] class sMenu : public GameState { public: virtual const void Init(GameStateManager* g); const void Cleanup(); const void Pause(){isPaused = true;} const void Resume(){isPaused = false;} const void HandleEvents(); const void Update(); const void Draw(sf::RenderWindow* window); ///Utility functions mostly for Python void LoadButton(int textureI, int textureA, int x, int y); protected: std::vector<Button> buttons; int selected; virtual const void toDo(int which) = 0; }; [/code] sMainMenu: [code] class sMainMenu : public sMenu { public: virtual const void Init(GameStateManager* g); const void toDo(int which); };[/code]
  15. Boost::Python Help

    Alright I switched from an import to the boost::python::exec_file() method. It was crashing because I passed the pile name with the .py extension, when I removed it, it threw an error message before crashing: [code] Error in Python: <class 'SyntaxError'>: ('invalid character in identifier', ('Ma in_Menu', 1, 3, '?????????\x04x\x18???\x04????????????')) This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Process returned 3 (0x3) execution time : 98.969 s Press any key to continue. [/code] Any help?
  • Advertisement