Python Forum
Where to start, a fun simulator - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Game Development (https://python-forum.io/forum-11.html)
+--- Thread: Where to start, a fun simulator (/thread-19453.html)

Pages: 1 2


Where to start, a fun simulator - SX1493 - Jun-30-2019

Hello everyone,

Been on a Python learning craze this past month, really jumped with both feet towards the water. It has been an awesome adventure. I believe this post belongs here because I want to make a simulator. The simulator is based upon a piece of equipment that I use at work. It is known as the Flight Data Input Output. It's function is for a user to enter aircraft data in fields, elements and characters. Each field has it's own parameters and limits. For example FP AAL123 B752/L 1234 450 KPHL P1200 340 KPHL..JST..IHD.NESTO3.KPIT

This entry is a flight plan for American Airlines Flight 123 from Philadelphia to Pittsburgh.
Field one is the type of message (FP) flight plan in this case
Field two is the call sign of the aircraft (AAL123) can be referred to as SPD
Field three is the type of aircraft (Boeing 757-200) can be referred to as TYP
Field four is the transponder code (1234) can be referred to as BCN
Field five is the speed (450 kt) can be referred SPD
Field six is a fix (an airport, fix, lat/ long or navigational aid) in this case PHL (Philadelphia Int'l Airport) can be referred to as FIX
Field seven is the time (P is for proposed, at 1200) can be referred to as TIM
Field eight is the current altitude (none because the aircraft is in proposed status) can be referred to as ALT
Field nine is the requested altitude (34,000 feet) can be referred to as RAL
Field 10 is the route of flight. KPHL is the departure airport, JST is a navigational aide, IHD is a navigational aide, NESTO3 is an arrival procedure and KPIT is the destination, Pittsburgh Int'l. can be referred to as RTE

Field 10 requires that like elements are connected by 2 dots (..) and unlike elements are connected by only 1 dot (.).


This is a basic overview, but I wrote the example because I'm not sure how to classify the project, because it seems more like an emulator, but I am not sure. It seems that this has resemblance of a language in and of itself. It is based upon early 1980's technology and it follows strict parameters (I can share all kinds of information if anyone is interested) so I figured Python would be a great language to make this happen. Any help as to how to get started and how certain functions that I could write would be useful. I am also excited to have a GUI for users to interact with 'simulator'. Any help is appreciated. I'd love to see this come to realization. I am ready to work hard and do what is necessary, I have been wanting to do something like this for a while now. It would benefit my co-workers in their training process.

Thank you! Big Grin

Steve


RE: Where to start, a fun simulator - metulburr - Jun-30-2019

(Jun-30-2019, 02:53 AM)SX1493 Wrote: It's function is for a user to enter aircraft data in fields, elements and characters.
After reading your post, i still dont have an exact idea of what you are making. Do you refer to fields as input boxes? Are you looking for more a live flight tracker? Are you trying to make a 3d model simulator?


RE: Where to start, a fun simulator - SX1493 - Jun-30-2019

I am still working on my terminology,sorry!, but thank you for the reply. The user inputs messages just like the one I wrote out, in a long string, and hits enter. I would like for the simulator to logic check to see if the information is correct in format and uses proper syntax. If all is correct, the simulator accepts the input. If there is spelling error on a fix, or an invalid character is in one of the fields, I would like to simulator to respond with an error message. It is not fancy in terms of graphics or functionality, just a simple GUI with a blinking cursor for the user to input a flight plan or other appropriate message. This system is tedious and very persnickety, and causes a lot of grief to new users, hence why I'd like to simulate it.

I would like to import a list or library (novice terminology here) to have the simulator logic check the message to see if the input includes not arbitrary characters, but actual fixes and locations in my "airspace".

* Field two is not SPD, it is the Aircraft Identification, apologies on that.


RE: Where to start, a fun simulator - metulburr - Jun-30-2019

Ah OK. When you said "simulator" and "flight paths" I was thinking in terms of 3d.

Any GUI library should do. Tkinter, WxPython, PyQT, etc. for the graphics part.

(Jun-30-2019, 03:20 AM)SX1493 Wrote: check to see if the information is correct in format and uses proper syntax.
This is just basic python input verification



RE: Where to start, a fun simulator - SX1493 - Jun-30-2019

Thank you for the reply. I will look into all of the suggestions. To give you a better understanding of what I am talking about, let me share with you the training material. It would greatly explain what I am trying to convey. Is there anyway to post attachments to this thread?

Thank you so much,


RE: Where to start, a fun simulator - SheeppOSU - Jun-30-2019

Here is a little example of what I think you are trying to achieve but with colors. For this example I used pygame
import pygame, time, sys, random

colors = {'blue' : (0,0,255), 'green' : (0,255,0), 'red' : (255,0,0), 'black' : (0,0,0), 'white' : (255,255,255)}

def main():
    #To be more sophisticated, all the input could be textboxes (this would also cause for smoother running because input modules stop the pygame GUI from running and it gets kind of wacky)
    interval = int(input('Type a time in which you will have to guess and type the color:\n'))
    pygame.init()
    Screen = pygame.display.set_mode((100, 100))
    while True:
        #Leave
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                break
        #Random color
        num = random.randint(1, len(colors))
        count = 0
        for c in colors:
            count += 1
            if count == num:
                color = c
                break
        #Fill screen w/ color
        Screen.fill(colors[color])
        pygame.display.update()
        #Guess, timer, and validation
        past = time.time()
        answer = input('Guess here:\n')
        if time.time() - past > interval:
            print('Too slow!')
        elif answer.lower() == color:
            print('Great job')
        else:
            print('Wrong')
            

if __name__ == '__main__':
    main()
    pygame.quit()
    sys.exit()



RE: Where to start, a fun simulator - SX1493 - Jul-01-2019

I will look at this in detail. Thank you for enabling for me to attach. The attached is a near perfect definition of the scope and parameters of this project. I had to copy and paste the meat and potatoes of the document because it was too large to attach. But if you have any questions, let me know. I love teaching this stuff for a living, hence why I'd love to create a tool to help! I can also post pictures and video of the real thing with the hardware too.


Thank you all for the help, I'm feeling a sense of concepts coming to life here.


Steve


RE: Where to start, a fun simulator - SX1493 - Jul-09-2019

Hey guys, I know that this may sound abstract, but as I learn and read more, maybe I can explain better. So when a message is input, I would like for it to be checked for logic and syntax, but, in the case of a flight plan (FP) message, I would like for it to be saved to a database, and assigned a 3 digit ID. So then, a user can manipulate that flight plan with an amendment message(AM). I also think that I may need to construct data bases with all acceptable elements in field 10 (RTE, or the route) so that it's realism remains.

I was wondering if what I am going for here is more in line with a command line interface? Would that be easier? Or is a simple GUI suitable?

Thank you for any feedback


RE: Where to start, a fun simulator - SheeppOSU - Jul-10-2019

I think that a command line interface would be easier to do. You wouldn't have to layout the interface and make sure the GUI runs smoothly. You can though, achieve the same result with a GUI, it would just take a little more effort. So it's up to you.


RE: Where to start, a fun simulator - metulburr - Jul-10-2019

I agree with SheeppOSU. I always do command line/terminal programs for my own needs. And only create a GUI if other people are going to use them. Usually those oblivious to computers as well. Command line is always faster and less code to maintain and create. So if it does not need GUI i would surely start it out in it. But I still have no idea what exactly your doing so i couldnt help even if you are just doing command line. GUI is a whole other ball game.

Ive also noticed that the more precise a program is, the less help there is. It has to be broken down in to steps for you to make as well as others to understand it to help. Also you have to start it...because we have no idea what you are doing other than what you say. And your first post was surely confusing.

(Jul-09-2019, 07:05 PM)SX1493 Wrote: So when a message is input, I would like for it to be checked for logic and syntax, but, in the case of a flight plan (FP) message, I would like for it to be saved to a database, and assigned a 3 digit ID.
This is more understandable, but you would have to start the code, not us. We dont know what the content to be parsed is, what the logic is, what is considered a flight plan, The content parsed out of the text, etc. And i have never heard of a "Flight Data Input Output", so i am going off nothing.

If you have code to show us it helps tremendously. Then we can actually see an example to help with.