game-engine

Why do I get bad performance with SDL2 and SDL_RenderCopy inside a double for loop over all pixels?

帅比萌擦擦* 提交于 2019-11-29 11:10:58
I am programming a raycasting game using SDL2. When drawing the floor, I need to call SDL_RenderCopy pixelwise. This leads to a bottleneck which drops the framerate below 10 fps. I am looking for performance boosts but can't seem to find some. Here's a rough overview of the performance drop: int main() { while(true) { for(x=0; x<800; x++) { for(y=0; y<600; y++) { SDL_Rect src = { 0, 0, 1, 1 }; SDL_Rect dst = { x, y, 1, 1 }; SDL_RenderCopy(ren, tx, &src, &dst); // this drops the framerate below 10 } } SDL_RenderPresent(ren); } } You should probably be using texture streaming for this. Basically

Detect mouseover an image in Pygame

僤鯓⒐⒋嵵緔 提交于 2019-11-29 11:07:20
I have an image: newGameButton = pygame.image.load("images/newGameButton.png").convert_alpha() I then display it on the screen: screen.blit(newGameButton, (0,0)) How do I detect if the mouse is touching the image? sloth Use Surface.get_rect to get a Rect describing the bounds of your Surface , then use .collidepoint() to check if the mouse cursor is inside this Rect . Example: if newGameButton.get_rect().collidepoint(pygame.mouse.get_pos()): print "mouse is over 'newGameButton'" hammythepig I'm sure there are more pythonic ways to do this, but here is a simple example: button_x = 0 button_y =

Cocos2D OR libgdx for Android Game Development [closed]

删除回忆录丶 提交于 2019-11-29 09:30:50
I just want to know, that in the long run, using which of these engines will be better. Although I feel that using Cocos2D will be a better option, as it can also be used for iphone development, there's just 1 tutorial http://dan.clarke.name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/ which I've found so far. libgdx, on the other hand has a complete book. Jong Consider using AndEngine . From a short look at libgdx, they seem similiar (Although AndEngine is 2D only). However, AndEngine has everything you need for a 2D game. The only thing it lacks is documentation, but it is open

Chipmunk Physics or Box2D for C++ 2D GameEngine?

我的未来我决定 提交于 2019-11-29 03:52:43
I'm developing what it's turning into a "cross-platform" 2D Game Engine, my initial platform target is iPhone OS, but could move on to Android or even some console like the PSP, or Nintendo DS, I want to keep my options open. My engine is developed in C++, and have been reading a lot about Box2D and Chipmunk but still I can't decide which one to use as my Physics Middleware. Chipmunk appears to have been made to be embedded easily, and Box2D seems to be widely used. Chipmunk is C , and Box2D is C++, but I've heard the API's of Box2D are much worse than chipmunk's API's. For now I will be using

Building a simple online game server for Unity

拜拜、爱过 提交于 2019-11-29 01:17:32
问题 I'm trying to build an online game server for my Tank game 2D (Unity). In my game there will be 2-4 players control their tanks and fight each other. I've tried to use Unity networking, it was not really suitable for my game because we have to choose 1 of the players in the room to become the "server", which is not really flexible for my future development (e.g. when the "server" quit, I have to do a lot of work to remain connections between the other players). Then I've tried to build my own

NSTimer vs CACurrentMediaTime()

落花浮王杯 提交于 2019-11-28 20:13:46
问题 So I'm amidst my first iOS game and am struggling with how to go about the best way to integrate object movement. The game relies heavily on fast moving objects and constant, fast user input changes. As such, I'm trying to have object integration and the constraint solver run as quickly and accurately as possible (to minimize user input change in between successive game loop calls). More specifically, I'm unsure of the capabilities of the NSTimer class and CACurrentMediaTime() function. It's

Avoid ground collision with Bullet

独自空忆成欢 提交于 2019-11-28 19:00:52
I'm trying to use Bullet physic engine to create a 3D world. I've got my character with a Capsule shape on his body and my ground his made of some static blocs stick together, here is a schema to illustrate my words: The problem is present when my character run from one block to another: Bullet detect a collision and my character start to jump a little bit on y-axis. How can I avoid the problem? What I did to overcome this issue is the following: Instead of have the capsule slide on the ground, I had a dynamic capsule ride on top of a spring. I implemented the spring as several ray casts

Making a hack proof game in Javascript [closed]

旧巷老猫 提交于 2019-11-28 18:49:20
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . Suppose you created an online game in HTML5/JavaScript. All the code would be downloaded into the user's browser, and they would run the game. How do you stop someone from copying the game onto their computer, and injecting functions and modules to cheat? For example, they could

What are the “gotchas” when developing an iPhone Game? [closed]

蹲街弑〆低调 提交于 2019-11-28 15:53:18
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . Am used to developing business and reference apps. Now I have to do an iPhone game. What tips can you share to help me with: understanding the scope of the project defining the deliverables specifying the game play and other parameters estimating the development effort testing the

Is there any game engine in Scala? [closed]

此生再无相见时 提交于 2019-11-28 15:47:57
问题 I wonder if there are any game engine written in Scala or easily accesible from Scala? 回答1: All the Java gaming engines are easily accessible due to easy Java integration. There are several (not sorted in any way): http://www.jmonkeyengine.com/ http://www.13thmonkey.org/~boris/jgame/ https://jge.dev.java.net/ http://www.lwjgl.org/ https://sourceforge.net/projects/tjger/ A good presentation how to start coding a game in Java is Write a 3-D Game in the Java Programming Language in Less Than 50