K
K
krembrule20162019-01-26 20:24:58
Java
krembrule2016, 2019-01-26 20:24:58

How to improve the responsiveness of handling clicks on the navigation keys?

Всем привет!
Пытался написать плавно перемещающуюся камеру с равноускоренным движением. В принципе, это удалось. Однако, когда долбишь по противоположным клавишам навигации аки демон(Вправо-Влево-(резко) Вправо), то объект чутка задумывается. Хотелось бы добиться отзывчивости как это делают в играх. Специально скачал и посмотрел как на осатанелую долбежку по клавишам реагирует камера в Warcraft, и там она идеально отзывается на каждое нажатие клавиши.
Репозиторий с файлами:
https://github.com/lalalend1992/project
Их всего два и текстурка.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Дмитрий Александров, 2019-01-26
@krembrule2016

%trolleybus_from_a_bread_loaf.jpg%
Javafx is made for a completely different purpose, incl. and the implementation of 3D in it. In games, everything is implemented as predictably as possible, a simple cycle in which everything happens extremely consistently and absolutely everything that is unnecessary is cut off.
Specifically, here you must first read how the cycle works in javafx, what follows, etc. Further, in any case, javafx drags tons of absolutely unnecessary code with it. In addition, for the correct implementation of everything and everything, you need to take into account the time delta from which everything dances in real time. Basically, I don't even know how to describe it. Well, try to imagine that you are hammering nails with a microscope, and now that you need to hammer five thousand nails. Can? can! Conveniently? not really. Practical? absolutely not.
In general, if you want real-time games, then look at jmonkey engine, libgdx, if it's more hardcore then JOGL, LWJGL.
PS, as an option, try to draw in canvas, but again, this will not solve the lion's share of problems in any way. If the game and javafx are direct, then something more measured but not real-time where such problems will be seen.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question