Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+16 votes

A student asked via email:

Hello, Dr. Stonedahl, for this final project, is there any specific chapter of textbook or any video you recommend?

(I will respond with one answer, but I encourage everyone to chime in with your own answers to include more resources that may be helpful.)

asked in CSC335_Spring2019 by (508 points)

1 Answer

+9 votes

For task M1, creating the network topologies/maps, you could brush up on what ring/star topologies look like, and for the firewall one you might need to review CIDR address range specification, if you don't remember these ideas from class. Otherwise, it's just a matter of reading the sample grid network generation code, and writing your own code that's similar.

For task M2 (the multi-player networking part), the relevant textbook portions would be either:

Chapter 11 if you're choosing UDP, or
Chapter 12 if you're choosing TCP.

Ideally, you should be able to refer back to your solution to the ChatRoom assignment that was assigned as homework earlier. Alternatively, you can search the net for "java socket programming" tutorials online.

However there is one more concept that you need to understand to complete the multiplayer networking aspect, which is "serialization" -- that is, converting a Java object into a sequence of bytes, and converting that sequence of bytes back into an Java object. You can approach this using either Java's built-in binary serialization (which converts objects into a binary format) or you can convert objects into JSON strings using Google's Gson library, which is already included as a library in the CyberBattle project (because it's being used for saving/loading the SimNetwork objects as text files).

Here are some decent lecture slides from another college which talk about both TCP socket programming AND serialization in Java.

Here's a short tutorial on how to do serialization using the gson library.

EDIT: UPDATE: And you might also want to read a tutorial about using Threads in Java, and after you understand the concepts from that tutorial, you can learn the shortest syntax to create new Threads using lambda expressions (e.g.

new Thread( () -> /* code to run concurrently here*/).start()

For the challenge tasks... well, you'll need to read more of the existing CyberBattle codebase and figure things out.

answered by (508 points)
edited by