Programming a game efficiently in javaFX [duplicate] - javafx-8

This question already has answers here:
What is the best way to display millions of images in Java?
(2 answers)
Closed 6 years ago.
Dear Stackoverflowers,
I am currently trying to remake my own age of empires game in javafx.
I have made a "Tree" Class which extends a "Resource" Class which extends a "Sprite" Class which extends the javafx.scene.layout.Region class. After adding roughly 2000 Tree objects the game will start running noticably less smoother.
If anyone has any suggestions on how to make it more efficient, I'd love to hear it.

You might consider switching caching on for your trees. This is discussed here:
How do setCache() and CacheHint work together in JavaFX?
On the other hand you might ask yourself why you need such a heavy structure for your trees. Can't you just use a set of images?

Related

Building system like clash of clans / boom beach

Is anyone knows how to do a building system like coc / boom beach? I know how to do a fortnite building system but there's only 1x1 structures to do while i need 3x2, 5x3 and many more sizes to go. I'm going to do it using UE4 with Blueprints. I've been looking so long and couldn't find answer. Hope you'll help me!
Thanks.
As the question is rather vague and doesn't give anyone much to go on. I'll try to take a stab at it, conceptually at least.
I'd assume that you have a base building BP or struct so, in there I would create a Vector2D variable or something similar to give it a length and width per building.
Then when you are trying to spawn the building, check the tiles that are that length and width away from the center of the screen/cursor for any existing buildings. Then when you spawn the building make sure that the building takes claim over the tiles that it is using so others will not be able to overlap later on.
So your main "meat and potatoes" of this project will be creating a grid system and also creating a system that can check whether or not a tile is inhabited already and also using and releasing tiles when needed.
If you want someone to give you a more concrete answer, you will need to show what you have done and tried in your question. Especially for one as broad as this one.

How to impose a constraint on contours frame by frame [closed]

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 8 years ago.
Improve this question
I'm implementing some piece of code in MATLAB to track left ventricle wall position in echocardiography images using a contour-based method. Unfortunately in some frames the contour evolves more than it is expected and in some regions the wall does not have good contrast.
Does anyone know a way to restrict contours from unexpected evolution from frame to frame saving both old frame's position and new one's shape?
Thank you all for helping.
Image segmentation is a hard problem. There is no general approach that works well in every situation. How are your contours being defined? Are you doing threshold-based segmentation, or using another approach? Have you tried transforming into a polar coordinate system in the centre of the LV? Have you tried quantifying some sort of 'least-squares' cost associated with moving the contour?
All I can suggest is look at how people solve similar problems. In my field (namely MRI), the best we have a) isn't really all that good, and b) is probably this open-source Matlab 'program' designed for cardiac segmentation called segment (see http://medviso.com/products/segment/features/cmr/). I suggest you look at how they do it, and see if you can adapt the method to work with the (much noisier, much harder to interpret) echo images.
Sorry I can't be more helpful!

How do I create a spinning globe with points of interest for an iPhone app? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Any one know of an OpenGL ES example of an interactive globe/earth for the iPhone
I'd like to build an app with a spinning 3d globe and a few points of interest on, which the user can interact with (zoom in, click on point of interest, turn and stop globe etc). I've seen an example of how to build a sphere using OpenGL ES and Cocos2d-iPhone (neither of which I have any experience with) but I wondered if this is the best approach, as both the examples I found seem to have no user interaction enabled.
What I would like is for someone to advise me the best way of building this? Should I use OpenGL ES or Cocos2d-iPhone or is there some other way that's better (considering I'd like the user to interact with it)?
I have the co-ordinates I need, but I'm unsure how I would even go about mapping them onto a sphere. Should I use a textured Image on the Globe? And then how would I go about adding the interaction>
Any advice would be really useful as I seem to be going round in circles with this (pardon the pun).
Thanks in advance!
Thanks Brad - eventually we found this link which provides the source - which is pretty cool (and free), so thought I should share:
http://www.scoop.it/t/ios-developing/p/628999997/whirlyglobe-for-ios

PyQt: Drag'n'Drop based Scrabble UI

I've written a simple Scrabble game with a simple Bot and Human part which can interact using consolebased I/O. Although there is already a Qt based overview of the current situation in the game: A simple custom QWidget which simply paints everything. No interaction or anything fancy yet.
(source: b52 at reaktor42.de)
My problem is that I would like to remove the consolebased interaction and switch to a new Drag'n'Drop based approach, but I'm not that familiar with PyQt and GUI development in general.
Therefor my question is, what would be a good way to go? Creating custom Layouts for Board and Rack and custom Letter Widget which would be dragable?
Thanks in advance
Oli
That looks pretty good! If you need to actually move things around on the screen using the mouse, I think the Graphics View Framework would be a better way to go than widgets.

Example code on how to achieve smooth paint strokes like those seen in the Penultimate app [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
iPhone smooth sketch drawing algorithm
I'm looking for an actual demonstrable example of code or an algorithm responsible for super smooth beautiful paint strokes like those found in the Penultimate app?
Heck, any code that demonstrates any smooth paint stroke based upon a user's finger stroke would be great. The elusive nugget I'm seeking is "smooth". Other answers on SO attempt to address smooth stroke drawing, however none target Penultimate as the elusive goal, and none of the solutions achieve anything as smooth and refined as Penultimate, which is what this question is after specifically, not just general smoothing algorithms.
This has been discussed a few times. You need to use bezair curves and OpenGL. I don't want to rewrite it all, so here is a link to an answer I posted a while ago on the same topic. It is a rather robust answer and should help you get in the right direction.