Small amounts of introducing myself, pleading for advice, and offering assistance

impaktor
Posts: 1008
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Small amounts of introducing myself, pleading for advice, and offering assistance

Post by impaktor »

Thanks! Any help is welcome, obviosly. Forgive me if I sounded frustrated.

Feel free to edit the wiki, if you see stuff that looks wrong or outdated, it most likely is. And yeah, you're right that the ones who write the code know best what to put on the wiki, but "fleshing out" stuff, would be good for others, and writing tutorial and such.
bszlrd
Posts: 1084
Joined: Mon Jul 01, 2013 3:25 pm
Location: Budapest HU

Re: Small amounts of introducing myself, pleading for advice, and offering assistance

Post by bszlrd »

I wrote most of the documentation for the new HUD as we were working on it, so the lack of it won't be a showstopper. And when I had the time for it at that time. Same with that transfer tutorial, which shows how you actually use the new stuff.

My intention with making the HUD docs accessible is to try luring in people building and testing master. The more eyes and questions, the better view we have on the usability of it. This was my reason for posting teaser pictures of it on the ssc forum too.
kennworl
Posts: 40
Joined: Thu Jul 13, 2017 9:54 am
Location: Melbourne, Australia

Re: Small amounts of introducing myself, pleading for advice, and offering assistance

Post by kennworl »

Well, after some fiddling around, I managed a small measure of success and I can now send the 3 digit heading from the reticule to a 7 segment LED display hooked up to my Arduino MEGA board. Yay team!

However, after about 30 seconds, something happens to slow the game down to a crawl. I have no idea why, but if I comment out the Lua line where I write the heading value to the serial port (COM3), the game behaves normally. This comes down to my ignorance of Lua. Am I inadvertently creating a new instance of a Lua class every time I invoke a method? Are there zillions of objects building up over time which then slows the machinery down once it gets to a certain level? Who knows. But I've had a bit of a win today, so I'll focus on the positive (and have a small boast to the forum). :-)

Love to get some advice on the problem if someone has any.
impaktor
Posts: 1008
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Small amounts of introducing myself, pleading for advice, and offering assistance

Post by impaktor »

Very cool!

I suspect you might not want to cram information through COM3 every frame?
kennworl
Posts: 40
Joined: Thu Jul 13, 2017 9:54 am
Location: Melbourne, Australia

Re: Small amounts of introducing myself, pleading for advice, and offering assistance

Post by kennworl »

Yes, that's true. I need to refine the code and only communicate when there is a change of heading value. I will be sending heaps more info down as I add displays and controls, so every frame is not a good approach. However I am worried about memory leaks, so some diagnostic work is in order. But at least I am starting to get my c++ mojo back, and I know how to hook up Lua (I think).
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Small amounts of introducing myself, pleading for advice, and offering assistance

Post by FluffyFreak »

Without seeing how you've implemented the code it's hard to say exactly why it's slowing down.
Do you have the branch available and pushed on GitHub?

However you do want to rate limit it, since the game is probably running at 30 to 60 frames per second, or even more if VSync is disabled where my PC can hit over 1000fps! You probably only need to update the heading at a low rate like 15hz.
kennworl
Posts: 40
Joined: Thu Jul 13, 2017 9:54 am
Location: Melbourne, Australia

Re: Small amounts of introducing myself, pleading for advice, and offering assistance

Post by kennworl »

Hi Andy.

No, I only got as far as cloning the master to my desktop and getting it to compile under Visual Studio 2017 before I started messing with it. I need to create a branch in Github. I did see some instructions somewhere around here. :-)

As for updating the heading, I intend to only do that if the heading actually changes, but I haven't got that far yet. I want to see if I can find the culprit first, but I might start that branch so people can see what I have done (if they're interested). In the end I took your advice and modelled it the same as the Game and LuaGame classes. It does work, other than the obvious problem. But I also want to hook controls (inputs) through there as well, and I need to find out the best way to do that.
kennworl
Posts: 40
Joined: Thu Jul 13, 2017 9:54 am
Location: Melbourne, Australia

Re: Small amounts of introducing myself, pleading for advice, and offering assistance

Post by kennworl »

Update: All is well now. Impaktor was bang on. I was somehow overloading COM3 with data. This may prove to be a problem later on, but I have put a guard in so that only if the heading changes will it be sent to COM3. Game plays perfectly and I have a big red and cool looking heading display. :-)

Now I want to add a switch to toggle the landing gear (simulating the F6 button I guess).

Note: during the testing, I did notice that the lua code will produce both 0 degrees and 360 degrees. An insignificant bug in the calculation which I will look at soon.
Post Reply